]> git.saurik.com Git - apt.git/commitdiff
* cmdline/apt-get.cc:
authorDavid Kalnischkies <kalnischkies@gmail.com>
Thu, 18 Aug 2011 09:45:51 +0000 (11:45 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Thu, 18 Aug 2011 09:45:51 +0000 (11:45 +0200)
  - remove the binary caches in 'apt-get clean' as it is the first
    thing recommend by many supporters in case of APT segfaults

cmdline/apt-get.cc
debian/changelog

index 1849f1335069ccf1e404739e6d6547ddc1397633..2dd1c2bce55ec56182a99ed30ff46902cbd8bb9b 100644 (file)
@@ -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;
 }
                                                                        /*}}}*/
index 56d4c7e0e1d82b297845c95438545294d099fdee..137e3a74056d700745b1ea7eb9a845a15c111332 100644 (file)
@@ -11,8 +11,11 @@ apt (0.8.15.7) UNRELEASED; urgency=low
     - run the test/libapt testcases at package build-time
   * debian/apt.symbols:
     - add the newly added symbols since 0.8.15.3
+  * 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
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Wed, 17 Aug 2011 15:09:16 +0200
+ -- David Kalnischkies <kalnischkies@gmail.com>  Thu, 18 Aug 2011 11:41:31 +0200
 
 apt (0.8.15.6) unstable; urgency=low