summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2025-02-04 09:52:59 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2025-02-07 20:59:43 +0100
commita41d4ba65bc0841a28ea9c8e9fd13f2c4e00ce86 (patch)
treecc87e6148c4fe579f31754afd057a03c56ce9c15
parentb33c6c36373f47b4c7490b0b6731233c1dc1ff05 (diff)
solver3: Simplify WhyStr()
Reuse the generic variable rendering
-rw-r--r--apt-pkg/solver3.cc21
1 files changed, 5 insertions, 16 deletions
diff --git a/apt-pkg/solver3.cc b/apt-pkg/solver3.cc
index b098d33ba..fce7da0d6 100644
--- a/apt-pkg/solver3.cc
+++ b/apt-pkg/solver3.cc
@@ -239,22 +239,11 @@ std::string APT::Solver::WhyStr(Var reason)
while (not reason.empty())
{
- if (auto Pkg = reason.Pkg(cache); not Pkg.end())
- {
- if ((*this)[Pkg].decision == Decision::MUSTNOT)
- out.push_back(std::string("not ") + Pkg.FullName());
- else
- out.push_back(Pkg.FullName());
- reason = (*this)[Pkg].reason;
- }
- if (auto Ver = reason.Ver(cache); not Ver.end())
- {
- if ((*this)[Ver].decision == Decision::MUSTNOT)
- out.push_back(std::string("not ") + Ver.ParentPkg().FullName() + "=" + Ver.VerStr());
- else
- out.push_back(Ver.ParentPkg().FullName() + "=" + Ver.VerStr());
- reason = (*this)[Ver].reason;
- }
+ if ((*this)[reason].decision == Decision::MUSTNOT)
+ out.push_back(std::string("not ") + reason.toString(cache));
+ else
+ out.push_back(reason.toString(cache));
+ reason = (*this)[reason].reason;
}
std::string outstr;