mirror of
https://github.com/mudler/luet.git
synced 2025-09-02 07:45:02 +00:00
Keep the path around after writing the yaml, otherwise compile specs couldn't be found
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
@@ -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())
|
||||
|
||||
|
@@ -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.
|
||||
|
Reference in New Issue
Block a user