summaryrefslogtreecommitdiff
path: root/apt-pkg/pkgcachegen.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2010-04-07 16:38:18 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2010-04-07 16:38:18 +0200
commit1cd1c398d18b78f4aa9d882a5de5385f4538e0be (patch)
tree98bfc88ce71f799526cdc36075932b8da34a6df7 /apt-pkg/pkgcachegen.cc
parentb3793d41d420a895ef5be4521a56535cc79f0d4a (diff)
* apt-pkg/contrib/fileutl.cc:
- add a parent-guarded "mkdir -p" as CreateDirectory() * apt-pkg/acquire.{cc,h}: - add a delayed constructor with Setup() for success reporting - check for and create directories in Setup if needed instead of error out unfriendly in the Constructor (Closes: #523920, #525783) - optional handle a lock file in Setup() * cmdline/apt-get.cc: - remove the lock file handling and let Acquire take care of it instead
Diffstat (limited to 'apt-pkg/pkgcachegen.cc')
-rw-r--r--apt-pkg/pkgcachegen.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc
index 21240b951..114c9d5ed 100644
--- a/apt-pkg/pkgcachegen.cc
+++ b/apt-pkg/pkgcachegen.cc
@@ -1003,7 +1003,20 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress,
// Decide if we can write to the files..
string const CacheFile = _config->FindFile("Dir::Cache::pkgcache");
string const SrcCacheFile = _config->FindFile("Dir::Cache::srcpkgcache");
-
+
+ // ensure the cache directory exists
+ if (CacheFile.empty() == false || SrcCacheFile.empty() == false)
+ {
+ string dir = _config->FindDir("Dir::Cache");
+ size_t const len = dir.size();
+ if (len > 5 && dir.find("/apt/", len - 6, 5) == len - 5)
+ dir = dir.substr(0, len - 5);
+ if (CacheFile.empty() == false)
+ CreateDirectory(dir, flNotFile(CacheFile));
+ if (SrcCacheFile.empty() == false)
+ CreateDirectory(dir, flNotFile(SrcCacheFile));
+ }
+
// Decide if we can write to the cache
bool Writeable = false;
if (CacheFile.empty() == false)