Quellcode durchsuchen

* merged from the auto-install branch

Michael Vogt vor 20 Jahren
Ursprung
Commit
59e4486eb6
5 geänderte Dateien mit 38 neuen und 20 gelöschten Zeilen
  1. 27 18
      cmdline/apt-get.cc
  2. 8 0
      debian/apt.conf.autoremove
  3. 1 0
      debian/apt.dirs
  4. 1 1
      debian/rules
  5. 1 1
      methods/http.cc

+ 27 - 18
cmdline/apt-get.cc

@@ -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 */

+ 8 - 0
debian/apt.conf.autoremove

@@ -0,0 +1,8 @@
+APT
+{
+  NeverAutoRemove  
+  { 
+	"^linux-image.*";  
+	"^linux-restricted-modules.*";
+  };
+};

+ 1 - 0
debian/apt.dirs

@@ -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

+ 1 - 1
debian/rules

@@ -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

+ 1 - 1
methods/http.cc

@@ -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