summaryrefslogtreecommitdiff
path: root/apt-pkg/solver3.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2024-11-02 11:44:36 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2024-11-02 11:44:36 +0100
commitd7dc72dd8b23f3fbedb32f8cacd9ba920d78ccc3 (patch)
tree4b43dd3e5888ecb05247cf52b842668fd7d8f68b /apt-pkg/solver3.cc
parent6c98593d3e8c99c2c0dfaf18e571e567fc6b5837 (diff)
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.
Diffstat (limited to 'apt-pkg/solver3.cc')
-rw-r--r--apt-pkg/solver3.cc17
1 files changed, 10 insertions, 7 deletions
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);