diff options
author | Michael Vogt <mvo@debian.org> | 2014-01-24 21:03:49 +0100 |
---|---|---|
committer | Michael Vogt <mvo@debian.org> | 2014-01-24 21:03:49 +0100 |
commit | 85d7c0eb60efd0de13ad331676b6227f52bed6c6 (patch) | |
tree | 0f413ad85545186b5390775ca5f13a155c76e93a /apt-private/private-show.cc | |
parent | 0c8b6001694bb0ddf9eb6bc4936151592e1a07fa (diff) |
Show "Manual-Installed: {yes|no}" in apt show
Diffstat (limited to 'apt-private/private-show.cc')
-rw-r--r-- | apt-private/private-show.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/apt-private/private-show.cc b/apt-private/private-show.cc index 244347421..cee132843 100644 --- a/apt-private/private-show.cc +++ b/apt-private/private-show.cc @@ -37,6 +37,9 @@ bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V, pkgCache *Cache = CacheFile.GetPkgCache(); if (unlikely(Cache == NULL)) return false; + pkgDepCache *depCache = CacheFile.GetDepCache(); + if (unlikely(depCache == NULL)) + return false; // Find an appropriate file pkgCache::VerFileIterator Vf = V.FileList(); @@ -73,6 +76,13 @@ bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V, else package_size = _("unknown"); + pkgDepCache::StateCache &state = (*depCache)[V.ParentPkg()]; + bool is_installed = V.ParentPkg().CurrentVer() == V; + const char *manual_installed; + if (is_installed) + manual_installed = !(state.Flags & pkgCache::Flag::Auto) ? "yes" : "no"; + else + manual_installed = 0; std::string suite = GetArchiveSuite(CacheFile, V); TFRewriteData RW[] = { {"Conffiles",0}, @@ -81,8 +91,10 @@ bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V, {"Installed-Size", installed_size.c_str(), 0}, {"Size", package_size.c_str(), "Download-Size"}, {"Archive-Origin", suite.c_str(), 0}, + {"Manual-Installed", manual_installed, 0}, {} }; + if(TFRewrite(stdout, Tags, NULL, RW) == false) return _error->Error("Internal Error, Unable to parse a package record"); |