summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2025-02-11 19:03:40 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2025-02-14 19:08:45 +0100
commitb02cdd9b35a1a494c268f652ea1a46feec263e1e (patch)
tree3841feb60be14c27aec1658da58ff8b6bc23d842
parent7d6e0e3d72c491fff0f0326c45a8b89404563314 (diff)
solver3: Promote various Recommends to Depends
Already satisfied Recommends should be promoted to Depends; as well as Recommends that are new, if the version they are from is an upgrade (such that upgrading does not introduce unsat Recommends). This only works for the case where the new Recommends actually exist; test-resolve-by-keep-new-recommends is not yet implemented, but this means the phasing tests will behave correctly.
-rw-r--r--apt-pkg/solver3.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/apt-pkg/solver3.cc b/apt-pkg/solver3.cc
index 0ece03b63..38c3e8f4a 100644
--- a/apt-pkg/solver3.cc
+++ b/apt-pkg/solver3.cc
@@ -599,6 +599,18 @@ APT::Solver::Clause APT::Solver::TranslateOrGroup(pkgCache::DepIterator start, p
std::cerr << "Promoting satisfied Suggests to Recommends: " << clause.toString(cache) << std::endl;
important = true;
}
+ else if (satisfied && important && wasImportant && clause.solutions.size() > 0)
+ {
+ if (unlikely(debug >= 3))
+ std::cerr << "Promoting existing Recommends " << clause.toString(cache) << " to depends in upgrade" << std::endl;
+ clause.optional = false;
+ }
+ else if (newOptional && important && reason.Ver() && clause.solutions.size() > 0 && reason.Ver(cache) != reason.CastPkg(cache).CurrentVer() && IsUpgrade)
+ {
+ if (unlikely(debug >= 3))
+ std::cerr << "Promoting new Recommends " << clause.toString(cache) << " to depends in upgrade" << std::endl;
+ clause.optional = false;
+ }
else if (not important)
{
if (unlikely(debug >= 3))