summaryrefslogtreecommitdiff
path: root/apt-pkg/cacheset.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2015-08-27 13:10:02 +0200
committerJulian Andres Klode <jak@debian.org>2015-08-27 13:13:13 +0200
commitb6192267c23ffda1b9c8328537a5f2c83e176c26 (patch)
treea1534cd8e6a05183451d38df523639852d5a9ff7 /apt-pkg/cacheset.cc
parent1476c59e4b93239176a2d4874ec950b489c924b2 (diff)
cacheset: Prefer the depcache over the policy again
By preferring the policy over the depcache, we ignore any changes we made in the depcache, which makes it impossible for code to change the candidate used here. This basically reverts commit 2fbfb111312257fa5fc29b0c2ed386fb712f960e: prefer the Policy if it is built instead of the DepCache and if DepCache is not available as fallback built the Policy But it also cleans the code up a bit, by removing one level of nesting.
Diffstat (limited to 'apt-pkg/cacheset.cc')
-rw-r--r--apt-pkg/cacheset.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/apt-pkg/cacheset.cc b/apt-pkg/cacheset.cc
index af607a197..6a625184e 100644
--- a/apt-pkg/cacheset.cc
+++ b/apt-pkg/cacheset.cc
@@ -696,12 +696,12 @@ bool VersionContainerInterface::FromDependency(VersionContainerInterface * const
pkgCache::VerIterator VersionContainerInterface::getCandidateVer(pkgCacheFile &Cache,
pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper) {
pkgCache::VerIterator Cand;
- if (Cache.IsPolicyBuilt() == true || Cache.IsDepCacheBuilt() == false) {
- if (unlikely(Cache.GetPolicy() == 0))
- return pkgCache::VerIterator(Cache);
- Cand = Cache.GetPolicy()->GetCandidateVer(Pkg);
- } else {
+ if (Cache.IsDepCacheBuilt() == true) {
Cand = Cache[Pkg].CandidateVerIter(Cache);
+ } else if (unlikely(Cache.GetPolicy() == nullptr)) {
+ return pkgCache::VerIterator(Cache);
+ } else {
+ Cand = Cache.GetPolicy()->GetCandidateVer(Pkg);
}
if (Cand.end() == true)
return helper.canNotGetVersion(CacheSetHelper::CANDIDATE, Cache, Pkg);