summaryrefslogtreecommitdiff
path: root/cmdline/apt-get.cc
diff options
context:
space:
mode:
Diffstat (limited to 'cmdline/apt-get.cc')
-rw-r--r--cmdline/apt-get.cc59
1 files changed, 34 insertions, 25 deletions
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index 9096f263f..49ac8f2cf 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -1684,8 +1684,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)
@@ -1709,33 +1710,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);