mirror of
https://github.com/mudler/luet.git
synced 2025-09-02 07:45:02 +00:00
Fix path deletion on artifacts
This commit is contained in:
@@ -36,10 +36,10 @@ import (
|
|||||||
type ArtifactIndex []Artifact
|
type ArtifactIndex []Artifact
|
||||||
|
|
||||||
func (i ArtifactIndex) CleanPath() ArtifactIndex {
|
func (i ArtifactIndex) CleanPath() ArtifactIndex {
|
||||||
var newIndex []Artifact
|
newIndex := ArtifactIndex{}
|
||||||
copy(newIndex, i)
|
for _, n := range i {
|
||||||
for _, n := range newIndex {
|
art := n.(*PackageArtifact)
|
||||||
n.SetPath(path.Base(n.GetPath()))
|
newIndex = append(newIndex, &PackageArtifact{Path: path.Base(n.GetPath()), SourceAssertion: art.SourceAssertion, CompileSpec: art.CompileSpec, Dependencies: art.Dependencies})
|
||||||
}
|
}
|
||||||
return newIndex
|
return newIndex
|
||||||
//Update if exists, otherwise just create
|
//Update if exists, otherwise just create
|
||||||
|
@@ -162,11 +162,12 @@ func (r *LuetRepository) GetTree() tree.Builder {
|
|||||||
func (r *LuetRepository) Write(dst string) error {
|
func (r *LuetRepository) Write(dst string) error {
|
||||||
|
|
||||||
os.MkdirAll(dst, os.ModePerm)
|
os.MkdirAll(dst, os.ModePerm)
|
||||||
|
r.Index = r.Index.CleanPath()
|
||||||
|
|
||||||
data, err := yaml.Marshal(r)
|
data, err := yaml.Marshal(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
r.Index = r.Index.CleanPath()
|
|
||||||
err = ioutil.WriteFile(filepath.Join(dst, "repository.yaml"), data, os.ModePerm)
|
err = ioutil.WriteFile(filepath.Join(dst, "repository.yaml"), data, os.ModePerm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Reference in New Issue
Block a user