mirror of
https://github.com/mudler/luet.git
synced 2025-08-17 14:56:46 +00:00
Simplify ordering check
we don't need a map[string]map[string]interface{}, as we don't need to keep the data around
This commit is contained in:
parent
b68634b58a
commit
20cb96e0cc
@ -170,9 +170,9 @@ func (assertions PackagesAssertions) Order(definitiondb pkg.PackageDatabase, fin
|
|||||||
|
|
||||||
sort.Sort(unorderedAssertions)
|
sort.Sort(unorderedAssertions)
|
||||||
// Build a topological graph
|
// Build a topological graph
|
||||||
added := map[string]map[string]interface{}{}
|
|
||||||
for _, a := range unorderedAssertions {
|
for _, a := range unorderedAssertions {
|
||||||
currentPkg := a.Package
|
currentPkg := a.Package
|
||||||
|
added := map[string]interface{}{}
|
||||||
REQUIRES:
|
REQUIRES:
|
||||||
for _, requiredDef := range currentPkg.GetRequires() {
|
for _, requiredDef := range currentPkg.GetRequires() {
|
||||||
if def, err := definitiondb.FindPackage(requiredDef); err == nil { // Provides: Get a chance of being override here
|
if def, err := definitiondb.FindPackage(requiredDef); err == nil { // Provides: Get a chance of being override here
|
||||||
@ -185,15 +185,12 @@ func (assertions PackagesAssertions) Order(definitiondb pkg.PackageDatabase, fin
|
|||||||
if req != nil {
|
if req != nil {
|
||||||
requiredDef = req.Package
|
requiredDef = req.Package
|
||||||
}
|
}
|
||||||
if _, ok := added[currentPkg.GetFingerPrint()][requiredDef.GetFingerPrint()]; ok {
|
if _, ok := added[requiredDef.GetFingerPrint()]; ok {
|
||||||
continue REQUIRES
|
continue REQUIRES
|
||||||
}
|
}
|
||||||
// Expand also here, as we need to order them (or instead the solver should give back the dep correctly?)
|
// Expand also here, as we need to order them (or instead the solver should give back the dep correctly?)
|
||||||
graph.AddEdge(currentPkg.GetFingerPrint(), requiredDef.GetFingerPrint())
|
graph.AddEdge(currentPkg.GetFingerPrint(), requiredDef.GetFingerPrint())
|
||||||
if _, ok := added[currentPkg.GetFingerPrint()]; !ok {
|
added[requiredDef.GetFingerPrint()] = nil
|
||||||
added[currentPkg.GetFingerPrint()] = map[string]interface{}{}
|
|
||||||
}
|
|
||||||
added[currentPkg.GetFingerPrint()][requiredDef.GetFingerPrint()] = nil
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result, err := graph.TopSort(fingerprint)
|
result, err := graph.TopSort(fingerprint)
|
||||||
|
Loading…
Reference in New Issue
Block a user