From 84573326f41dd09b914b8374548e7ee7c93d0439 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 28 Apr 2016 09:22:55 +0200 Subject: factor out Pkg/DepIterator prettyprinters into own header The old prettyprinters have only access to the struct they pretty print, which isn't enough usually as we want to know for a package also a bit of state information like which version is the candidate. We therefore need to pull the DepCache into context and hence use a temporary struct which is printed instead of the iterator itself. --- apt-pkg/depcache.cc | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'apt-pkg/depcache.cc') diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index aa434e99c..f38f956e4 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -791,7 +792,7 @@ bool pkgDepCache::MarkKeep(PkgIterator const &Pkg, bool Soft, bool FromUser, #endif if (DebugMarker == true) - std::clog << OutputInDepth(Depth) << "MarkKeep " << Pkg << " FU=" << FromUser << std::endl; + std::clog << OutputInDepth(Depth) << "MarkKeep " << APT::PrettyPkg(this, Pkg) << " FU=" << FromUser << std::endl; RemoveSizes(Pkg); RemoveStates(Pkg); @@ -871,7 +872,7 @@ bool pkgDepCache::MarkDelete(PkgIterator const &Pkg, bool rPurge, } if (DebugMarker == true) - std::clog << OutputInDepth(Depth) << (rPurge ? "MarkPurge " : "MarkDelete ") << Pkg << " FU=" << FromUser << std::endl; + std::clog << OutputInDepth(Depth) << (rPurge ? "MarkPurge " : "MarkDelete ") << APT::PrettyPkg(this, Pkg) << " FU=" << FromUser << std::endl; RemoveSizes(Pkg); RemoveStates(Pkg); @@ -907,7 +908,7 @@ bool pkgDepCache::IsDeleteOkProtectInstallRequests(PkgIterator const &Pkg, if (P.InstallVer != 0 && P.Status == 2 && (P.Flags & Flag::Auto) != Flag::Auto) { if (DebugMarker == true) - std::clog << OutputInDepth(Depth) << "Manual install request prevents MarkDelete of " << Pkg << std::endl; + std::clog << OutputInDepth(Depth) << "Manual install request prevents MarkDelete of " << APT::PrettyPkg(this, Pkg) << std::endl; return false; } } @@ -957,7 +958,7 @@ bool pkgDepCache::IsModeChangeOk(ModeList const mode, PkgIterator const &Pkg, { if (unlikely(DebugMarker == true)) std::clog << OutputInDepth(Depth) << "Ignore Mark" << PrintMode(mode) - << " of " << Pkg << " as its mode (" << PrintMode(P.Mode) + << " of " << APT::PrettyPkg(this, Pkg) << " as its mode (" << PrintMode(P.Mode) << ") is protected" << std::endl; return false; } @@ -967,7 +968,7 @@ bool pkgDepCache::IsModeChangeOk(ModeList const mode, PkgIterator const &Pkg, { if (unlikely(DebugMarker == true)) std::clog << OutputInDepth(Depth) << "Hold prevents Mark" << PrintMode(mode) - << " of " << Pkg << std::endl; + << " of " << APT::PrettyPkg(this, Pkg) << std::endl; return false; } @@ -1127,7 +1128,7 @@ bool pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, return true; if (DebugMarker == true) - std::clog << OutputInDepth(Depth) << "MarkInstall " << Pkg << " FU=" << FromUser << std::endl; + std::clog << OutputInDepth(Depth) << "MarkInstall " << APT::PrettyPkg(this, Pkg) << " FU=" << FromUser << std::endl; bool MoveAutoBitToDependencies = false; VerIterator const PV = P.InstVerIter(*this); @@ -1373,8 +1374,8 @@ bool pkgDepCache::IsInstallOkMultiArchSameVersionSynced(PkgIterator const &Pkg, PkgState[Pkg->ID].iFlags |= AutoKept; if (unlikely(DebugMarker == true)) - std::clog << OutputInDepth(Depth) << "Ignore MarkInstall of " << Pkg - << " as it is not in sync with its M-A:same sibling " << P + std::clog << OutputInDepth(Depth) << "Ignore MarkInstall of " << APT::PrettyPkg(this, Pkg) + << " as it is not in sync with its M-A:same sibling " << APT::PrettyPkg(this, P) << " (" << CandVer.VerStr() << " != " << CV.VerStr() << ")" << std::endl; return false; } @@ -1416,7 +1417,7 @@ bool pkgDepCache::IsInstallOkDependenciesSatisfiableByCandidates(PkgIterator con if (Ors == 1 && (DepState[Start->ID] &DepCVer) != DepCVer) { if (DebugAutoInstall == true) - std::clog << OutputInDepth(Depth) << Start << " can't be satisfied!" << std::endl; + std::clog << OutputInDepth(Depth) << APT::PrettyDep(this, Start) << " can't be satisfied!" << std::endl; // the dependency is critical, but can't be installed, so discard the candidate // as the problemresolver will trip over it otherwise trying to install it (#735967) -- cgit v1.2.3