Преглед изворни кода

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 година
родитељ
комит
2fbfb11131
2 измењених фајлова са 7 додато и 3 уклоњено
  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);