diff options
| author | Julian Andres Klode <jak@debian.org> | 2025-06-10 16:09:19 +0200 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2025-06-10 16:27:36 +0200 |
| commit | b99ec5f1d80962e39e9debb05f1a7c7840e7d97c (patch) | |
| tree | 9e308b4938dd804cd91d435b1662099714892915 /apt-pkg | |
| parent | 060f4e274f08ea338158606fc81b451924a293d0 (diff) | |
solver3: Filter installed Recommends
When inspecting Recommends of installed packages, filter
them to the installed packages only, as we want to avoid
switching between alternatives of recommended packages.
Diffstat (limited to 'apt-pkg')
| -rw-r--r-- | apt-pkg/solver3.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/apt-pkg/solver3.cc b/apt-pkg/solver3.cc index 052142658..c2877946c 100644 --- a/apt-pkg/solver3.cc +++ b/apt-pkg/solver3.cc @@ -964,6 +964,16 @@ APT::Solver::Clause APT::Solver::TranslateOrGroup(pkgCache::DepIterator start, p std::cerr << "Promoting new clause to hard dependency: " << clause.toString(cache) << std::endl; clause.optional = false; } + else if (not existing.end() && importantToKeep(start) && satisfied) + { + if (unlikely(debug >= 3)) + std::cerr << "Restricting existing Recommends to installed packages: " << clause.toString(cache, true) << std::endl; + // Erase the non-installed solutions. We will process this last and try to keep the previously installed + // "best" solution installed. + clause.solutions.erase(std::remove_if(clause.solutions.begin(), clause.solutions.end(), [this](auto var) + { return var.CastPkg(cache)->CurrentVer == nullptr; }), + clause.solutions.end()); + } } return clause; |
