Ver código fonte

prefer the Policy if it is built instead of the DepCache and
if DepCache is not available as fallback built the Policy

David Kalnischkies 16 anos atrás
pai
commit
2fbfb11131
2 arquivos alterados com 7 adições e 3 exclusões
  1. 3 0
      cmdline/apt-get.cc
  2. 4 3
      cmdline/cacheset.cc

+ 3 - 0
cmdline/apt-get.cc

@@ -768,6 +768,9 @@ struct TryToInstall {
 
    void operator() (pkgCache::VerIterator const &Ver) {
       pkgCache::PkgIterator Pkg = Ver.ParentPkg();
+
+std::clog << "INSTALL " << Pkg << " VER " << Ver.VerStr() << std::endl;
+
       Cache->GetDepCache()->SetCandidateVersion(Ver);
       pkgDepCache::StateCache &State = (*Cache)[Pkg];
 

+ 4 - 3
cmdline/cacheset.cc

@@ -416,12 +416,13 @@ VersionSet VersionSet::FromPackage(pkgCacheFile &Cache, pkgCache::PkgIterator co
 pkgCache::VerIterator VersionSet::getCandidateVer(pkgCacheFile &Cache,
 		pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper) {
 	pkgCache::VerIterator Cand;
-	if (Cache.IsDepCacheBuilt() == true)
-		Cand = Cache[Pkg].CandidateVerIter(Cache);
-	else {
+	if (Cache.IsPolicyBuilt() == true || Cache.IsDepCacheBuilt() == false)
+	{
 		if (unlikely(Cache.GetPolicy() == 0))
 			return pkgCache::VerIterator(Cache);
 		Cand = Cache.GetPolicy()->GetCandidateVer(Pkg);
+	} else {
+		Cand = Cache[Pkg].CandidateVerIter(Cache);
 	}
 	if (Cand.end() == true)
 		return helper.canNotFindCandidateVer(Cache, Pkg);