summaryrefslogtreecommitdiff
path: root/apt-private/private-show.cc
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2014-03-14 09:02:44 +0100
committerMichael Vogt <mvo@debian.org>2014-03-14 09:02:44 +0100
commit83b880c6505a20247239d897b7387bba37942993 (patch)
tree11a23275548175e301f6fefda20a6a8bb6fe6de8 /apt-private/private-show.cc
parentf98d9bd2adf4f24a72d973f5752b47987843984c (diff)
parent40f8a8ba8c2e7ff9ce80781250c863c07ac130dd (diff)
fix test/integration/test-apt-helper
Diffstat (limited to 'apt-private/private-show.cc')
-rw-r--r--apt-private/private-show.cc72
1 files changed, 38 insertions, 34 deletions
diff --git a/apt-private/private-show.cc b/apt-private/private-show.cc
index 60d951316..8ae6a6dac 100644
--- a/apt-private/private-show.cc
+++ b/apt-private/private-show.cc
@@ -1,29 +1,32 @@
// Includes /*{{{*/
-#include <apt-pkg/error.h>
+#include <config.h>
+
#include <apt-pkg/cachefile.h>
-#include <apt-pkg/cachefilter.h>
#include <apt-pkg/cacheset.h>
-#include <apt-pkg/init.h>
-#include <apt-pkg/progress.h>
-#include <apt-pkg/sourcelist.h>
#include <apt-pkg/cmndline.h>
-#include <apt-pkg/strutl.h>
+#include <apt-pkg/error.h>
#include <apt-pkg/fileutl.h>
+#include <apt-pkg/indexfile.h>
#include <apt-pkg/pkgrecords.h>
-#include <apt-pkg/srcrecords.h>
-#include <apt-pkg/version.h>
-#include <apt-pkg/policy.h>
-#include <apt-pkg/tagfile.h>
-#include <apt-pkg/algorithms.h>
-#include <apt-pkg/sptr.h>
#include <apt-pkg/pkgsystem.h>
-#include <apt-pkg/indexfile.h>
-#include <apt-pkg/metaindex.h>
+#include <apt-pkg/sourcelist.h>
+#include <apt-pkg/strutl.h>
+#include <apt-pkg/tagfile.h>
+#include <apt-pkg/cacheiterators.h>
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/depcache.h>
+#include <apt-pkg/macros.h>
+#include <apt-pkg/pkgcache.h>
-#include <apti18n.h>
+#include <apt-private/private-cacheset.h>
+#include <apt-private/private-output.h>
+#include <apt-private/private-show.h>
+
+#include <stdio.h>
+#include <ostream>
+#include <string>
-#include "private-output.h"
-#include "private-cacheset.h"
+#include <apti18n.h>
/*}}}*/
namespace APT {
@@ -31,8 +34,8 @@ namespace APT {
// DisplayRecord - Displays the complete record for the package /*{{{*/
// ---------------------------------------------------------------------
-bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V,
- ostream &out)
+static bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V,
+ std::ostream &out)
{
pkgCache *Cache = CacheFile.GetPkgCache();
if (unlikely(Cache == NULL))
@@ -96,23 +99,23 @@ bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V,
// FIXME: add verbose that does not do the removal of the tags?
TFRewriteData RW[] = {
// delete, apt-cache show has this info and most users do not care
- {"MD5sum", 0},
- {"SHA1", 0},
- {"SHA256", 0},
- {"Filename", 0},
- {"Multi-Arch", 0},
- {"Architecture", 0},
- {"Conffiles",0},
+ {"MD5sum", NULL, NULL},
+ {"SHA1", NULL, NULL},
+ {"SHA256", NULL, NULL},
+ {"Filename", NULL, NULL},
+ {"Multi-Arch", NULL, NULL},
+ {"Architecture", NULL, NULL},
+ {"Conffiles", NULL, NULL},
// we use the translated description
- {"Description",0},
- {"Description-md5",0},
+ {"Description", NULL, NULL},
+ {"Description-md5", NULL, NULL},
// improve
- {"Installed-Size", installed_size.c_str(), 0},
+ {"Installed-Size", installed_size.c_str(), NULL},
{"Size", package_size.c_str(), "Download-Size"},
// add
- {"APT-Manual-Installed", manual_installed, 0},
- {"APT-Sources", source_index_file.c_str(), 0},
- {}
+ {"APT-Manual-Installed", manual_installed, NULL},
+ {"APT-Sources", source_index_file.c_str(), NULL},
+ {NULL, NULL, NULL}
};
if(TFRewrite(stdout, Tags, NULL, RW) == false)
@@ -148,8 +151,9 @@ bool ShowPackage(CommandLine &CmdL) /*{{{*/
if (select == APT::VersionList::CANDIDATE)
{
APT::VersionList const verset_all = APT::VersionList::FromCommandLine(CacheFile, CmdL.FileList + 1, APT::VersionList::ALL, helper);
- if (verset_all.size() > verset.size())
- _error->Notice(ngettext("There is %lu additional record. Please use the '-a' switch to see it", "There are %lu additional records. Please use the '-a' switch to see them.", verset_all.size() - verset.size()), verset_all.size() - verset.size());
+ int const records = verset_all.size() - verset.size();
+ if (records > 0)
+ _error->Notice(P_("There is %i additional record. Please use the '-a' switch to see it", "There are %i additional records. Please use the '-a' switch to see them.", records), records);
}
for (APT::PackageSet::const_iterator Pkg = helper.virtualPkgs.begin();