diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2010-06-10 13:09:23 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2010-06-10 13:09:23 +0200 |
commit | a8ef7efd6df81d4fb9e52419695f10df9fe76cda (patch) | |
tree | 67a39f65d7c73f874b20af0026d3ec3462506a7a /apt-pkg/cacheset.cc | |
parent | 97f4026d93a85838439263d30146c3ad25fef474 (diff) | |
download | apt-a8ef7efd6df81d4fb9e52419695f10df9fe76cda.tar.gz |
* apt-pkg/cacheset.cc:
- get the candidate either from an already built depcache
or use the policy which is a bit faster than depcache generation
Diffstat (limited to 'apt-pkg/cacheset.cc')
-rw-r--r-- | apt-pkg/cacheset.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/apt-pkg/cacheset.cc b/apt-pkg/cacheset.cc index 43ade4b4e..e91b56997 100644 --- a/apt-pkg/cacheset.cc +++ b/apt-pkg/cacheset.cc @@ -261,9 +261,14 @@ bool VersionSet::AddSelectedVersion(pkgCacheFile &Cache, VersionSet &verset, // getCandidateVer - Returns the candidate version of the given package /*{{{*/ pkgCache::VerIterator VersionSet::getCandidateVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg, bool const &AllowError) { - if (unlikely(Cache.BuildDepCache() == false)) - return pkgCache::VerIterator(*Cache); - pkgCache::VerIterator Cand = Cache[Pkg].CandidateVerIter(Cache); + pkgCache::VerIterator Cand; + if (Cache.IsDepCacheBuilt() == true) + Cand = Cache[Pkg].CandidateVerIter(Cache); + else { + if (unlikely(Cache.BuildPolicy() == false)) + return pkgCache::VerIterator(*Cache); + Cand = Cache.GetPolicy()->GetCandidateVer(Pkg); + } if (AllowError == false && Cand.end() == true) _error->Error(_("Can't select candidate version from package %s as it has no candidate"), Pkg.FullName(true).c_str()); return Cand; |