Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions pkg/sat/sat.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down
Loading