summaryrefslogtreecommitdiff
path: root/apt-pkg/solver3.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2025-02-11 19:08:44 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2025-02-14 19:08:45 +0100
commitffe2565c36421401550d11990a761d70ac81d208 (patch)
tree03efea3a08b570f4502614e225e6d72c3ecc3335 /apt-pkg/solver3.cc
parentb02cdd9b35a1a494c268f652ea1a46feec263e1e (diff)
solver3: Implement phasing as part of strict pinning rules
Phased updates are ignored when strict pinning is on; such that only the installed version will be available. By design of SAT solvers, this means that the version selection clause is unit, and hence the version can be directly propagated, i.e. that choice is safe.
Diffstat (limited to 'apt-pkg/solver3.cc')
-rw-r--r--apt-pkg/solver3.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/apt-pkg/solver3.cc b/apt-pkg/solver3.cc
index 38c3e8f4a..6b0cfe971 100644
--- a/apt-pkg/solver3.cc
+++ b/apt-pkg/solver3.cc
@@ -879,8 +879,10 @@ bool APT::Solver::FromDepCache(pkgDepCache &depcache)
{
for (auto P = cache.PkgBegin(); not P.end(); P++)
{
+ bool isForced = depcache[P].Protect() && depcache[P].Install();
+ bool isPhasing = IsUpgrade && depcache.PhasingApplied(P) && not isForced;
for (auto V = P.VersionList(); not V.end(); ++V)
- if (P.CurrentVer() != V && depcache.GetCandidateVersion(P) != V)
+ if (P.CurrentVer() != V && (depcache.GetCandidateVersion(P) != V || isPhasing))
if (not Enqueue(Var(V), false, {}))
return false;
}