Browse Source

* 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
debian/1.8.y
David Kalnischkies 12 years ago
parent
commit
a8ef7efd6d
  1. 8
      apt-pkg/cachefile.h
  2. 11
      apt-pkg/cacheset.cc
  3. 8
      debian/changelog

8
apt-pkg/cachefile.h

@ -20,10 +20,9 @@
#include <apt-pkg/depcache.h>
#include <apt-pkg/acquire.h>
#include <apt-pkg/policy.h>
#include <apt-pkg/sourcelist.h>
class pkgPolicy;
class pkgSourceList;
class pkgCacheFile
{
protected:
@ -65,6 +64,11 @@ class pkgCacheFile
inline pkgPolicy* GetPolicy() { BuildPolicy(); return Policy; };
inline pkgSourceList* GetSourceList() { BuildSourceList(); return SrcList; };
inline bool IsPkgCacheBuilt() const { return (Cache != NULL); };
inline bool IsDepCacheBuilt() const { return (DCache != NULL); };
inline bool IsPolicyBuilt() const { return (Policy != NULL); };
inline bool IsSrcListBuilt() const { return (SrcList != NULL); };
pkgCacheFile();
virtual ~pkgCacheFile();
};

11
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;

8
debian/changelog

@ -1,3 +1,11 @@
apt (0.7.26~exp7) UNRELEASED; urgency=low
* 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
-- David Kalnischkies <kalnischkies@gmail.com> Thu, 10 Jun 2010 13:04:47 +0200
apt (0.7.26~exp6) UNRELEASED; urgency=low
[ Michael Vogt ]

Loading…
Cancel
Save