]> git.saurik.com Git - apt.git/commitdiff
* apt-pkg/cacheset.cc:
authorDavid Kalnischkies <kalnischkies@gmail.com>
Thu, 10 Jun 2010 11:09:23 +0000 (13:09 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Thu, 10 Jun 2010 11:09:23 +0000 (13:09 +0200)
  - get the candidate either from an already built depcache
    or use the policy which is a bit faster than depcache generation

apt-pkg/cachefile.h
apt-pkg/cacheset.cc
debian/changelog

index 1647aff8eb095ce06f2ba5ed71ee4e27d26cb7eb..c68f06ed89aff3fded670a7f87098455d6ec3aad 100644 (file)
 
 #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();
 };
index 43ade4b4e7eb2cd27f8e5d0210e72c597572d0b7..e91b56997b2fc499edbf115fdd6347b549ae9bd0 100644 (file)
@@ -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;
index f9638b78f656604b2f18e6018d41a89e4cd1825f..8470a0d853907ae290131d09a979a2cf65bebe02 100644 (file)
@@ -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 ]