Explorar o código

* apt-pkg/cachefile.{cc,h}:
- split Open() into submethods to be able to build only parts
- make the OpProgress optional in the Cache buildprocess

David Kalnischkies %!s(int64=16) %!d(string=hai) anos
pai
achega
2e5f4e45f5

+ 36 - 14
apt-pkg/cachefile.cc

@@ -46,7 +46,7 @@ pkgCacheFile::~pkgCacheFile()
 // CacheFile::BuildCaches - Open and build the cache files		/*{{{*/
 // CacheFile::BuildCaches - Open and build the cache files		/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-bool pkgCacheFile::BuildCaches(OpProgress &Progress,bool WithLock)
+bool pkgCacheFile::BuildCaches(OpProgress *Progress, bool WithLock)
 {
 {
    const bool ErrorWasEmpty = _error->empty();
    const bool ErrorWasEmpty = _error->empty();
    if (WithLock == true)
    if (WithLock == true)
@@ -65,8 +65,9 @@ bool pkgCacheFile::BuildCaches(OpProgress &Progress,bool WithLock)
       return _error->Error(_("The list of sources could not be read."));
       return _error->Error(_("The list of sources could not be read."));
 
 
    // Read the caches
    // Read the caches
-   bool Res = pkgMakeStatusCache(List,Progress,&Map,!WithLock);
-   Progress.Done();
+   bool Res = pkgCacheGenerator::MakeStatusCache(List,Progress,&Map,!WithLock);
+   if (Progress != NULL)
+      Progress->Done();
    if (Res == false)
    if (Res == false)
       return _error->Error(_("The package lists or status file could not be parsed or opened."));
       return _error->Error(_("The package lists or status file could not be parsed or opened."));
 
 
@@ -80,29 +81,50 @@ bool pkgCacheFile::BuildCaches(OpProgress &Progress,bool WithLock)
    return true;
    return true;
 }
 }
 									/*}}}*/
 									/*}}}*/
-// CacheFile::Open - Open the cache files, creating if necessary	/*{{{*/
+// CacheFile::BuildPolicy - Open and build all relevant preferences	/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-bool pkgCacheFile::Open(OpProgress &Progress,bool WithLock)
+bool pkgCacheFile::BuildPolicy(OpProgress *Progress)
 {
 {
-   if (BuildCaches(Progress,WithLock) == false)
-      return false;
-   
-   // The policy engine
    Policy = new pkgPolicy(Cache);
    Policy = new pkgPolicy(Cache);
    if (_error->PendingError() == true)
    if (_error->PendingError() == true)
       return false;
       return false;
 
 
    if (ReadPinFile(*Policy) == false || ReadPinDir(*Policy) == false)
    if (ReadPinFile(*Policy) == false || ReadPinDir(*Policy) == false)
       return false;
       return false;
-   
-   // Create the dependency cache
+
+   return true;
+}
+									/*}}}*/
+// CacheFile::BuildDepCache - Open and build the dependency cache	/*{{{*/
+// ---------------------------------------------------------------------
+/* */
+bool pkgCacheFile::BuildDepCache(OpProgress *Progress)
+{
    DCache = new pkgDepCache(Cache,Policy);
    DCache = new pkgDepCache(Cache,Policy);
    if (_error->PendingError() == true)
    if (_error->PendingError() == true)
       return false;
       return false;
-   
-   DCache->Init(&Progress);
-   Progress.Done();
+
+   DCache->Init(Progress);
+   return true;
+}
+									/*}}}*/
+// CacheFile::Open - Open the cache files, creating if necessary	/*{{{*/
+// ---------------------------------------------------------------------
+/* */
+bool pkgCacheFile::Open(OpProgress *Progress, bool WithLock)
+{
+   if (BuildCaches(Progress,WithLock) == false)
+      return false;
+
+   if (BuildPolicy(Progress) == false)
+      return false;
+
+   if (BuildDepCache(Progress) == false)
+      return false;
+
+   if (Progress != NULL)
+      Progress->Done();
    if (_error->PendingError() == true)
    if (_error->PendingError() == true)
       return false;
       return false;
    
    

+ 9 - 6
apt-pkg/cachefile.h

@@ -30,11 +30,10 @@ class pkgCacheFile
    MMap *Map;
    MMap *Map;
    pkgCache *Cache;
    pkgCache *Cache;
    pkgDepCache *DCache;
    pkgDepCache *DCache;
-   
+   pkgPolicy *Policy;
+
    public:
    public:
 
 
-   pkgPolicy *Policy;
-      
    // We look pretty much exactly like a pointer to a dep cache
    // We look pretty much exactly like a pointer to a dep cache
    inline operator pkgCache &() {return *Cache;};
    inline operator pkgCache &() {return *Cache;};
    inline operator pkgCache *() {return Cache;};
    inline operator pkgCache *() {return Cache;};
@@ -45,12 +44,16 @@ class pkgCacheFile
    inline pkgDepCache::StateCache &operator [](pkgCache::PkgIterator const &I) {return (*DCache)[I];};
    inline pkgDepCache::StateCache &operator [](pkgCache::PkgIterator const &I) {return (*DCache)[I];};
    inline unsigned char &operator [](pkgCache::DepIterator const &I) {return (*DCache)[I];};
    inline unsigned char &operator [](pkgCache::DepIterator const &I) {return (*DCache)[I];};
 
 
-   bool BuildCaches(OpProgress &Progress,bool WithLock = true);
-   bool Open(OpProgress &Progress,bool WithLock = true);
+   bool BuildCaches(OpProgress *Progress = NULL,bool WithLock = true);
+   __deprecated bool BuildCaches(OpProgress &Progress,bool const &WithLock = true) { return BuildCaches(&Progress, WithLock); };
+   bool BuildPolicy(OpProgress *Progress = NULL);
+   bool BuildDepCache(OpProgress *Progress = NULL);
+   bool Open(OpProgress *Progress = NULL, bool WithLock = true);
+   __deprecated bool Open(OpProgress &Progress,bool const &WithLock = true) { return Open(&Progress, WithLock); };
    void Close();
    void Close();
    
    
    pkgCacheFile();
    pkgCacheFile();
-   ~pkgCacheFile();
+   virtual ~pkgCacheFile();
 };
 };
 
 
 #endif
 #endif

