]> git.saurik.com Git - apt.git/commitdiff
* merged from the auto-install branch
authorMichael Vogt <michael.vogt@ubuntu.com>
Wed, 6 Sep 2006 17:25:51 +0000 (19:25 +0200)
committerMichael Vogt <michael.vogt@ubuntu.com>
Wed, 6 Sep 2006 17:25:51 +0000 (19:25 +0200)
cmdline/apt-get.cc
debian/apt.conf.autoremove [new file with mode: 0644]
debian/apt.dirs
debian/rules
methods/http.cc

index 4bd66383f6bc91c40790167bc92a24adb4ea9f4b..7b70de3bd8bd768a6e986dffbbb0bc8285510f26 100644 (file)
@@ -1419,31 +1419,42 @@ bool DoUpdate(CommandLine &CmdL)
 /* Remove unused automatic packages */
 bool DoAutomaticRemove(CacheFile &Cache)
 {
-   if(_config->FindI("Debug::pkgAutoRemove",false))
+   bool Debug = _config->FindI("Debug::pkgAutoRemove",false);
+   pkgDepCache::ActionGroup group(*Cache);
+
+   if(Debug)
       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 "
                             "start AutoRemover"));
 
+   string autoremovelist, autoremoveversions;
+   // look over the cache to see what can be removed
+   for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); ! Pkg.end(); ++Pkg)
    {
-     pkgDepCache::ActionGroup group(*Cache);
-
-     // look over the cache to see what can be removed
-     for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); ! Pkg.end(); ++Pkg)
-       {
-        if (Cache[Pkg].Garbage)
-          {
-            if(Pkg.CurrentVer() != 0 || Cache[Pkg].Install())
-              fprintf(stdout,"We could delete %s\n", Pkg.Name());
-
-            if(Pkg.CurrentVer() != 0 && Pkg->CurrentState != pkgCache::State::ConfigFiles)
+      if (Cache[Pkg].Garbage)
+      {
+        if(Pkg.CurrentVer() != 0 || Cache[Pkg].Install())
+           if(Debug)
+              std::cout << "We could delete %s" <<  Pkg.Name() << std::endl;
+          
+        autoremovelist += string(Pkg.Name()) + " ";
+        autoremoveversions += string(Cache[Pkg].CandVersion) + " ";
+        if (_config->FindB("APT::Get::AutomaticRemove")) 
+        {
+           if(Pkg.CurrentVer() != 0 && 
+              Pkg->CurrentState != pkgCache::State::ConfigFiles)
               Cache->MarkDelete(Pkg, _config->FindB("APT::Get::Purge", false));
-            else
+           else
               Cache->MarkKeep(Pkg, false, false);
-          }
-       }
+        }
+      }
    }
+   ShowList(c1out, _("The following packages where automatically installed and are no longer required:"), autoremovelist, autoremoveversions);
+   if (!_config->FindB("APT::Get::AutomaticRemove") && 
+       autoremovelist.size() > 0)
+      c1out << _("Use 'apt-get autoremove' to remove them.") << std::endl;
 
    // Now see if we destroyed anything
    if (Cache->BrokenCount() != 0)
@@ -1659,10 +1670,8 @@ bool DoInstall(CommandLine &CmdL)
         return _error->Error(_("Broken packages"));
       }   
    }
-   if (_config->FindB("APT::Get::AutomaticRemove")) {
-      if (!DoAutomaticRemove(Cache)) 
+   if (!DoAutomaticRemove(Cache)) 
         return false;
-   }
 
    /* Print out a list of packages that are going to be installed extra
       to what the user asked */
diff --git a/debian/apt.conf.autoremove b/debian/apt.conf.autoremove
new file mode 100644 (file)
index 0000000..98143ce
--- /dev/null
@@ -0,0 +1,8 @@
+APT
+{
+  NeverAutoRemove  
+  { 
+       "^linux-image.*";  
+       "^linux-restricted-modules.*";
+  };
+};
index e1cb738fafa6063f7cb9d9cdf74ce25f1b46a7d9..1543e8bb1944727b36cb782e5637b48bed64c788 100644 (file)
@@ -2,6 +2,7 @@ usr/bin
 usr/lib/apt/methods
 usr/lib/dpkg/methods/apt
 etc/apt
+etc/apt/apt.conf.d
 etc/apt/sources.list.d
 var/cache/apt/archives/partial
 var/lib/apt/lists/partial
index 333d4ad5b802fe935a26e768d2c3b36ccaf7592f..ffc23402ece74a6758e21cf73ee21cefc57a0bf3 100755 (executable)
@@ -211,7 +211,7 @@ apt: build debian/shlibs.local
        cp debian/bugscript debian/$@/usr/share/bug/apt/script
 
        cp share/ubuntu-archive.gpg debian/$@/usr/share/$@
-
+       cp debian/apt.conf.autoremove debian/$@/etc/apt/apt.conf.d/01autoremove
 #      head -n 500 ChangeLog > debian/ChangeLog
 
        # make rosetta happy and remove pot files in po/ (but leave stuff
index 09dab81881469c48280f45833c3ecdbfe810ceca..1833f41efdbaf692213e9a926719ab20d1f43832 100644 (file)
@@ -657,7 +657,7 @@ void HttpMethod::SendReq(FetchItem *Itm,CircleBuf &Out)
       will glitch HTTP/1.0 proxies because they do not filter it out and 
       pass it on, HTTP/1.1 says the connection should default to keep alive
       and we expect the proxy to do this */
-   if (Proxy.empty() == true)
+   if (Proxy.empty() == true || Proxy.Host.empty())
       sprintf(Buf,"GET %s HTTP/1.1\r\nHost: %s\r\nConnection: keep-alive\r\n",
              QuoteString(Uri.Path,"~").c_str(),ProperHost.c_str());
    else