From a8352c2859a6f84b36fa5cd0af89231cb656b1ce Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 12 Feb 2024 14:48:48 +0100 Subject: Add public phased update API This moves the functions of the PhasedUpgrader class into various other classes so they can be publicly exposed. This introduces three new functions: pkgDepCache::PhasingApplied() tells you whether phasing should be applied to the package. pkgProblemResolver::KeepPhasedUpdates() keeps back updates that have phasing applied. pkgCache::VerIterator::IsSecurityUpdate() determines whether this version contains security fixes. --- apt-pkg/algorithms.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'apt-pkg/algorithms.cc') diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 3d4096a94..d841d6dd8 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -1245,6 +1245,26 @@ bool pkgProblemResolver::InstOrNewPolicyBroken(pkgCache::PkgIterator I) return false; } + /*}}}*/ +// ProblemResolver::KeepPhasedUpdates - Keep back phased updates /*{{{*/ +// --------------------------------------------------------------------- +// Hold back upgrades to phased versions of already installed packages, unless +// they are security updates +bool pkgProblemResolver::KeepPhasedUpdates() +{ + for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I) + { + if (not Cache.PhasingApplied(I)) + continue; + + Cache.MarkKeep(I, false, false); + Cache.MarkProtected(I); + Protect(I); + } + + return true; +} + /*}}}*/ // ProblemResolver::ResolveByKeep - Resolve problems using keep /*{{{*/ // --------------------------------------------------------------------- -- cgit v1.2.3-70-g09d2