]> git.saurik.com Git - apt.git/blobdiff - cmdline/apt-get.cc
* use mark-and-sweep from aptitude now as GC algorithm
[apt.git] / cmdline / apt-get.cc
index 3bafd42ba07c8aa9efb88270a1a321a359477b56..9d97f8756eb9abf5f91e6ef9100bcba426891267 100644 (file)
@@ -1361,7 +1361,8 @@ bool DoUpdate(CommandLine &CmdL)
 /* Remove unused automatic packages */
 bool DoAutomaticRemove(CacheFile &Cache)
 {
-   std::cout << "DoAutomaticRemove()" << std::endl;
+   if(_config->FindI("Debug::pkgAutoRemove",false))
+      std::cout << "DoAutomaticRemove()" << std::endl;
 
    if (_config->FindB("APT::Get::Remove",true) == false)
       return _error->Error(_("We are not supposed to delete stuff, can't "
@@ -1373,12 +1374,11 @@ bool DoAutomaticRemove(CacheFile &Cache)
    // look over the cache to see what can be removed
    for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); ! Pkg.end(); ++Pkg)
    {
-      if (! Cache[Pkg].Dirty() &&
+      if (Cache[Pkg].Garbage &&
           (Pkg->CurrentVer != 0 && Cache[Pkg].Install() == false && 
           Cache[Pkg].Delete() == false))
       {
-         fprintf(stdout,"We could delete %s %d\n", 
-                Pkg.Name(), Cache[Pkg].AutomaticRemove);
+         fprintf(stdout,"We could delete %s\n", Pkg.Name());
          Cache->MarkDelete(Pkg,_config->FindB("APT::Get::Purge",false));
       }
    }
@@ -1597,10 +1597,10 @@ bool DoInstall(CommandLine &CmdL)
       return _error->Error(_("Broken packages"));
    }   
    
-   //if (_config->FindB("APT::Get::AutomaticRemove")) {
+   if (_config->FindB("APT::Get::AutomaticRemove")) {
       if (!DoAutomaticRemove(Cache)) 
         return false;
-   //}
+   }
 
    /* Print out a list of packages that are going to be installed extra
       to what the user asked */
@@ -2522,7 +2522,7 @@ int main(int argc,const char *argv[])
       {0,"remove","APT::Get::Remove",0},
       {0,"only-source","APT::Get::Only-Source",0},
       {0,"arch-only","APT::Get::Arch-Only",0},
-      {0,"experimental-automatic-remove","APT::Get::AutomaticRemove",0},
+      {0,"automatic-remove","APT::Get::AutomaticRemove",0},
       {0,"allow-unauthenticated","APT::Get::AllowUnauthenticated",0},
       {'c',"config-file",0,CommandLine::ConfigFile},
       {'o',"option",0,CommandLine::ArbItem},