summaryrefslogtreecommitdiff
path: root/apt-pkg/cachefile.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2010-06-04 14:43:03 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2010-06-04 14:43:03 +0200
commit2e5f4e45f593535e2c88181ff7a9e2d32a5e60f9 (patch)
tree184314cc04e793b2a00b854078174c4a7b174f70 /apt-pkg/cachefile.cc
parentd4489d4983d5b9840bb2882a088dd1f363a280b9 (diff)
* apt-pkg/cachefile.{cc,h}:
- split Open() into submethods to be able to build only parts - make the OpProgress optional in the Cache buildprocess
Diffstat (limited to 'apt-pkg/cachefile.cc')
-rw-r--r--apt-pkg/cachefile.cc50
1 files changed, 36 insertions, 14 deletions
diff --git a/apt-pkg/cachefile.cc b/apt-pkg/cachefile.cc
index 790312dc8..b0f8bc424 100644
--- a/apt-pkg/cachefile.cc
+++ b/apt-pkg/cachefile.cc
@@ -46,7 +46,7 @@ pkgCacheFile::~pkgCacheFile()
// 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();
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."));
// 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)
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;
}
/*}}}*/
-// 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);
if (_error->PendingError() == true)
return false;
if (ReadPinFile(*Policy) == false || ReadPinDir(*Policy) == 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);
if (_error->PendingError() == true)
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)
return false;