From: Michael Vogt <michael.vogt@ubuntu.com>
Date: Thu, 30 Jun 2005 13:34:32 +0000 (+0000)
Subject: * slighly more debug output, renamed "--automatic-remove" to "--auto-remove"
X-Git-Tag: 0.7.24ubuntu1~254^2~10
X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/f8ac1720a94468d1384e88a57729e6d9801b56fd

* slighly more debug output, renamed "--automatic-remove" to "--auto-remove"
---

diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index 8626d33dc..3978e7561 100644
--- a/apt-pkg/algorithms.cc
+++ b/apt-pkg/algorithms.cc
@@ -1353,6 +1353,11 @@ bool pkgMarkUsed(pkgDepCache &Cache, InRootSetFunc func)
    {
       Cache[p].Marked=false;
       Cache[p].Garbage=false;
+
+      // debug output
+      if(_config->FindB("Debug::pkgAutoRemove",false) 
+	 && Cache[p].Flags & pkgCache::Flag::Auto)
+  	 std::clog << "AutoDep: " << p.Name() << std::endl;
    }
 
    // init vars
@@ -1412,14 +1417,13 @@ bool pkgMarkUsed(pkgDepCache &Cache, InRootSetFunc func)
   {
      pkgDepCache::StateCache &state=Cache[p];
 
-     if(!state.Marked)
+     // if it is not marked and it is installed, it's garbage 
+     if(!state.Marked && !p.CurrentVer().end())
      {
-	// mark installed but not yet marked stuff as garbage
-	if(p->CurrentVer != 0) {
-	   state.Garbage=true;
+	state.Garbage=true;
+	if(_config->FindB("Debug::pkgAutoRemove",false))
 	   std::cout << "Garbage: " << p.Name() << std::endl;
-	}
-
+     
 #if 0   // mvo: the below bits still needs to be ported
 
 	// Be sure not to re-delete already deleted packages.
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index 81c79d812..9adc4e390 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -127,7 +127,7 @@ bool pkgDepCache::readStateFile(OpProgress *Prog)
 	 if(!pkg.end() && !pkg.VersionList().end()) {
 	    short reason = section.FindI("Auto-Installed", 0);
 	    if(reason > 0)
-	       PkgState[pkg->ID].Flags  |= pkgCache::Flag::Auto;
+	       PkgState[pkg->ID].Flags  |= Flag::Auto;
 	    if(_config->FindB("Debug::pkgAutoRemove",false))
 	       std::cout << "Auto-Installed : " << pkgname << std::endl;
 	    amt+=section.size();
@@ -159,7 +159,7 @@ bool pkgDepCache::writeStateFile(OpProgress *prog)
    std::ostringstream ostr;
    for(pkgCache::PkgIterator pkg=Cache->PkgBegin(); !pkg.end();pkg++) {
 
-      if(PkgState[pkg->ID].Flags & pkgCache::Flag::Auto) {
+      if(PkgState[pkg->ID].Flags & Flag::Auto) {
 	 if(_config->FindB("Debug::pkgAutoRemove",false))
 	    std::clog << "AutoInstal: " << pkg.Name() << std::endl;
 	 ostr.str(string(""));
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index 9d97f8756..cb8fc7724 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -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,"automatic-remove","APT::Get::AutomaticRemove",0},
+      {0,"auto-remove","APT::Get::AutomaticRemove",0},
       {0,"allow-unauthenticated","APT::Get::AllowUnauthenticated",0},
       {'c',"config-file",0,CommandLine::ConfigFile},
       {'o',"option",0,CommandLine::ArbItem},