From b6192267c23ffda1b9c8328537a5f2c83e176c26 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 27 Aug 2015 13:10:02 +0200 Subject: 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. --- apt-pkg/cacheset.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'apt-pkg/cacheset.cc') 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); -- cgit v1.2.3