From ffe2565c36421401550d11990a761d70ac81d208 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 11 Feb 2025 19:08:44 +0100 Subject: 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. --- apt-pkg/solver3.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'apt-pkg/solver3.cc') 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; } -- cgit v1.2.3-70-g09d2