mirror of
https://github.com/mudler/luet.git
synced 2025-06-25 15:01:55 +00:00
Fixup resolvedeps updates of world
Drop useless code and address to some TODOs
This commit is contained in:
parent
cca20401e3
commit
802adac5ee
@ -66,19 +66,14 @@ func (gt *DefaultTree) World() ([]pkg.Package, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gt *DefaultTree) UpdateWorldPackage(p pkg.Package) {
|
func (gt *DefaultTree) UpdateWorldPackage(p pkg.Package) {
|
||||||
//FIXME: Improve, no copy is needed
|
//var CacheWorld []pkg.Package
|
||||||
var CacheWorld []pkg.Package
|
|
||||||
|
|
||||||
for _, pid := range gt.CacheWorld {
|
for _, pid := range gt.CacheWorld {
|
||||||
if p.GetFingerPrint() == pid.GetFingerPrint() {
|
if p.GetFingerPrint() == pid.GetFingerPrint() {
|
||||||
CacheWorld = append(CacheWorld, p)
|
pid.Requires(p.GetRequires())
|
||||||
} else {
|
pid.Conflicts(p.GetConflicts())
|
||||||
CacheWorld = append(CacheWorld, pid)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gt.CacheWorld = CacheWorld
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Dup in Packageset
|
// FIXME: Dup in Packageset
|
||||||
@ -96,47 +91,33 @@ func (gt *DefaultTree) FindPackage(pack pkg.Package) (pkg.Package, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gb *DefaultTree) updatePackage(p pkg.Package) error {
|
func (gb *DefaultTree) updatePackage(p pkg.Package) error {
|
||||||
Debug(" "+p.GetName(), "Deps ")
|
Debug("Calculating deps for", p.GetName())
|
||||||
for i, r := range p.GetRequires() {
|
for i, r := range p.GetRequires() {
|
||||||
|
|
||||||
foundPackage, err := gb.FindPackage(r)
|
foundPackage, err := gb.FindPackage(r)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|
||||||
found, ok := foundPackage.(*pkg.DefaultPackage)
|
found, ok := foundPackage.(*pkg.DefaultPackage)
|
||||||
if !ok {
|
if !ok {
|
||||||
panic("Simpleparser should deal only with DefaultPackages")
|
panic("Simpleparser should deal only with DefaultPackages")
|
||||||
}
|
}
|
||||||
// err = gb.updatePackage(foundPackage)
|
|
||||||
// if err != nil {
|
|
||||||
// return errors.Wrap(err, "Failure while updating recursively")
|
|
||||||
// }
|
|
||||||
p.GetRequires()[i] = found
|
p.GetRequires()[i] = found
|
||||||
} else {
|
} else {
|
||||||
Warning("Unmatched require for", r.GetName())
|
Warning("Unmatched require for", r.GetFingerPrint())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug("Walking conflicts for", p.GetName())
|
Debug("Walking conflicts for", p.GetName())
|
||||||
for i, r := range p.GetConflicts() {
|
for i, r := range p.GetConflicts() {
|
||||||
Debug("conflict", r.GetName())
|
|
||||||
|
|
||||||
foundPackage, err := gb.FindPackage(r)
|
foundPackage, err := gb.FindPackage(r)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|
||||||
found, ok := foundPackage.(*pkg.DefaultPackage)
|
found, ok := foundPackage.(*pkg.DefaultPackage)
|
||||||
if !ok {
|
if !ok {
|
||||||
panic("Simpleparser should deal only with DefaultPackages")
|
panic("Simpleparser should deal only with DefaultPackages")
|
||||||
}
|
}
|
||||||
// err = gb.updatePackage(foundPackage)
|
|
||||||
// if err != nil {
|
|
||||||
// return errors.Wrap(err, "Failure while updating recursively")
|
|
||||||
// }
|
|
||||||
p.GetConflicts()[i] = found
|
p.GetConflicts()[i] = found
|
||||||
|
|
||||||
//r = found
|
|
||||||
} else {
|
} else {
|
||||||
Warning("Unmatched conflict for", r.GetName())
|
Warning("Unmatched conflict for", r.GetFingerPrint())
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Debug("Finished processing", p.GetName())
|
Debug("Finished processing", p.GetName())
|
||||||
@ -147,21 +128,21 @@ func (gb *DefaultTree) updatePackage(p pkg.Package) error {
|
|||||||
|
|
||||||
gb.UpdateWorldPackage(p)
|
gb.UpdateWorldPackage(p)
|
||||||
Debug("Update done", p.GetName())
|
Debug("Update done", p.GetName())
|
||||||
Debug("Triggering propagation", p.GetName())
|
// Debug("Triggering propagation", p.GetName())
|
||||||
|
|
||||||
Debug(" "+p.GetName(), "Deps ")
|
// Debug(" "+p.GetName(), "Deps ")
|
||||||
for _, r := range p.GetRequires() {
|
// for _, r := range p.GetRequires() {
|
||||||
if err := gb.updatePackage(r); err != nil {
|
// if err := gb.updatePackage(r); err != nil {
|
||||||
return err
|
// return err
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
Debug("Walking conflicts for", p.GetName())
|
// Debug("Walking conflicts for", p.GetName())
|
||||||
for _, r := range p.GetConflicts() {
|
// for _, r := range p.GetConflicts() {
|
||||||
if err := gb.updatePackage(r); err != nil {
|
// if err := gb.updatePackage(r); err != nil {
|
||||||
return err
|
// return err
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user