Sfoglia il codice sorgente

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 anni fa
parent
commit
2fbfb11131
2 ha cambiato i file con 7 aggiunte e 3 eliminazioni
  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);