+ 10 - 8
apt-pkg/deb/debindexfile.cc

@@ -262,15 +262,15 @@ unsigned long debPackagesIndex::Size() const
 // PackagesIndex::Merge - Load the index file into a cache		/*{{{*/
 // PackagesIndex::Merge - Load the index file into a cache		/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-bool debPackagesIndex::Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const
+bool debPackagesIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
 {
 {
    string PackageFile = IndexFile("Packages");
    string PackageFile = IndexFile("Packages");
    FileFd Pkg(PackageFile,FileFd::ReadOnly);
    FileFd Pkg(PackageFile,FileFd::ReadOnly);
    debListParser Parser(&Pkg, Architecture);
    debListParser Parser(&Pkg, Architecture);
    if (_error->PendingError() == true)
    if (_error->PendingError() == true)
       return _error->Error("Problem opening %s",PackageFile.c_str());
       return _error->Error("Problem opening %s",PackageFile.c_str());
-   
-   Prog.SubProgress(0,Info("Packages"));
+   if (Prog != NULL)
+      Prog->SubProgress(0,Info("Packages"));
    ::URI Tmp(URI);
    ::URI Tmp(URI);
    if (Gen.SelectFile(PackageFile,Tmp.Host,*this) == false)
    if (Gen.SelectFile(PackageFile,Tmp.Host,*this) == false)
       return _error->Error("Problem with SelectFile %s",PackageFile.c_str());
       return _error->Error("Problem with SelectFile %s",PackageFile.c_str());
@@ -445,7 +445,7 @@ unsigned long debTranslationsIndex::Size() const
 // TranslationsIndex::Merge - Load the index file into a cache		/*{{{*/
 // TranslationsIndex::Merge - Load the index file into a cache		/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-bool debTranslationsIndex::Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const
+bool debTranslationsIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
 {
 {
    // Check the translation file, if in use
    // Check the translation file, if in use
    string TranslationFile = IndexFile(Language);
    string TranslationFile = IndexFile(Language);
@@ -456,7 +456,8 @@ bool debTranslationsIndex::Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const
      if (_error->PendingError() == true)
      if (_error->PendingError() == true)
        return false;
        return false;
      
      
-     Prog.SubProgress(0, Info(TranslationFile.c_str()));
+     if (Prog != NULL)
+	Prog->SubProgress(0, Info(TranslationFile.c_str()));
      if (Gen.SelectFile(TranslationFile,string(),*this) == false)
      if (Gen.SelectFile(TranslationFile,string(),*this) == false)
        return _error->Error("Problem with SelectFile %s",TranslationFile.c_str());
        return _error->Error("Problem with SelectFile %s",TranslationFile.c_str());
 
 
@@ -529,7 +530,7 @@ unsigned long debStatusIndex::Size() const
 // StatusIndex::Merge - Load the index file into a cache		/*{{{*/
 // StatusIndex::Merge - Load the index file into a cache		/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-bool debStatusIndex::Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const
+bool debStatusIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
 {
 {
    FileFd Pkg(File,FileFd::ReadOnly);
    FileFd Pkg(File,FileFd::ReadOnly);
    if (_error->PendingError() == true)
    if (_error->PendingError() == true)
@@ -537,8 +538,9 @@ bool debStatusIndex::Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const
    debListParser Parser(&Pkg);
    debListParser Parser(&Pkg);
    if (_error->PendingError() == true)
    if (_error->PendingError() == true)
       return false;
       return false;
-   
-   Prog.SubProgress(0,File);
+
+   if (Prog != NULL)
+      Prog->SubProgress(0,File);
    if (Gen.SelectFile(File,string(),*this,pkgCache::Flag::NotSource) == false)
    if (Gen.SelectFile(File,string(),*this,pkgCache::Flag::NotSource) == false)
       return _error->Error("Problem with SelectFile %s",File.c_str());
       return _error->Error("Problem with SelectFile %s",File.c_str());
 
 

+ 3 - 3
apt-pkg/deb/debindexfile.h

@@ -35,7 +35,7 @@ class debStatusIndex : public pkgIndexFile
    virtual bool Exists() const;
    virtual bool Exists() const;
    virtual bool HasPackages() const {return true;};
    virtual bool HasPackages() const {return true;};
    virtual unsigned long Size() const;
    virtual unsigned long Size() const;
-   virtual bool Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const;
+   virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
    virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
    virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
 
 
    debStatusIndex(string File);
    debStatusIndex(string File);
@@ -67,7 +67,7 @@ class debPackagesIndex : public pkgIndexFile
    virtual bool Exists() const;
    virtual bool Exists() const;
    virtual bool HasPackages() const {return true;};
    virtual bool HasPackages() const {return true;};
    virtual unsigned long Size() const;
    virtual unsigned long Size() const;
-   virtual bool Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const;
+   virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
    virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
    virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
 
 
    debPackagesIndex(string const &URI, string const &Dist, string const &Section,
    debPackagesIndex(string const &URI, string const &Dist, string const &Section,
@@ -99,7 +99,7 @@ class debTranslationsIndex : public pkgIndexFile
    virtual bool Exists() const;
    virtual bool Exists() const;
    virtual bool HasPackages() const;
    virtual bool HasPackages() const;
    virtual unsigned long Size() const;
    virtual unsigned long Size() const;
-   virtual bool Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const;
+   virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
    virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
    virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
 
 
    debTranslationsIndex(string URI,string Dist,string Section, char const * const Language);
    debTranslationsIndex(string URI,string Dist,string Section, char const * const Language);

+ 6 - 2
apt-pkg/indexfile.h

@@ -74,8 +74,12 @@ class pkgIndexFile
    virtual bool Exists() const = 0;
    virtual bool Exists() const = 0;
    virtual bool HasPackages() const = 0;
    virtual bool HasPackages() const = 0;
    virtual unsigned long Size() const = 0;
    virtual unsigned long Size() const = 0;
-   virtual bool Merge(pkgCacheGenerator &/*Gen*/,OpProgress &/*Prog*/) const {return false;};
-   virtual bool MergeFileProvides(pkgCacheGenerator &/*Gen*/,OpProgress &/*Prog*/) const {return true;};
+   virtual bool Merge(pkgCacheGenerator &/*Gen*/,OpProgress* /*Prog*/) const { return false; };
+   __deprecated virtual bool Merge(pkgCacheGenerator &Gen, OpProgress &Prog) const
+      { return Merge(Gen, &Prog); };
+   virtual bool MergeFileProvides(pkgCacheGenerator &/*Gen*/,OpProgress* /*Prog*/) const {return true;};
+   __deprecated virtual bool MergeFileProvides(pkgCacheGenerator &Gen, OpProgress &Prog) const
+      {return MergeFileProvides(Gen, &Prog);};
    virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
    virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
 
 
    static bool TranslationsAvailable();
    static bool TranslationsAvailable();

+ 28 - 17
apt-pkg/pkgcachegen.cc

@@ -526,7 +526,7 @@ map_ptrloc pkgCacheGenerator::NewDescription(pkgCache::DescIterator &Desc,
 // CacheGenerator::FinishCache - do various finish operations		/*{{{*/
 // CacheGenerator::FinishCache - do various finish operations		/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* This prepares the Cache for delivery */
 /* This prepares the Cache for delivery */
-bool pkgCacheGenerator::FinishCache(OpProgress &Progress)
+bool pkgCacheGenerator::FinishCache(OpProgress *Progress)
 {
 {
    // FIXME: add progress reporting for this operation
    // FIXME: add progress reporting for this operation
    // Do we have different architectures in your groups ?
    // Do we have different architectures in your groups ?
@@ -923,7 +923,7 @@ static unsigned long ComputeSize(FileIterator Start,FileIterator End)
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
 static bool BuildCache(pkgCacheGenerator &Gen,
 static bool BuildCache(pkgCacheGenerator &Gen,
-		       OpProgress &Progress,
+		       OpProgress *Progress,
 		       unsigned long &CurrentSize,unsigned long TotalSize,
 		       unsigned long &CurrentSize,unsigned long TotalSize,
 		       FileIterator Start, FileIterator End)
 		       FileIterator Start, FileIterator End)
 {
 {
@@ -944,7 +944,8 @@ static bool BuildCache(pkgCacheGenerator &Gen,
       }
       }
       
       
       unsigned long Size = (*I)->Size();
       unsigned long Size = (*I)->Size();
-      Progress.OverallProgress(CurrentSize,TotalSize,Size,_("Reading package lists"));
+      if (Progress != NULL)
+	 Progress->OverallProgress(CurrentSize,TotalSize,Size,_("Reading package lists"));
       CurrentSize += Size;
       CurrentSize += Size;
       
       
       if ((*I)->Merge(Gen,Progress) == false)
       if ((*I)->Merge(Gen,Progress) == false)
@@ -953,13 +954,15 @@ static bool BuildCache(pkgCacheGenerator &Gen,
 
 
    if (Gen.HasFileDeps() == true)
    if (Gen.HasFileDeps() == true)
    {
    {
-      Progress.Done();
+      if (Progress != NULL)
+	 Progress->Done();
       TotalSize = ComputeSize(Start, End);
       TotalSize = ComputeSize(Start, End);
       CurrentSize = 0;
       CurrentSize = 0;
       for (I = Start; I != End; I++)
       for (I = Start; I != End; I++)
       {
       {
 	 unsigned long Size = (*I)->Size();
 	 unsigned long Size = (*I)->Size();
-	 Progress.OverallProgress(CurrentSize,TotalSize,Size,_("Collecting File Provides"));
+	 if (Progress != NULL)
+	    Progress->OverallProgress(CurrentSize,TotalSize,Size,_("Collecting File Provides"));
 	 CurrentSize += Size;
 	 CurrentSize += Size;
 	 if ((*I)->MergeFileProvides(Gen,Progress) == false)
 	 if ((*I)->MergeFileProvides(Gen,Progress) == false)
 	    return false;
 	    return false;
@@ -969,7 +972,7 @@ static bool BuildCache(pkgCacheGenerator &Gen,
    return true;
    return true;
 }
 }
 									/*}}}*/
 									/*}}}*/
-// MakeStatusCache - Construct the status cache				/*{{{*/
+// CacheGenerator::MakeStatusCache - Construct the status cache		/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* This makes sure that the status cache (the cache that has all 
 /* This makes sure that the status cache (the cache that has all 
    index files from the sources list and all local ones) is ready
    index files from the sources list and all local ones) is ready
@@ -977,7 +980,10 @@ static bool BuildCache(pkgCacheGenerator &Gen,
    the cache will be stored there. This is pretty much mandetory if you
    the cache will be stored there. This is pretty much mandetory if you
    are using AllowMem. AllowMem lets the function be run as non-root
    are using AllowMem. AllowMem lets the function be run as non-root
    where it builds the cache 'fast' into a memory buffer. */
    where it builds the cache 'fast' into a memory buffer. */
-bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress,
+__deprecated bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress,
+			MMap **OutMap, bool AllowMem)
+   { return pkgCacheGenerator::MakeStatusCache(List, &Progress, OutMap, AllowMem); }
+bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress,
 			MMap **OutMap,bool AllowMem)
 			MMap **OutMap,bool AllowMem)
 {
 {
    bool const Debug = _config->FindB("Debug::pkgCacheGen", false);
    bool const Debug = _config->FindB("Debug::pkgCacheGen", false);
@@ -1028,13 +1034,15 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress,
 
 
    if (Writeable == false && AllowMem == false && CacheFile.empty() == false)
    if (Writeable == false && AllowMem == false && CacheFile.empty() == false)
       return _error->Error(_("Unable to write to %s"),flNotFile(CacheFile).c_str());
       return _error->Error(_("Unable to write to %s"),flNotFile(CacheFile).c_str());
-   
-   Progress.OverallProgress(0,1,1,_("Reading package lists"));
-   
+
+   if (Progress != NULL)
+      Progress->OverallProgress(0,1,1,_("Reading package lists"));
+
    // Cache is OK, Fin.
    // Cache is OK, Fin.
    if (CheckValidity(CacheFile,Files.begin(),Files.end(),OutMap) == true)
    if (CheckValidity(CacheFile,Files.begin(),Files.end(),OutMap) == true)
    {
    {
-      Progress.OverallProgress(1,1,1,_("Reading package lists"));
+      if (Progress != NULL)
+	 Progress->OverallProgress(1,1,1,_("Reading package lists"));
       if (Debug == true)
       if (Debug == true)
 	 std::clog << "pkgcache.bin is valid - no need to build anything" << std::endl;
 	 std::clog << "pkgcache.bin is valid - no need to build anything" << std::endl;
       return true;
       return true;
@@ -1084,7 +1092,7 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress,
       TotalSize = ComputeSize(Files.begin()+EndOfSource,Files.end());
       TotalSize = ComputeSize(Files.begin()+EndOfSource,Files.end());
 
 
       // Build the status cache
       // Build the status cache
-      pkgCacheGenerator Gen(Map.Get(),&Progress);
+      pkgCacheGenerator Gen(Map.Get(),Progress);
       if (_error->PendingError() == true)
       if (_error->PendingError() == true)
 	 return false;
 	 return false;
       if (BuildCache(Gen,Progress,CurrentSize,TotalSize,
       if (BuildCache(Gen,Progress,CurrentSize,TotalSize,
@@ -1101,7 +1109,7 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress,
       TotalSize = ComputeSize(Files.begin(),Files.end());
       TotalSize = ComputeSize(Files.begin(),Files.end());
       
       
       // Build the source cache
       // Build the source cache
-      pkgCacheGenerator Gen(Map.Get(),&Progress);
+      pkgCacheGenerator Gen(Map.Get(),Progress);
       if (_error->PendingError() == true)
       if (_error->PendingError() == true)
 	 return false;
 	 return false;
       if (BuildCache(Gen,Progress,CurrentSize,TotalSize,
       if (BuildCache(Gen,Progress,CurrentSize,TotalSize,
@@ -1160,10 +1168,12 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress,
    return true;
    return true;
 }
 }
 									/*}}}*/
 									/*}}}*/
-// MakeOnlyStatusCache - Build a cache with just the status files	/*{{{*/
+// CacheGenerator::MakeOnlyStatusCache - Build only a status files cache/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutMap)
+__deprecated bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutMap)
+   { return pkgCacheGenerator::MakeOnlyStatusCache(&Progress, OutMap); }
+bool pkgCacheGenerator::MakeOnlyStatusCache(OpProgress *Progress,DynamicMMap **OutMap)
 {
 {
    unsigned long MapSize = _config->FindI("APT::Cache-Limit",20*1024*1024);
    unsigned long MapSize = _config->FindI("APT::Cache-Limit",20*1024*1024);
    vector<pkgIndexFile *> Files;
    vector<pkgIndexFile *> Files;
@@ -1178,8 +1188,9 @@ bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutMap)
    TotalSize = ComputeSize(Files.begin()+EndOfSource,Files.end());
    TotalSize = ComputeSize(Files.begin()+EndOfSource,Files.end());
    
    
    // Build the status cache
    // Build the status cache
-   Progress.OverallProgress(0,1,1,_("Reading package lists"));
-   pkgCacheGenerator Gen(Map.Get(),&Progress);
+   if (Progress != NULL)
+      Progress->OverallProgress(0,1,1,_("Reading package lists"));
+   pkgCacheGenerator Gen(Map.Get(),Progress);
    if (_error->PendingError() == true)
    if (_error->PendingError() == true)
       return false;
       return false;
    if (BuildCache(Gen,Progress,CurrentSize,TotalSize,
    if (BuildCache(Gen,Progress,CurrentSize,TotalSize,

+ 8 - 2
apt-pkg/pkgcachegen.h

@@ -76,7 +76,11 @@ class pkgCacheGenerator							/*{{{*/
 
 
    bool HasFileDeps() {return FoundFileDeps;};
    bool HasFileDeps() {return FoundFileDeps;};
    bool MergeFileProvides(ListParser &List);
    bool MergeFileProvides(ListParser &List);
-   bool FinishCache(OpProgress &Progress);
+   bool FinishCache(OpProgress *Progress);
+
+   static bool MakeStatusCache(pkgSourceList &List,OpProgress *Progress,
+			MMap **OutMap = 0,bool AllowMem = false);
+   static bool MakeOnlyStatusCache(OpProgress *Progress,DynamicMMap **OutMap);
 
 
    pkgCacheGenerator(DynamicMMap *Map,OpProgress *Progress);
    pkgCacheGenerator(DynamicMMap *Map,OpProgress *Progress);
    ~pkgCacheGenerator();
    ~pkgCacheGenerator();
@@ -134,10 +138,12 @@ class pkgCacheGenerator::ListParser
    virtual ~ListParser() {};
    virtual ~ListParser() {};
 };
 };
 									/*}}}*/
 									/*}}}*/
+
 bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress,
 bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress,
 			MMap **OutMap = 0,bool AllowMem = false);
 			MMap **OutMap = 0,bool AllowMem = false);
 bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutMap);
 bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutMap);
 
 
+
 #ifdef APT_COMPATIBILITY
 #ifdef APT_COMPATIBILITY
 #if APT_COMPATIBILITY != 986
 #if APT_COMPATIBILITY != 986
 #warning "Using APT_COMPATIBILITY"
 #warning "Using APT_COMPATIBILITY"
@@ -145,7 +151,7 @@ bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutMap);
 MMap *pkgMakeStatusCacheMem(pkgSourceList &List,OpProgress &Progress)
 MMap *pkgMakeStatusCacheMem(pkgSourceList &List,OpProgress &Progress)
 {
 {
    MMap *Map = 0;
    MMap *Map = 0;
-   if (pkgMakeStatusCache(List,Progress,&Map,true) == false)
+   if (pkgCacheGenerator::MakeStatusCache(List,&Progress,&Map,true) == false)
       return 0;
       return 0;
    return Map;
    return Map;
 }
 }

+ 3 - 0
debian/changelog

@@ -32,6 +32,9 @@ apt (0.7.26~exp6) UNRELEASED; urgency=low
     - get the best matching arch package from a group with FindPreferredPkg
     - get the best matching arch package from a group with FindPreferredPkg
   * cmdline/apt-cache.cc:
   * cmdline/apt-cache.cc:
     - make the search multiarch compatible by using GrpIterator instead
     - make the search multiarch compatible by using GrpIterator instead
+  * apt-pkg/cachefile.{cc,h}:
+    - split Open() into submethods to be able to build only parts
+    - make the OpProgress optional in the Cache buildprocess
 
 
  -- David Kalnischkies <kalnischkies@gmail.com>  Mon, 31 May 2010 22:36:35 +0200
  -- David Kalnischkies <kalnischkies@gmail.com>  Mon, 31 May 2010 22:36:35 +0200