summaryrefslogtreecommitdiff
path: root/apt-pkg/solver3.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2025-02-04 09:05:28 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2025-02-07 20:59:43 +0100
commitb33c6c36373f47b4c7490b0b6731233c1dc1ff05 (patch)
treef85b91bd290929e96126364ee86c74cc3a6eee7e /apt-pkg/solver3.cc
parent5b7af08e4b23f00fc1de4dfe4178d867a560553d (diff)
solver3: Cache all configuration calls
Diffstat (limited to 'apt-pkg/solver3.cc')
-rw-r--r--apt-pkg/solver3.cc13
1 files changed, 4 insertions, 9 deletions
diff --git a/apt-pkg/solver3.cc b/apt-pkg/solver3.cc
index cab2d4371..b098d33ba 100644
--- a/apt-pkg/solver3.cc
+++ b/apt-pkg/solver3.cc
@@ -43,7 +43,6 @@ struct APT::Solver::CompareProviders3 /*{{{*/
pkgDepCache::Policy &Policy;
pkgCache::PkgIterator const Pkg;
APT::Solver &Solver;
- bool upgrade{_config->FindB("APT::Solver::Upgrade", false)};
bool operator()(pkgCache::Version *AV, pkgCache::Version *BV)
{
@@ -69,7 +68,7 @@ struct APT::Solver::CompareProviders3 /*{{{*/
return false;
// Candidate wins in upgrade scenario
- if (upgrade)
+ if (Solver.IsUpgrade)
{
auto Cand = Solver.GetCandidateVer(A);
if (AV == Cand || BV == Cand)
@@ -90,7 +89,7 @@ struct APT::Solver::CompareProviders3 /*{{{*/
// Try obsolete choices only after exhausting non-obsolete choices such that we install
// packages replacing them and don't keep back upgrades depending on the replacement to
// keep the obsolete package installed.
- if (upgrade)
+ if (Solver.IsUpgrade)
if (auto obsoleteA = Solver.Obsolete(A), obsoleteB = Solver.Obsolete(B); obsoleteA != obsoleteB)
return obsoleteB;
// Prefer MA:same packages if other architectures for it are installed
@@ -476,8 +475,6 @@ bool APT::Solver::PropagateReject(Var var)
bool APT::Solver::EnqueueCommonDependencies(pkgCache::PkgIterator Pkg)
{
- if (not _config->FindB("APT::Solver::Enqueue-Common-Dependencies", true))
- return false;
for (auto dep = Pkg.VersionList().DependsList(); not dep.end();)
{
pkgCache::DepIterator start;
@@ -506,7 +503,6 @@ bool APT::Solver::EnqueueOrGroup(pkgCache::DepIterator start, pkgCache::DepItera
{
auto TgtPkg = start.TargetPkg();
auto Ver = start.ParentVer();
- auto fixPolicy = _config->FindB("APT::Get::Fix-Policy-Broken");
// Non-important dependencies can only be installed if they are currently satisfied, see the check further
// below once we have calculated all possible solutions.
@@ -549,7 +545,7 @@ bool APT::Solver::EnqueueOrGroup(pkgCache::DepIterator start, pkgCache::DepItera
// If we are fixing the policy, we need to sort each alternative in an or group separately
// FIXME: This is not really true, though, we should fix the CompareProviders to ignore the
// installed state
- if (fixPolicy)
+ if (FixPolicyBroken)
std::stable_sort(workItem.solutions.begin() + begin, workItem.solutions.end(), CompareProviders3{cache, policy, TgtPkg, *this});
if (start == end)
@@ -557,7 +553,7 @@ bool APT::Solver::EnqueueOrGroup(pkgCache::DepIterator start, pkgCache::DepItera
++start;
} while (1);
- if (not fixPolicy)
+ if (not FixPolicyBroken)
std::stable_sort(workItem.solutions.begin(), workItem.solutions.end(), CompareProviders3{cache, policy, TgtPkg, *this});
if (std::all_of(workItem.solutions.begin(), workItem.solutions.end(), [this](auto var) -> auto
@@ -942,7 +938,6 @@ bool APT::Solver::Solve()
// \brief Apply the selections from the dep cache to the solver
bool APT::Solver::FromDepCache(pkgDepCache &depcache)
{
- bool AllowRemoveManual = AllowRemove && _config->FindB("APT::Solver::RemoveManual", false);
DefaultRootSetFunc2 rootSet(&cache);
// Enforce strict pinning rules by rejecting all forbidden versions.