summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/solver3.cc21
-rw-r--r--apt-pkg/solver3.h2
2 files changed, 17 insertions, 6 deletions
diff --git a/apt-pkg/solver3.cc b/apt-pkg/solver3.cc
index 5469a1881..d9ed1a7bb 100644
--- a/apt-pkg/solver3.cc
+++ b/apt-pkg/solver3.cc
@@ -231,13 +231,24 @@ bool APT::Solver::Work::operator<(APT::Solver::Work const &b) const
return false;
}
-std::string APT::Solver::Clause::toString(pkgCache &cache) const
+std::string APT::Solver::Clause::toString(pkgCache &cache, bool pretty) const
{
std::string out;
- if (auto Pkg = reason.Pkg(cache); not Pkg.end())
- out.append(Pkg.FullName());
- if (auto Ver = reason.Ver(cache); not Ver.end())
- out.append(Ver.ParentPkg().FullName()).append("=").append(Ver.VerStr());
+ out.append(reason.toString(cache));
+ if (dep && pretty)
+ {
+ out.append(" ").append(pkgCache::DepIterator(cache, dep).DepType()).append(" ");
+ for (auto dep = pkgCache::DepIterator(cache, this->dep); not dep.end(); ++dep)
+ {
+ out.append(dep.TargetPkg().FullName(true));
+ if (dep.TargetVer())
+ out.append(" (").append(dep.CompType()).append(" ").append(dep.TargetVer()).append(")");
+ if (!(dep->CompareOp & pkgCache::Dep::Or))
+ break;
+ out.append(" | ");
+ }
+ return out;
+ }
out.append(" -> ");
for (auto var : solutions)
out.append(" | ").append(var.toString(cache));
diff --git a/apt-pkg/solver3.h b/apt-pkg/solver3.h
index 73ed26030..519f48b13 100644
--- a/apt-pkg/solver3.h
+++ b/apt-pkg/solver3.h
@@ -377,7 +377,7 @@ struct APT::Solver::Clause
inline Clause(Var reason, Group group, bool optional = false, bool negative = false) : reason(reason), group(group), optional(optional), negative(negative) {}
- std::string toString(pkgCache &cache) const;
+ std::string toString(pkgCache &cache, bool pretty = false) const;
};
/**