Browse Source

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.
debian/1.8.y
Julian Andres Klode 7 years ago
parent
commit
b6192267c2
  1. 10
      apt-pkg/cacheset.cc

10
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);

Loading…
Cancel
Save