summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2010-07-04 00:32:52 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2010-07-04 00:32:52 +0200
commit2fbfb111312257fa5fc29b0c2ed386fb712f960e (patch)
tree89eb4ec06fcf41a8927b4347c86e2f342922ce21 /cmdline
parent21d4c9f192b5af9c8edb39356712aac853881348 (diff)
prefer the Policy if it is built instead of the DepCache and
if DepCache is not available as fallback built the Policy
Diffstat (limited to 'cmdline')
-rw-r--r--cmdline/apt-get.cc3
-rw-r--r--cmdline/cacheset.cc7
2 files changed, 7 insertions, 3 deletions
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index 38b93e7e5..9a6c12ee0 100644
--- a/cmdline/apt-get.cc
+++ b/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];
diff --git a/cmdline/cacheset.cc b/cmdline/cacheset.cc
index b96b60450..78c9d3f6c 100644
--- a/cmdline/cacheset.cc
+++ b/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);