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