summaryrefslogtreecommitdiff
path: root/apt-pkg/cachefile.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-08-22 23:10:15 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-08-22 23:10:15 +0200
commit8de79b68a834a6cc7abb8976e96ed19374fc02a2 (patch)
treeaead647a6dcafc84404073459e15d5fd603b3c6a /apt-pkg/cachefile.cc
parent95b5f6c19d361745c4e11b214f0f07ad10c9b5b3 (diff)
downloadapt-8de79b68a834a6cc7abb8976e96ed19374fc02a2.tar.gz
remove the caches in 'apt-get update', too, as they will be
invalid in most cases anyway
Diffstat (limited to 'apt-pkg/cachefile.cc')
-rw-r--r--apt-pkg/cachefile.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/apt-pkg/cachefile.cc b/apt-pkg/cachefile.cc
index 964c5bd8..a76cfc08 100644
--- a/apt-pkg/cachefile.cc
+++ b/apt-pkg/cachefile.cc
@@ -163,6 +163,20 @@ bool pkgCacheFile::Open(OpProgress *Progress, bool WithLock)
return true;
}
/*}}}*/
+// CacheFile::RemoveCaches - remove all cache files from disk /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+void pkgCacheFile::RemoveCaches()
+{
+ std::string const pkgcache = _config->FindFile("Dir::cache::pkgcache");
+ std::string const srcpkgcache = _config->FindFile("Dir::cache::srcpkgcache");
+
+ if (pkgcache.empty() == false && RealFileExists(pkgcache) == true)
+ unlink(pkgcache.c_str());
+ if (srcpkgcache.empty() == false && RealFileExists(srcpkgcache) == true)
+ unlink(srcpkgcache.c_str());
+}
+ /*}}}*/
// CacheFile::Close - close the cache files /*{{{*/
// ---------------------------------------------------------------------
/* */