From b8918cb89ada945d92c720446177f1ef5185b5a5 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 5 Feb 2025 21:31:53 +0100 Subject: solver3: Reject reverse dependencies natively Instead of utilizing the reverse depends functionality of the cache and marking all possible reverse dependencies for removal, mark them ourselves by keeping track of reverse-implication-clauses. Notably, this improves the reverse dependency rejection substantially: The previous RejectReverseDependencies() function did not handle Provides. For this to work correctly right now, we need to discover optional clauses too when queuing them. This is somewhat suboptimal as we technically we don't care if they become unsat, we just waste time tracking them. The tests get a bit awkward, but oh well, we use what we can use. --- apt-pkg/solver3.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'apt-pkg/solver3.h') diff --git a/apt-pkg/solver3.h b/apt-pkg/solver3.h index da75179d5..91b852c98 100644 --- a/apt-pkg/solver3.h +++ b/apt-pkg/solver3.h @@ -248,14 +248,10 @@ class Solver // \brief Enqueue dependencies shared by all versions of the package. void RegisterCommonDependencies(pkgCache::PkgIterator Pkg); - // \brief Reject reverse dependencies. Must call std::make_heap() after. - [[nodiscard]] bool RejectReverseDependencies(pkgCache::VerIterator Ver); // \brief Translate an or group into a clause object [[nodiscard]] Clause TranslateOrGroup(pkgCache::DepIterator start, pkgCache::DepIterator end, Var reason); // \brief Propagate all pending propagations [[nodiscard]] bool Propagate(); - // \brief Propagate a rejection of a variable - [[nodiscard]] bool PropagateReject(Var var); // \brief Return the current depth (choices.size() with casting) depth_type depth() @@ -470,6 +466,8 @@ struct APT::Solver::State // \brief Clauses owned by this package/version std::vector> clauses; + // \brief Reverse clauses, that is dependencies (or conflicts) from other packages on this one + std::vector rclauses; }; /** -- cgit v1.2.3-70-g09d2