]> git.saurik.com Git - apt.git/blobdiff - cmdline/apt-get.cc
keep not installed garbage packages uninstalled instead of showing
[apt.git] / cmdline / apt-get.cc
index 8efcd0e2e7aa7f5affa9881c2bedb007465e2b73..57065c528960fbee7bd8f4c9425625c38a7fe194 100644 (file)
@@ -538,7 +538,9 @@ bool ShowEssential(ostream &out,CacheFile &Cache)
         //VersionsList += string(Cache[I].CurVersion) + "\n"; ???
         }
       }
-      
+      else
+        continue;
+
       if (I->CurrentVer == 0)
         continue;
 
@@ -1077,8 +1079,6 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
    {
       // force a hashsum for compatibility reasons
       _config->CndSet("Acquire::ForceHash", "md5sum");
-      if (Fetcher.Setup(&Stat, "") == false)
-        return false;
    }
    else if (Fetcher.Setup(&Stat, _config->FindDir("Dir::Cache::Archives")) == false)
       return false;
@@ -1608,10 +1608,6 @@ bool DoAutomaticRemove(CacheFile &Cache)
    if(Debug)
       std::cout << "DoAutomaticRemove()" << std::endl;
 
-   // we don't want to autoremove and we don't want to see it, so why calculating?
-   if (doAutoRemove == false && hideAutoRemove == true)
-      return true;
-
    if (doAutoRemove == true &&
        _config->FindB("APT::Get::Remove",true) == false)
    {
@@ -1622,7 +1618,9 @@ bool DoAutomaticRemove(CacheFile &Cache)
 
    bool purgePkgs = _config->FindB("APT::Get::Purge", false);
    bool smallList = (hideAutoRemove == false &&
-       strcasecmp(_config->Find("APT::Get::HideAutoRemove","").c_str(),"small") == 0);
+               strcasecmp(_config->Find("APT::Get::HideAutoRemove","").c_str(),"small") == 0) ||
+       // we don't want to autoremove and we don't want to see it, so don't generate lists
+       (doAutoRemove == false && hideAutoRemove == true);
 
    string autoremovelist, autoremoveversions;
    unsigned long autoRemoveCount = 0;
@@ -1645,8 +1643,12 @@ bool DoAutomaticRemove(CacheFile &Cache)
         }
         else
         {
+           // if the package is a new install and already garbage we don't need to
+           // install it in the first place, so nuke it instead of show it
+           if (Cache[Pkg].Install() == true && Pkg.CurrentVer() == 0)
+              Cache->MarkDelete(Pkg, false);
            // only show stuff in the list that is not yet marked for removal
-           if(Cache[Pkg].Delete() == false) 
+           else if(Cache[Pkg].Delete() == false) 
            {
               ++autoRemoveCount;
               // we don't need to fill the strings if we don't need them
@@ -1659,6 +1661,20 @@ bool DoAutomaticRemove(CacheFile &Cache)
         }
       }
    }
+
+   // Now see if we had destroyed anything (if we had done anything)
+   if (Cache->BrokenCount() != 0)
+   {
+      c1out << _("Hmm, seems like the AutoRemover destroyed something which really\n"
+                "shouldn't happen. Please file a bug report against apt.") << endl;
+      c1out << endl;
+      c1out << _("The following information may help to resolve the situation:") << endl;
+      c1out << endl;
+      ShowBroken(c1out,Cache,false);
+
+      return _error->Error(_("Internal Error, AutoRemover broke stuff"));
+   }
+
    // if we don't remove them, we should show them!
    if (doAutoRemove == false && (autoremovelist.empty() == false || autoRemoveCount != 0))
    {
@@ -1671,18 +1687,6 @@ bool DoAutomaticRemove(CacheFile &Cache)
                  "%lu packages were automatically installed and are no longer required.\n", autoRemoveCount), autoRemoveCount);
       c1out << _("Use 'apt-get autoremove' to remove them.") << std::endl;
    }
-   // Now see if we had destroyed anything (if we had done anything)
-   else if (Cache->BrokenCount() != 0)
-   {
-      c1out << _("Hmm, seems like the AutoRemover destroyed something which really\n"
-                "shouldn't happen. Please file a bug report against apt.") << endl;
-      c1out << endl;
-      c1out << _("The following information may help to resolve the situation:") << endl;
-      c1out << endl;
-      ShowBroken(c1out,Cache,false);
-
-      return _error->Error(_("Internal Error, AutoRemover broke stuff"));
-   }
    return true;
 }
                                                                        /*}}}*/