summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-private/private-show.cc12
-rwxr-xr-xtest/integration/test-apt-cli-show5
2 files changed, 16 insertions, 1 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");
diff --git a/test/integration/test-apt-cli-show b/test/integration/test-apt-cli-show
index ba56e3260..11a93f268 100755
--- a/test/integration/test-apt-cli-show
+++ b/test/integration/test-apt-cli-show
@@ -10,12 +10,14 @@ configarchitecture "i386"
DESCR='Some description
That has multiple lines'
insertpackage 'unstable' 'foo' 'all' '1.0' '' '' "$DESCR"
+insertinstalledpackage 'foo' 'all' '1.0'
setupaptarchive
APTARCHIVE=$(readlink -f ./aptarchive)
# note that we do not display Description-md5 with the "apt" cmd
+# and also show some additional fields that are calculated
testequal "Package: foo
Priority: optional
Section: other
@@ -25,7 +27,8 @@ Architecture: all
Version: 1.0
Filename: pool/main/foo/foo_1.0_all.deb
Download-Size: unknown
-Archive-Origin: unstable
+Archive-Origin: unstable,now
+Manual-Installed: yes
Description: Some description
That has multiple lines
" apt show foo