Просмотр исходного кода

* cmdline/apt-get.cc:
- follow Provides in the evaluation of saving candidates, too, for
statisfying garbage package dependencies (Closes: #640590)

David Kalnischkies лет назад: 15
Родитель
Сommit
81ce578199
2 измененных файлов с 38 добавлено и 26 удалено
  1. 34 25
      cmdline/apt-get.cc
  2. 4 1
      debian/changelog

+ 34 - 25
cmdline/apt-get.cc

@@ -1689,8 +1689,9 @@ bool DoAutomaticRemove(CacheFile &Cache)
 	    // install it in the first place, so nuke it instead of show it
 	    if (Cache[Pkg].Install() == true && Pkg.CurrentVer() == 0)
 	    {
+	       if (Pkg.CandVersion() != 0)
+	          tooMuch.insert(Pkg);
 	       Cache->MarkDelete(Pkg, false);
-	       tooMuch.insert(Pkg);
 	    }
 	    // only show stuff in the list that is not yet marked for removal
 	    else if(hideAutoRemove == false && Cache[Pkg].Delete() == false) 
@@ -1714,33 +1715,41 @@ bool DoAutomaticRemove(CacheFile &Cache)
       bool Changed;
       do {
 	 Changed = false;
-	 for (APT::PackageSet::const_iterator P = tooMuch.begin();
-	      P != tooMuch.end() && Changed == false; ++P)
+	 for (APT::PackageSet::const_iterator Pkg = tooMuch.begin();
+	      Pkg != tooMuch.end() && Changed == false; ++Pkg)
 	 {
-	    for (pkgCache::DepIterator R = P.RevDependsList();
-		 R.end() == false; ++R)
-	    {
-	       if (R.IsNegative() == true ||
-		   Cache->IsImportantDep(R) == false)
-		  continue;
-	       pkgCache::PkgIterator N = R.ParentPkg();
-	       if (N.end() == true || (N->CurrentVer == 0 && (*Cache)[N].Install() == false))
-		  continue;
-	       if (Debug == true)
-		  std::clog << "Save " << P << " as another installed garbage package depends on it" << std::endl;
-	       Cache->MarkInstall(P, false);
-	       if(hideAutoRemove == false)
+	    APT::PackageSet too;
+	    too.insert(Pkg);
+	    for (pkgCache::PrvIterator Prv = Cache[Pkg].CandidateVerIter(Cache).ProvidesList();
+		 Prv.end() == false; ++Prv)
+	       too.insert(Prv.ParentPkg());
+	    for (APT::PackageSet::const_iterator P = too.begin();
+		 P != too.end() && Changed == false; ++P) {
+	       for (pkgCache::DepIterator R = P.RevDependsList();
+		    R.end() == false; ++R)
 	       {
-		  ++autoRemoveCount;
-		  if (smallList == false)
-		  {
-		     autoremovelist += P.FullName(true) + " ";
-		     autoremoveversions += string(Cache[P].CandVersion) + "\n";
-		  }
+		  if (R.IsNegative() == true ||
+		      Cache->IsImportantDep(R) == false)
+		     continue;
+		 pkgCache::PkgIterator N = R.ParentPkg();
+		 if (N.end() == true || (N->CurrentVer == 0 && (*Cache)[N].Install() == false))
+		    continue;
+		 if (Debug == true)
+		    std::clog << "Save " << Pkg << " as another installed garbage package depends on it" << std::endl;
+		 Cache->MarkInstall(Pkg, false);
+		 if (hideAutoRemove == false)
+		 {
+		    ++autoRemoveCount;
+		    if (smallList == false)
+		    {
+		       autoremovelist += Pkg.FullName(true) + " ";
+		       autoremoveversions += string(Cache[Pkg].CandVersion) + "\n";
+		    }
+		 }
+		 tooMuch.erase(Pkg);
+		 Changed = true;
+		 break;
 	       }
-	       tooMuch.erase(P);
-	       Changed = true;
-	       break;
 	    }
 	 }
       } while (Changed == true);

+ 4 - 1
debian/changelog

@@ -8,8 +8,11 @@ apt (0.8.16~exp7) experimental; urgency=low
     - use std::vector instead of fixed size arrays to store args and
       multiarch-packagename strings
     - load the dpkg base arguments only one time and reuse them later
+  * cmdline/apt-get.cc:
+    - follow Provides in the evaluation of saving candidates, too, for
+      statisfying garbage package dependencies (Closes: #640590)
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Tue, 20 Sep 2011 11:50:31 +0200
+ -- David Kalnischkies <kalnischkies@gmail.com>  Tue, 20 Sep 2011 13:25:31 +0200
 
 apt (0.8.16~exp6) experimental; urgency=low