summaryrefslogtreecommitdiff
path: root/apt-pkg/prettyprinters.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-04-28 15:03:55 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2016-05-01 10:50:24 +0200
commitd622baeea4828b4bf62d939b7a4a7cd4051f78a5 (patch)
tree65902a4caa3e3e75eafdbc600175b35588f70ae8 /apt-pkg/prettyprinters.cc
parent0264502c2ed8da69358959d6dc7beb67f422b5cf (diff)
show StateCache flags in Pkg debug prettyprint
This basically introduces ~33 flags in the output, but a package can have only ~11 of them displayed at the same time. There is quiet a bit of duplication also (an uninstalled package is by definition a newinstall if its getting installed), but as this is debug output we are better of showing them all in case one of them isn't set in a way it is supposed to be set. Git-Dch: Ignore
Diffstat (limited to 'apt-pkg/prettyprinters.cc')
-rw-r--r--apt-pkg/prettyprinters.cc93
1 files changed, 80 insertions, 13 deletions
diff --git a/apt-pkg/prettyprinters.cc b/apt-pkg/prettyprinters.cc
index a736cabf4..87e78bbde 100644
--- a/apt-pkg/prettyprinters.cc
+++ b/apt-pkg/prettyprinters.cc
@@ -21,19 +21,86 @@ std::ostream& operator<<(std::ostream& os, const APT::PrettyPkg& pp) /*{{{*/
if (pp.Pkg.end() == true)
return os << "invalid package";
- std::string current = (pp.Pkg.CurVersion() == 0 ? "none" : pp.Pkg.CurVersion());
- std::string candidate = (*pp.DepCache)[pp.Pkg].CandVersion;
- std::string newest = (pp.Pkg.VersionList().end() ? "none" : pp.Pkg.VersionList().VerStr());
-
- os << pp.Pkg.Name() << " [ " << pp.Pkg.Arch() << " ] < " << current;
- if (current != candidate)
- os << " -> " << candidate;
- if ( newest != "none" && candidate != newest)
- os << " | " << newest;
- if (pp.Pkg->VersionList == 0)
- os << " > ( none )";
- else
- os << " > ( " << (pp.Pkg.VersionList().Section()==0?"unknown":pp.Pkg.VersionList().Section()) << " )";
+ auto state = (*pp.DepCache)[pp.Pkg];
+ std::string const current = (pp.Pkg.CurVersion() == 0 ? "none" : pp.Pkg.CurVersion());
+ std::string candidate = state.CandVersion;
+ if (candidate.empty())
+ candidate = "none";
+ std::string install = "none";
+ if (state.InstallVer != nullptr)
+ install = state.InstVerIter(*pp.DepCache).VerStr();
+
+ os << pp.Pkg.FullName(false) << " < " << current;
+ if (current != install && install != "none")
+ os << " -> " << install;
+ if (install != candidate && current != candidate)
+ os << " | " << candidate;
+ os << " @";
+ switch (pp.Pkg->SelectedState)
+ {
+ case pkgCache::State::Unknown: os << 'u'; break;
+ case pkgCache::State::Install: os << 'i'; break;
+ case pkgCache::State::Hold: os << 'h'; break;
+ case pkgCache::State::DeInstall: os << 'r'; break;
+ case pkgCache::State::Purge: os << 'p'; break;
+ default: os << 'X';
+ }
+ switch (pp.Pkg->InstState)
+ {
+ case pkgCache::State::Ok: break;
+ case pkgCache::State::ReInstReq: os << 'R'; break;
+ case pkgCache::State::HoldInst: os << 'H'; break;
+ case pkgCache::State::HoldReInstReq: os << "HR"; break;
+ default: os << 'X';
+ }
+ switch (pp.Pkg->CurrentState)
+ {
+ case pkgCache::State::NotInstalled: os << 'n'; break;
+ case pkgCache::State::ConfigFiles: os << 'c'; break;
+ case pkgCache::State::HalfInstalled: os << 'H'; break;
+ case pkgCache::State::UnPacked: os << 'U'; break;
+ case pkgCache::State::HalfConfigured: os << 'F'; break;
+ case pkgCache::State::TriggersAwaited: os << 'W'; break;
+ case pkgCache::State::TriggersPending: os << 'T'; break;
+ case pkgCache::State::Installed: os << 'i'; break;
+ default: os << 'X';
+ }
+ os << ' ';
+ if (state.Protect())
+ os << "p";
+ if (state.ReInstall())
+ os << "r";
+ if (state.Upgradable())
+ os << "u";
+ if (state.Marked)
+ os << "m";
+ if (state.Garbage)
+ os << "g";
+ if (state.NewInstall())
+ os << "N";
+ else if (state.Upgrade())
+ os << "U";
+ else if (state.Downgrade())
+ os << "D";
+ else if (state.Install())
+ os << "I";
+ else if (state.Purge())
+ os << "P";
+ else if (state.Delete())
+ os << "R";
+ else if (state.Held())
+ os << "H";
+ else if (state.Keep())
+ os << "K";
+ if (state.NowBroken())
+ os << " Nb";
+ else if (state.NowPolicyBroken())
+ os << " NPb";
+ if (state.InstBroken())
+ os << " Ib";
+ else if (state.InstPolicyBroken())
+ os << " IPb";
+ os << " >";
return os;
}
/*}}}*/