From d7dc72dd8b23f3fbedb32f8cacd9ba920d78ccc3 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 2 Nov 2024 11:44:36 +0100 Subject: solver3: Check whether installable versions are allowed We only checked if they were still installable, but not if they were allowed. We should removed the allowed version handling altogether presumably - we should just mark non-allowed versions as rejected early on. --- apt-pkg/solver3.cc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'apt-pkg/solver3.cc') diff --git a/apt-pkg/solver3.cc b/apt-pkg/solver3.cc index c32a5db29..7f382646a 100644 --- a/apt-pkg/solver3.cc +++ b/apt-pkg/solver3.cc @@ -351,9 +351,17 @@ bool APT::Solver::Install(pkgCache::PkgIterator Pkg, Var reason, Group group) return false; bool anyInstallable = false; + // Insert the work item. + Work workItem{Var(Pkg), depth(), group}; for (auto ver = Pkg.VersionList(); not ver.end(); ver++) - if ((*this)[ver].decision != Decision::MUSTNOT) - anyInstallable = true; + { + if (IsAllowedVersion(ver)) + { + workItem.solutions.push_back(ver); + if ((*this)[ver].decision != Decision::MUSTNOT) + anyInstallable = true; + } + } if (not anyInstallable) { @@ -364,11 +372,6 @@ bool APT::Solver::Install(pkgCache::PkgIterator Pkg, Var reason, Group group) return false; } - // Insert the work item. - Work workItem{Var(Pkg), depth(), group}; - for (auto ver = Pkg.VersionList(); not ver.end(); ver++) - if (IsAllowedVersion(ver)) - workItem.solutions.push_back(ver); std::stable_sort(workItem.solutions.begin(), workItem.solutions.end(), CompareProviders3{cache, policy, Pkg, *this}); assert(workItem.solutions.size() > 0); -- cgit v1.2.3-70-g09d2