From 7724d170751b3dc1717ba7a08881437cf7151996 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 19 May 2025 14:17:23 +0200 Subject: Introduce apt why, apt why-not These are implemented somewhat differently from aptitudes why and why-not commands: They produce the actual solver trace for why a particular decision has been taken. For the why-not case, we need to explicitly discover our specified package, as if nothing else depends on it in our graph, it would otherwise always be undiscovered and conflicts not detected (see e.g. level-3 in the test). --- apt-pkg/solver3.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'apt-pkg/solver3.h') diff --git a/apt-pkg/solver3.h b/apt-pkg/solver3.h index 6810df426..43f6ec3a7 100644 --- a/apt-pkg/solver3.h +++ b/apt-pkg/solver3.h @@ -316,6 +316,9 @@ class Solver * \param seen A set of seen objects such that the output does not repeat itself (not for safety, it is acyclic) */ std::string LongWhyStr(Var var, bool decision, const Clause *rclause, std::string prefix, std::unordered_set &seen) const; + + // \brief Temporary internal API with external linkage for the `apt why` and `apt why-not` commands. + APT_PUBLIC static std::string InternalCliWhy(pkgDepCache &depcache, pkgCache::PkgIterator Pkg, bool decision); }; }; // namespace APT -- cgit v1.2.3-70-g09d2