mirror of
https://github.com/mudler/luet.git
synced 2025-08-02 07:59:22 +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)
|
||||
// Build a topological graph
|
||||
added := map[string]map[string]interface{}{}
|
||||
for _, a := range unorderedAssertions {
|
||||
currentPkg := a.Package
|
||||
added := map[string]interface{}{}
|
||||
REQUIRES:
|
||||
for _, requiredDef := range currentPkg.GetRequires() {
|
||||
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 {
|
||||
requiredDef = req.Package
|
||||
}
|
||||
if _, ok := added[currentPkg.GetFingerPrint()][requiredDef.GetFingerPrint()]; ok {
|
||||
if _, ok := added[requiredDef.GetFingerPrint()]; ok {
|
||||
continue REQUIRES
|
||||
}
|
||||
// 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())
|
||||
if _, ok := added[currentPkg.GetFingerPrint()]; !ok {
|
||||
added[currentPkg.GetFingerPrint()] = map[string]interface{}{}
|
||||
}
|
||||
added[currentPkg.GetFingerPrint()][requiredDef.GetFingerPrint()] = nil
|
||||
added[requiredDef.GetFingerPrint()] = nil
|
||||
}
|
||||
}
|
||||
result, err := graph.TopSort(fingerprint)
|
||||
|
Loading…
Reference in New Issue
Block a user