diff --git a/pkg/compiler/artifact.go b/pkg/compiler/artifact.go index 57016876..f3f173ec 100644 --- a/pkg/compiler/artifact.go +++ b/pkg/compiler/artifact.go @@ -71,18 +71,39 @@ func NewPackageArtifactFromYaml(data []byte) (Artifact, error) { } func (a *PackageArtifact) WriteYaml(dst string) error { - a.CompileSpec.GetPackage().SetPath("") - for _, ass := range a.CompileSpec.GetSourceAssertion() { - ass.Package.SetPath("") - } + //p := a.CompileSpec.GetPackage().GetPath() + + //a.CompileSpec.GetPackage().SetPath("") + // for _, ass := range a.CompileSpec.GetSourceAssertion() { + // ass.Package.SetPath("") + // } data, err := yaml.Marshal(a) if err != nil { return errors.Wrap(err, "While marshalling for PackageArtifact YAML") } + + mangle, err := NewPackageArtifactFromYaml(data) + if err != nil { + return errors.Wrap(err, "Generated invalid artifact") + } + //p := a.CompileSpec.GetPackage().GetPath() + + mangle.GetCompileSpec().GetPackage().SetPath("") + for _, ass := range mangle.GetCompileSpec().GetSourceAssertion() { + ass.Package.SetPath("") + } + + data, err = yaml.Marshal(mangle) + if err != nil { + return errors.Wrap(err, "While marshalling for PackageArtifact YAML") + } + err = ioutil.WriteFile(filepath.Join(dst, a.GetCompileSpec().GetPackage().GetFingerPrint()+".metadata.yaml"), data, os.ModePerm) if err != nil { return errors.Wrap(err, "While writing PackageArtifact YAML") } + //a.CompileSpec.GetPackage().SetPath(p) + return nil } diff --git a/pkg/compiler/compiler.go b/pkg/compiler/compiler.go index c3e25b96..2f7eb138 100644 --- a/pkg/compiler/compiler.go +++ b/pkg/compiler/compiler.go @@ -437,7 +437,7 @@ func (cs *LuetCompiler) compile(concurrency int, keepPermissions bool, p Compila Info(pkgTag, " :zap: Building dependency") compileSpec, err := cs.FromPackage(assertion.Package) if err != nil { - return nil, errors.New("Error while generating compilespec for " + assertion.Package.GetName()) + return nil, errors.Wrap(err, "Error while generating compilespec for "+assertion.Package.GetName()) } compileSpec.SetOutputPath(p.GetOutputPath()) diff --git a/pkg/installer/installer.go b/pkg/installer/installer.go index 8fdfaa69..72d81c1d 100644 --- a/pkg/installer/installer.go +++ b/pkg/installer/installer.go @@ -266,6 +266,7 @@ func (l *LuetInstaller) installerWorker(i int, wg *sync.WaitGroup, c <-chan Arti defer wg.Done() for p := range c { + // TODO: Keep trace of what was added from the tar, and save it into system err := l.installPackage(p, s) if err != nil { //TODO: Uninstall, rollback.