Explorar el Código

* cleanups, documentation updates (don't show any debug output if no Debug::pkgAutomaticRemove was set, don't remove if not APT::Get::AutomaticRemove (--automatic-remove) was set)

Michael Vogt hace 21 años
padre
commit
120365cee2
Se han modificado 5 ficheros con 18 adiciones y 10 borrados
  1. 5 2
      apt-pkg/algorithms.cc
  2. 4 2
      apt-pkg/depcache.cc
  3. 5 4
      cmdline/apt-get.cc
  4. 1 1
      configure.in
  5. 3 1
      doc/examples/configure-index

+ 5 - 2
apt-pkg/algorithms.cc

@@ -1066,7 +1066,10 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
    pkgCache::PkgIterator I = Cache.PkgBegin();
    for (;I.end() != true; I++) {
       if (Cache[I].NewInstall() && !(Flags[I->ID] & PreInstalled)) {
-	 std::cout << "Resolve installed new pkg: " << I.Name() << " (now marking it as auto)" << std::endl;
+	 if(_config->FindI("Debug::pkgAutoRemove",false)) {
+	    std::clog << "Resolve installed new pkg: " << I.Name() 
+		      << " (now marking it as auto)" << std::endl;
+	 }
 	 Cache[I].Flags |= pkgCache::Flag::Auto;
       }
    }
@@ -1333,7 +1336,7 @@ bool pkgMarkUsed(pkgDepCache &Cache)
    if(_config->FindI("Debug::pkgAutoRemove",false) == true)
      for (pkgCache::PkgIterator Pkg = Cache.PkgBegin(); ! Pkg.end(); ++Pkg)
         if(!Cache[Pkg].Dirty() && Cache[Pkg].AutomaticRemove > 0)
-  	   std::cout << "has auto-remove information: " << Pkg.Name() 
+  	   std::clog << "has auto-remove information: " << Pkg.Name() 
 	 	     << " " << (int)Cache[Pkg].AutomaticRemove 
 		     << std::endl;
 

+ 4 - 2
apt-pkg/depcache.cc

@@ -20,6 +20,8 @@
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/tagfile.h>
+
+#include <iostream>
 #include <sstream>    
 #include <apti18n.h>    
 									/*}}}*/
@@ -162,7 +164,8 @@ bool pkgDepCache::writeStateFile(OpProgress *prog)
 
       // check if we have new information
       if(PkgState[pkg->ID].Flags & pkgCache::Flag::Auto) {
-	 std::cout << "pkg: " << pkg.Name() << " is auto-dep" << std::endl;
+	 if(_config->FindI("Debug::pkgAutoRemove",false))
+	    std::clog << "pkg: " << pkg.Name() << " is auto-dep" << std::endl;
 	 PkgState[pkg->ID].AutomaticRemove = pkgCache::State::RemoveRequired;
       }
 
@@ -172,7 +175,6 @@ bool pkgDepCache::writeStateFile(OpProgress *prog)
 	      << "\nRemove-Reason: "
 	      << (int)(PkgState[pkg->ID].AutomaticRemove) << "\n\n";
 	 StateFile.Write(ostr.str().c_str(), ostr.str().size());
-	 //std::cout << "Writing auto-mark: " << ostr.str() << endl;
       }
    }
    return true;

+ 5 - 4
cmdline/apt-get.cc

@@ -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 "
@@ -1597,10 +1598,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 +2523,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},

+ 1 - 1
configure.in

@@ -18,7 +18,7 @@ AC_CONFIG_AUX_DIR(buildlib)
 AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in)
 
 dnl -- SET THIS TO THE RELEASE VERSION --
-AC_DEFINE_UNQUOTED(VERSION,"0.6.38")
+AC_DEFINE_UNQUOTED(VERSION,"0.6.39")
 PACKAGE="apt"
 AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE")
 AC_SUBST(PACKAGE)

+ 3 - 1
doc/examples/configure-index

@@ -29,6 +29,7 @@ APT
   Get 
   {
      Arch-Only "false";
+     AutomaticRemove "false";       
      Download-Only "false";
      Simulate "false";
      Assume-Yes "false";
@@ -235,7 +236,8 @@ Debug
   pkgAcquire::Worker "false";
   pkgDPkgPM "false";
   pkgOrderList "false";
-  
+  pkgAutoRemove "false";   // show information about automatic removes
+
   pkgInitialize "false";   // This one will dump the configuration space
   NoLocking "false";
   Acquire::Ftp "false";    // Show ftp command traffic