diff --git a/pkg/sat/sat.go b/pkg/sat/sat.go index 7a0889d..d2d0717 100644 --- a/pkg/sat/sat.go +++ b/pkg/sat/sat.go @@ -167,25 +167,25 @@ func Resolve(model *Model) (install []*api.Package, excluded []*api.Package, for if solution.Status.String() == "SAT" { logrus.Infof("Solution with weight %v found.", solution.Weight) - installMap := map[VarContext]*api.Package{} - excludedMap := map[VarContext]*api.Package{} - forceIgnoreMap := map[VarContext]*api.Package{} + installSet := map[*api.Package]struct{}{} + excludedSet := map[*api.Package]struct{}{} + forceIgnoreSet := map[*api.Package]struct{}{} for k, v := range solution.Model { // Offset of `1`. The model index starts with 0, but the variable sequence starts with 1, since 0 is not allowed resVar := model.Var(satVars.satToPkg[strconv.Itoa(k+1)]) if resVar != nil && resVar.varType == VarTypePackage { if v { if exists := model.ShouldIgnore(resVar.Package.Key()); !exists { - installMap[resVar.Context] = resVar.Package + installSet[resVar.Package] = struct{}{} } else { - forceIgnoreMap[resVar.Context] = resVar.Package + forceIgnoreSet[resVar.Package] = struct{}{} } } else { - excludedMap[resVar.Context] = resVar.Package + excludedSet[resVar.Package] = struct{}{} } } } - for _, v := range installMap { + for v := range installSet { key := MakeBestKey(v) bestPackage := model.BestPackage(key) if bestPackage != v { @@ -194,10 +194,10 @@ func Resolve(model *Model) (install []*api.Package, excluded []*api.Package, for install = append(install, v) } - for _, v := range excludedMap { + for v := range excludedSet { excluded = append(excluded, v) } - for _, v := range forceIgnoreMap { + for v := range forceIgnoreSet { forceIgnoredWithDependencies = append(forceIgnoredWithDependencies, v) } return install, excluded, forceIgnoredWithDependencies, nil