summaryrefslogtreecommitdiff
path: root/apt-private/private-cacheset.cc
diff options
context:
space:
mode:
authorMichael Vogt <mvo@ubuntu.com>2014-09-10 08:13:18 +0200
committerMichael Vogt <mvo@ubuntu.com>2014-09-10 08:13:18 +0200
commit2fa9c1eee57775309f79b63baa5d165b7b443969 (patch)
tree21907ec26aba35dff2185aa463f38e9ec0686c78 /apt-private/private-cacheset.cc
parent9bac4dce7c1454b4919800a47ffc5860fd3c7e1b (diff)
parent7d8a4da74eb7f794e4da1216b39d7e2a1259d18f (diff)
Merge branch 'debian/sid' into ubuntu/master
Conflicts: configure.ac debian/changelog doc/apt-verbatim.ent doc/po/apt-doc.pot doc/po/de.po doc/po/es.po doc/po/fr.po doc/po/it.po doc/po/ja.po doc/po/pl.po doc/po/pt.po doc/po/pt_BR.po po/apt-all.pot po/ar.po po/ast.po po/bg.po po/bs.po po/ca.po po/cs.po po/cy.po po/da.po po/de.po po/dz.po po/el.po po/es.po po/eu.po po/fi.po po/fr.po po/gl.po po/hu.po po/it.po po/ja.po po/km.po po/ko.po po/ku.po po/lt.po po/mr.po po/nb.po po/ne.po po/nl.po po/nn.po po/pl.po po/pt.po po/pt_BR.po po/ro.po po/ru.po po/sk.po po/sl.po po/sv.po po/th.po po/tl.po po/tr.po po/uk.po po/vi.po po/zh_CN.po po/zh_TW.po
Diffstat (limited to 'apt-private/private-cacheset.cc')
-rw-r--r--apt-private/private-cacheset.cc89
1 files changed, 46 insertions, 43 deletions
diff --git a/apt-private/private-cacheset.cc b/apt-private/private-cacheset.cc
index e37e7b227..eb77be274 100644
--- a/apt-private/private-cacheset.cc
+++ b/apt-private/private-cacheset.cc
@@ -14,74 +14,77 @@
#include <apti18n.h>
-bool GetLocalitySortedVersionSet(pkgCacheFile &CacheFile,
- LocalitySortedVersionSet &output_set,
- OpProgress &progress)
+bool GetLocalitySortedVersionSet(pkgCacheFile &CacheFile,
+ APT::VersionContainerInterface * const vci,
+ OpProgress * const progress)
{
Matcher null_matcher = Matcher();
- return GetLocalitySortedVersionSet(CacheFile, output_set,
+ return GetLocalitySortedVersionSet(CacheFile, vci,
null_matcher, progress);
}
-bool GetLocalitySortedVersionSet(pkgCacheFile &CacheFile,
- LocalitySortedVersionSet &output_set,
+bool GetLocalitySortedVersionSet(pkgCacheFile &CacheFile,
+ APT::VersionContainerInterface * const vci,
Matcher &matcher,
- OpProgress &progress)
+ OpProgress * const progress)
{
pkgCache *Cache = CacheFile.GetPkgCache();
pkgDepCache *DepCache = CacheFile.GetDepCache();
+ APT::CacheSetHelper helper(false);
int Done=0;
- progress.SubProgress(Cache->Head().PackageCount, _("Sorting"));
+ if (progress != NULL)
+ progress->SubProgress(Cache->Head().PackageCount, _("Sorting"));
+
+ bool const insertCurrentVer = _config->FindB("APT::Cmd::Installed", false);
+ bool const insertUpgradable = _config->FindB("APT::Cmd::Upgradable", false);
+ bool const insertManualInstalled = _config->FindB("APT::Cmd::Manual-Installed", false);
+
for (pkgCache::PkgIterator P = Cache->PkgBegin(); P.end() == false; ++P)
{
- if (Done%500 == 0)
- progress.Progress(Done);
- Done++;
+ if (progress != NULL)
+ {
+ if (Done % 500 == 0)
+ progress->Progress(Done);
+ ++Done;
+ }
+
+ // exclude virtual pkgs
+ if (P->VersionList == 0)
+ continue;
if ((matcher)(P) == false)
- continue;
+ continue;
- // exclude virtual pkgs
- if (P.VersionList() == 0)
- continue;
pkgDepCache::StateCache &state = (*DepCache)[P];
- if (_config->FindB("APT::Cmd::Installed") == true)
+ if (insertCurrentVer == true)
{
- if (P.CurrentVer() != NULL)
- {
- output_set.insert(P.CurrentVer());
- }
+ if (P->CurrentVer != 0)
+ vci->FromPackage(vci, CacheFile, P, APT::VersionContainerInterface::INSTALLED, helper);
}
- else if (_config->FindB("APT::Cmd::Upgradable") == true)
+ else if (insertUpgradable == true)
{
- if(P.CurrentVer() && state.Upgradable())
- {
- pkgPolicy *policy = CacheFile.GetPolicy();
- output_set.insert(policy->GetCandidateVer(P));
- }
+ if(P.CurrentVer() && state.Upgradable())
+ vci->FromPackage(vci, CacheFile, P, APT::VersionContainerInterface::CANDIDATE, helper);
}
- else if (_config->FindB("APT::Cmd::Manual-Installed") == true)
+ else if (insertManualInstalled == true)
{
- if (P.CurrentVer() &&
- ((*DepCache)[P].Flags & pkgCache::Flag::Auto) == false)
- {
- pkgPolicy *policy = CacheFile.GetPolicy();
- output_set.insert(policy->GetCandidateVer(P));
- }
+ if (P.CurrentVer() &&
+ ((*DepCache)[P].Flags & pkgCache::Flag::Auto) == false)
+ vci->FromPackage(vci, CacheFile, P, APT::VersionContainerInterface::CANDIDATE, helper);
}
- else
+ else
{
- pkgPolicy *policy = CacheFile.GetPolicy();
- if (policy->GetCandidateVer(P).IsGood())
- output_set.insert(policy->GetCandidateVer(P));
- else
- // no candidate, this may happen for packages in
- // dpkg "deinstall ok config-file" state - we pick the first ver
- // (which should be the only one)
- output_set.insert(P.VersionList());
+ if (vci->FromPackage(vci, CacheFile, P, APT::VersionContainerInterface::CANDIDATE, helper) == false)
+ {
+ // no candidate, this may happen for packages in
+ // dpkg "deinstall ok config-file" state - we pick the first ver
+ // (which should be the only one)
+ vci->insert(P.VersionList());
+ }
}
}
- progress.Done();
+ if (progress != NULL)
+ progress->Done();
return true;
}