summaryrefslogtreecommitdiff
path: root/apt-pkg/cachefile.cc
diff options
context:
space:
mode:
authorIshan Jayawardena <udeshike@gmail.com>2011-06-13 15:16:14 +0530
committerIshan Jayawardena <udeshike@gmail.com>2011-06-13 15:16:14 +0530
commit9995c4a0bc2d8567ff9f11d338ad610754682372 (patch)
tree8c365793c339382270c998dcd8395dc3a4471943 /apt-pkg/cachefile.cc
parentb8b21ea0d77e70b08948a594c6741252a39a6ca2 (diff)
added support for downloading debdelta files and queuing successfully downloaded debdeltas for processing with the debdelta apt method, in apt-pkg/acquire-item.{cc,h} in pkgAcqArchive class. Currently, no index for deltas are used. Proper progress reporting and methods to verify the debdeltas are yet to be added.
Diffstat (limited to 'apt-pkg/cachefile.cc')
-rw-r--r--apt-pkg/cachefile.cc86
1 files changed, 45 insertions, 41 deletions
diff --git a/apt-pkg/cachefile.cc b/apt-pkg/cachefile.cc
index 964c5bd8b..932f5be03 100644
--- a/apt-pkg/cachefile.cc
+++ b/apt-pkg/cachefile.cc
@@ -23,7 +23,7 @@
#include <apt-pkg/fileutl.h>
#include <apti18n.h>
- /*}}}*/
+using namespace std; /*}}}*/
// CacheFile::CacheFile - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */
@@ -50,47 +50,47 @@ pkgCacheFile::~pkgCacheFile()
/* */
bool pkgCacheFile::BuildCaches(OpProgress *Progress, bool WithLock)
{
- if (Cache != NULL)
- return true;
-
- if (_config->FindB("pkgCacheFile::Generate", true) == false)
- {
- Map = new MMap(*new FileFd(_config->FindFile("Dir::Cache::pkgcache"),
- FileFd::ReadOnly),MMap::Public|MMap::ReadOnly);
- Cache = new pkgCache(Map);
- if (_error->PendingError() == true)
- return false;
- return true;
- }
-
- const bool ErrorWasEmpty = _error->empty();
- if (WithLock == true)
- if (_system->Lock() == false)
- return false;
+ if (Cache != NULL)
+ return true;
+
+ if (_config->FindB("pkgCacheFile::Generate", true) == false)
+ {
+ Map = new MMap(*new FileFd(_config->FindFile("Dir::Cache::pkgcache"),
+ FileFd::ReadOnly),MMap::Public|MMap::ReadOnly);
+ Cache = new pkgCache(Map);
+ if (_error->PendingError() == true)
+ return false;
+ return true;
+ }
+
+ const bool ErrorWasEmpty = _error->empty();
+ if (WithLock == true)
+ if (_system->Lock() == false)
+ return false;
- if (_config->FindB("Debug::NoLocking",false) == true)
- WithLock = false;
+ if (_config->FindB("Debug::NoLocking",false) == true)
+ WithLock = false;
- if (_error->PendingError() == true)
- return false;
-
- BuildSourceList(Progress);
-
- // Read the caches
- bool Res = pkgCacheGenerator::MakeStatusCache(*SrcList,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."));
-
- /* This sux, remove it someday */
- if (ErrorWasEmpty == true && _error->empty() == false)
- _error->Warning(_("You may want to run apt-get update to correct these problems"));
-
- Cache = new pkgCache(Map);
- if (_error->PendingError() == true)
- return false;
- return true;
+ if (_error->PendingError() == true)
+ return false;
+
+ BuildSourceList(Progress);
+
+ // Read the caches
+ bool Res = pkgCacheGenerator::MakeStatusCache(*SrcList,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."));
+
+ /* This sux, remove it someday */
+ if (ErrorWasEmpty == true && _error->empty() == false)
+ _error->Warning(_("You may want to run apt-get update to correct these problems"));
+
+ Cache = new pkgCache(Map);
+ if (_error->PendingError() == true)
+ return false;
+ return true;
}
/*}}}*/
// CacheFile::BuildSourceList - Open and build all relevant sources.list/*{{{*/
@@ -98,9 +98,13 @@ bool pkgCacheFile::BuildCaches(OpProgress *Progress, bool WithLock)
/* */
bool pkgCacheFile::BuildSourceList(OpProgress *Progress)
{
- if (SrcList != NULL)
+ //std::cerr << "BuildSourceList(): Starting..." << std::endl;
+ if (SrcList != NULL) {
+ //std::cerr << " SrcList is not null. Returning." << std::endl;
return true;
+ }
+ //std::cerr << " making a new SrcList." << std::endl;
SrcList = new pkgSourceList();
if (SrcList->ReadMainList() == false)
return _error->Error(_("The list of sources could not be read."));