Просмотр исходного кода

[ABI break] merge patch from Jonathan Thomas to speed up the
depcache by caching the install-recommends and install-suggests
values

Michael Vogt лет назад: 15
Родитель
Сommit
b20c16833e
3 измененных файлов с 14 добавлено и 3 удалено
  1. 2 2
      apt-pkg/depcache.cc
  2. 9 1
      apt-pkg/depcache.h
  3. 3 0
      debian/changelog

+ 2 - 2
apt-pkg/depcache.cc

@@ -1511,7 +1511,7 @@ bool pkgDepCache::Policy::IsImportantDep(DepIterator const &Dep)
       return true;
    else if(Dep->Type == pkgCache::Dep::Recommends) 
    {
-      if ( _config->FindB("APT::Install-Recommends", false))
+      if (InstallRecommends)
 	 return true;
       // we suport a special mode to only install-recommends for certain
       // sections
@@ -1522,7 +1522,7 @@ bool pkgDepCache::Policy::IsImportantDep(DepIterator const &Dep)
 	 return true;
    }
    else if(Dep->Type == pkgCache::Dep::Suggests)
-     return _config->FindB("APT::Install-Suggests", false);
+      return InstallSuggests;
 
    return false;
 }

+ 9 - 1
apt-pkg/depcache.h

@@ -258,13 +258,21 @@ class pkgDepCache : protected pkgCache::Namespace
    class Policy
    {
       public:
-      
+      Policy() {
+         InstallRecommends = _config->FindB("APT::Install-Recommends", false);
+         InstallSuggests = _config->FindB("APT::Install-Suggests", false);
+      }
+
       virtual VerIterator GetCandidateVer(PkgIterator const &Pkg);
       virtual bool IsImportantDep(DepIterator const &Dep);
       virtual signed short GetPriority(PkgIterator const &Pkg);
       virtual signed short GetPriority(PkgFileIterator const &File);
 
       virtual ~Policy() {};
+
+      private:
+      bool InstallRecommends;
+      bool InstallSuggests;
    };
 
    private:

+ 3 - 0
debian/changelog

@@ -17,6 +17,9 @@ apt (0.8.16~exp4) UNRELEASED; urgency=low
   * [ABI break] merged patch from Jonathan Thomas to have a new
     RecordField() function in the pkgRecorder parser. Many thanks
     Thomas
+  * [ABI break] merge patch from Jonathan Thomas to speed up the
+    depcache by caching the install-recommends and install-suggests
+    values
 
  -- Julian Andres Klode <jak@debian.org>  Wed, 20 Jul 2011 16:23:55 +0200