summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-08-18 11:45:51 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-08-18 11:45:51 +0200
commit657ecd4a08d5e979a7f66109d371904ec64a2d3d (patch)
treecfce19942524d1068454cbd6817c495772686936 /cmdline
parent178dd062eeaa1d7e56770455e005dc27aa71f026 (diff)
* cmdline/apt-get.cc:
- remove the binary caches in 'apt-get clean' as it is the first thing recommend by many supporters in case of APT segfaults
Diffstat (limited to 'cmdline')
-rw-r--r--cmdline/apt-get.cc20
1 files changed, 15 insertions, 5 deletions
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index 1849f1335..2dd1c2bce 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -2203,10 +2203,14 @@ bool DoDSelectUpgrade(CommandLine &CmdL)
/* */
bool DoClean(CommandLine &CmdL)
{
+ std::string const archivedir = _config->FindDir("Dir::Cache::archives");
+ std::string const pkgcache = _config->FindFile("Dir::cache::pkgcache");
+ std::string const srcpkgcache = _config->FindFile("Dir::cache::srcpkgcache");
+
if (_config->FindB("APT::Get::Simulate") == true)
{
- cout << "Del " << _config->FindDir("Dir::Cache::archives") << "* " <<
- _config->FindDir("Dir::Cache::archives") << "partial/*" << endl;
+ cout << "Del " << archivedir << "* " << archivedir << "partial/*"<< endl
+ << "Del " << pkgcache << " " << srcpkgcache << endl;
return true;
}
@@ -2214,14 +2218,20 @@ bool DoClean(CommandLine &CmdL)
FileFd Lock;
if (_config->FindB("Debug::NoLocking",false) == false)
{
- Lock.Fd(GetLock(_config->FindDir("Dir::Cache::Archives") + "lock"));
+ Lock.Fd(GetLock(archivedir + "lock"));
if (_error->PendingError() == true)
return _error->Error(_("Unable to lock the download directory"));
}
pkgAcquire Fetcher;
- Fetcher.Clean(_config->FindDir("Dir::Cache::archives"));
- Fetcher.Clean(_config->FindDir("Dir::Cache::archives") + "partial/");
+ Fetcher.Clean(archivedir);
+ Fetcher.Clean(archivedir + "partial/");
+
+ if (pkgcache.empty() == false && RealFileExists(pkgcache) == true)
+ unlink(pkgcache.c_str());
+ if (srcpkgcache.empty() == false && RealFileExists(srcpkgcache) == true)
+ unlink(srcpkgcache.c_str());
+
return true;
}
/*}}}*/