diff options
author | Michael Vogt <mvo@ubuntu.com> | 2014-04-01 12:28:56 +0200 |
---|---|---|
committer | Michael Vogt <mvo@ubuntu.com> | 2014-04-01 12:28:56 +0200 |
commit | be20eef52da4b7f361333ea70a8d705a98ae779e (patch) | |
tree | 4177a110ce6b1335fc4b85d5e53b298a65661f39 /apt-private/private-list.cc | |
parent | a555cf8be53d8b5557f004ecbde8482a169b79f3 (diff) | |
parent | 21b3eac8f9ab8e12b43fa8998a5aa5465f29adc5 (diff) |
Merge remote-tracking branch 'upstream/debian/sid' into feature/apt-manpage
Conflicts:
cmdline/apt.cc
Diffstat (limited to 'apt-private/private-list.cc')
-rw-r--r-- | apt-private/private-list.cc | 69 |
1 files changed, 29 insertions, 40 deletions
diff --git a/apt-private/private-list.cc b/apt-private/private-list.cc index a02ebf02d..7664ca134 100644 --- a/apt-private/private-list.cc +++ b/apt-private/private-list.cc @@ -1,43 +1,28 @@ // Include Files /*{{{*/ #include <config.h> -#include <apt-pkg/error.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/fileutl.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/progress.h> +#include <apt-pkg/strutl.h> +#include <apt-pkg/configuration.h> +#include <apt-pkg/macros.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> + +#include <apt-private/private-cacheset.h> +#include <apt-private/private-list.h> +#include <apt-private/private-output.h> +#include <iostream> #include <sstream> -#include <vector> +#include <map> +#include <string> #include <utility> -#include <cassert> -#include <locale.h> -#include <iostream> -#include <unistd.h> -#include <errno.h> -#include <regex.h> -#include <stdio.h> -#include <algorithm> - -#include "private-cmndline.h" -#include "private-list.h" -#include "private-output.h" -#include "private-cacheset.h" +#include <vector> #include <apti18n.h> /*}}}*/ @@ -61,7 +46,7 @@ class PackageNameMatcher : public Matcher /*{{{*/ public: PackageNameMatcher(const char **patterns) { - for(int i=0; patterns[i] != NULL; i++) + for(int i=0; patterns[i] != NULL; ++i) { std::string pattern = patterns[i]; #ifdef PACKAGE_MATCHER_ABI_COMPAT @@ -79,12 +64,12 @@ class PackageNameMatcher : public Matcher /*{{{*/ } virtual ~PackageNameMatcher() { - for(J=filters.begin(); J != filters.end(); J++) + for(J=filters.begin(); J != filters.end(); ++J) delete *J; } virtual bool operator () (const pkgCache::PkgIterator &P) { - for(J=filters.begin(); J != filters.end(); J++) + for(J=filters.begin(); J != filters.end(); ++J) { APT::CacheFilter::PackageMatcher *cachefilter = *J; if((*cachefilter)(P)) @@ -99,13 +84,17 @@ private: #undef PackageMatcher }; /*}}}*/ -void ListAllVersions(pkgCacheFile &CacheFile, pkgRecords &records, /*{{{*/ +static void ListAllVersions(pkgCacheFile &CacheFile, pkgRecords &records,/*{{{*/ pkgCache::PkgIterator P, - std::ostream &outs) + std::ostream &outs, + bool include_summary=true) { for (pkgCache::VerIterator Ver = P.VersionList(); - Ver.end() == false; Ver++) - ListSingleVersion(CacheFile, records, Ver, outs); + Ver.end() == false; ++Ver) + { + ListSingleVersion(CacheFile, records, Ver, outs, include_summary); + outs << "\n"; + } } /*}}}*/ // list - list package based on criteria /*{{{*/ @@ -136,18 +125,18 @@ bool List(CommandLine &Cmd) PackageNameMatcher matcher(patterns); LocalitySortedVersionSet bag; - OpTextProgress progress; + OpTextProgress progress(*_config); progress.OverallProgress(0, Cache->Head().PackageCount, Cache->Head().PackageCount, _("Listing")); GetLocalitySortedVersionSet(CacheFile, bag, matcher, progress); - for (LocalitySortedVersionSet::iterator V = bag.begin(); V != bag.end(); V++) + for (LocalitySortedVersionSet::iterator V = bag.begin(); V != bag.end(); ++V) { std::stringstream outs; if(_config->FindB("APT::Cmd::All-Versions", false) == true) { - ListAllVersions(CacheFile, records, V.ParentPkg(), outs); + ListAllVersions(CacheFile, records, V.ParentPkg(), outs, includeSummary); output_map.insert(std::make_pair<std::string, std::string>( V.ParentPkg().Name(), outs.str())); } else { @@ -159,7 +148,7 @@ bool List(CommandLine &Cmd) // FIXME: SORT! and make sorting flexible (alphabetic, by pkg status) // output the sorted map - for (K = output_map.begin(); K != output_map.end(); K++) + for (K = output_map.begin(); K != output_map.end(); ++K) std::cout << (*K).second << std::endl; |