mirror of
https://github.com/mudler/luet.git
synced 2025-09-03 08:14:46 +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 {
|
func (a *PackageArtifact) WriteYaml(dst string) error {
|
||||||
a.CompileSpec.GetPackage().SetPath("")
|
//p := a.CompileSpec.GetPackage().GetPath()
|
||||||
for _, ass := range a.CompileSpec.GetSourceAssertion() {
|
|
||||||
ass.Package.SetPath("")
|
//a.CompileSpec.GetPackage().SetPath("")
|
||||||
}
|
// for _, ass := range a.CompileSpec.GetSourceAssertion() {
|
||||||
|
// ass.Package.SetPath("")
|
||||||
|
// }
|
||||||
data, err := yaml.Marshal(a)
|
data, err := yaml.Marshal(a)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "While marshalling for PackageArtifact YAML")
|
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)
|
err = ioutil.WriteFile(filepath.Join(dst, a.GetCompileSpec().GetPackage().GetFingerPrint()+".metadata.yaml"), data, os.ModePerm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "While writing PackageArtifact YAML")
|
return errors.Wrap(err, "While writing PackageArtifact YAML")
|
||||||
}
|
}
|
||||||
|
//a.CompileSpec.GetPackage().SetPath(p)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -437,7 +437,7 @@ func (cs *LuetCompiler) compile(concurrency int, keepPermissions bool, p Compila
|
|||||||
Info(pkgTag, " :zap: Building dependency")
|
Info(pkgTag, " :zap: Building dependency")
|
||||||
compileSpec, err := cs.FromPackage(assertion.Package)
|
compileSpec, err := cs.FromPackage(assertion.Package)
|
||||||
if err != nil {
|
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())
|
compileSpec.SetOutputPath(p.GetOutputPath())
|
||||||
|
|
||||||
|
@@ -266,6 +266,7 @@ func (l *LuetInstaller) installerWorker(i int, wg *sync.WaitGroup, c <-chan Arti
|
|||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
|
|
||||||
for p := range c {
|
for p := range c {
|
||||||
|
// TODO: Keep trace of what was added from the tar, and save it into system
|
||||||
err := l.installPackage(p, s)
|
err := l.installPackage(p, s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
//TODO: Uninstall, rollback.
|
//TODO: Uninstall, rollback.
|
||||||
|
Reference in New Issue
Block a user