summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2024-06-06 11:17:09 +0200
committerJulian Andres Klode <julian.klode@canonical.com>2024-06-13 15:10:06 +0200
commit3b5379e547dfb655d764f7eb1ac7eaa5b2d34d6d (patch)
tree4f05e2e33e91dda9eb1a2127abba556eb0e132ca /apt-pkg
parent102017ecaa01a733a0860a62edae60cb0ab0220e (diff)
solver3: Remove no longer necessary comparisons
Comparing the size of work items is not strictly needed; we check if items have a single or no solution and propagate them early on, but it doesn't matter much if we solve A|B or C|D|E first. This will allow us to get rid of all the resizing business later on, and switch to using literal watching where we only watch one of the literals on the right hand side. Likewise, the upgrade case mattered initially in testing, but seems to have resolved itself.
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/solver3.cc22
1 files changed, 0 insertions, 22 deletions
diff --git a/apt-pkg/solver3.cc b/apt-pkg/solver3.cc
index 336a24a2d..e86353e43 100644
--- a/apt-pkg/solver3.cc
+++ b/apt-pkg/solver3.cc
@@ -174,33 +174,11 @@ bool APT::Solver::Work::operator<(APT::Solver::Work const &b) const
return not b.optional && b.size < 2;
if (group != b.group)
return group > b.group;
- if (optional && b.optional && reason.empty() && b.reason.empty() && upgrade != b.upgrade)
- {
- // Assuming we have libfoo-dev=5.1 Depends libfoo5.1-dev upgrade to libfoo-dev=5.3 Depends libfoo5.3-dev,
- // We schedule libfoo-dev=5.3|libfoo-dev=5.1, libfoo5.1-dev. The latter would be resolved first, resulting
- // in libfoo-dev being kept back.
- //
- // However, if we schedule not libfoo5.1-dev but bar Recommends libfoo5.1-dev, we should not be breaking that
- // Recommends, hence we need to ensure that if we order an upgrade before an optional package that this optional
- // package was a top level package, i.e. b.reason is empty (or our reason in the reverse case).
- //
- // So if we are the upgrade, and b also Depends on one of our versions, we need to satisfy b after we
- // have scheduled the upgrade.
- if (upgrade)
- return std::any_of(b.solutions.begin(), b.solutions.end(), [this](auto bsol) -> bool
- { return std::find(solutions.begin(), solutions.end(), bsol) != solutions.end(); });
- else
- return std::any_of(solutions.begin(), solutions.end(), [b](auto sol) -> bool
- { return std::find(b.solutions.begin(), b.solutions.end(), sol) != b.solutions.end(); });
- }
if (optional && b.optional && reason.empty() != b.reason.empty())
return reason.empty();
// An optional item is less important than a required one.
if (optional != b.optional)
return optional;
- // More solutions to explore are more expensive.
- if (size != b.size)
- return size > b.size;
// We enqueue common dependencies at the package level to avoid choosing versions, so let's solve package items first,
// this improves the implication graph as it now tells you that common dependencies were installed by the package.
if (reason.Pkg() != b.reason.Pkg())