From 472ff00ef2e48383805d281c6364ec27839e3f4d Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 19 Sep 2011 19:14:19 +0200 Subject: use forward declaration in headers if possible instead of includes --- cmdline/acqprogress.h | 4 +++- cmdline/apt-cache.cc | 6 +++++- cmdline/apt-cdrom.cc | 2 ++ cmdline/apt-config.cc | 1 + cmdline/apt-dump-solver.cc | 1 + cmdline/apt-extracttemplates.cc | 1 + cmdline/apt-get.cc | 5 +++++ cmdline/apt-internal-solver.cc | 2 ++ cmdline/apt-mark.cc | 1 + cmdline/apt-sortpkgs.cc | 2 ++ 10 files changed, 23 insertions(+), 2 deletions(-) (limited to 'cmdline') diff --git a/cmdline/acqprogress.h b/cmdline/acqprogress.h index 48f90ae59..8f0903923 100644 --- a/cmdline/acqprogress.h +++ b/cmdline/acqprogress.h @@ -12,6 +12,8 @@ #include +#include + class AcqTextStatus : public pkgAcquireStatus { unsigned int &ScreenWidth; @@ -21,7 +23,7 @@ class AcqTextStatus : public pkgAcquireStatus public: - virtual bool MediaChange(string Media,string Drive); + virtual bool MediaChange(std::string Media,std::string Drive); virtual void IMSHit(pkgAcquire::ItemDesc &Itm); virtual void Fetch(pkgAcquire::ItemDesc &Itm); virtual void Done(pkgAcquire::ItemDesc &Itm); diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc index a4cdf784e..82a31c9b1 100644 --- a/cmdline/apt-cache.cc +++ b/cmdline/apt-cache.cc @@ -16,7 +16,6 @@ #include #include -#include #include #include #include @@ -24,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -31,6 +31,9 @@ #include #include #include +#include +#include +#include #include #include @@ -40,6 +43,7 @@ #include #include #include +#include #include /*}}}*/ diff --git a/cmdline/apt-cdrom.cc b/cmdline/apt-cdrom.cc index 8608b1215..fa48debcd 100644 --- a/cmdline/apt-cdrom.cc +++ b/cmdline/apt-cdrom.cc @@ -23,6 +23,8 @@ #include #include #include +#include +#include #include #include diff --git a/cmdline/apt-config.cc b/cmdline/apt-config.cc index df2958975..94f6ee9b0 100644 --- a/cmdline/apt-config.cc +++ b/cmdline/apt-config.cc @@ -24,6 +24,7 @@ #include #include #include +#include #include #include diff --git a/cmdline/apt-dump-solver.cc b/cmdline/apt-dump-solver.cc index dab0cc6fd..e82e15c6e 100644 --- a/cmdline/apt-dump-solver.cc +++ b/cmdline/apt-dump-solver.cc @@ -12,6 +12,7 @@ #include #include +#include /*}}}*/ // ShowHelp - Show a help screen /*{{{*/ diff --git a/cmdline/apt-extracttemplates.cc b/cmdline/apt-extracttemplates.cc index 5d7b76c23..d5c1a3208 100644 --- a/cmdline/apt-extracttemplates.cc +++ b/cmdline/apt-extracttemplates.cc @@ -30,6 +30,7 @@ #include #include #include +#include #include #include diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index d8f207f0a..5e950332f 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -44,6 +45,10 @@ #include #include #include +#include +#include +#include +#include #include "acqprogress.h" diff --git a/cmdline/apt-internal-solver.cc b/cmdline/apt-internal-solver.cc index ef6c688fe..1b636e4d5 100644 --- a/cmdline/apt-internal-solver.cc +++ b/cmdline/apt-internal-solver.cc @@ -11,10 +11,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include diff --git a/cmdline/apt-mark.cc b/cmdline/apt-mark.cc index 8c9a47913..339cbdf44 100644 --- a/cmdline/apt-mark.cc +++ b/cmdline/apt-mark.cc @@ -13,6 +13,7 @@ #include #include #include +#include #include diff --git a/cmdline/apt-sortpkgs.cc b/cmdline/apt-sortpkgs.cc index 44b74cf6c..20ae14f2a 100644 --- a/cmdline/apt-sortpkgs.cc +++ b/cmdline/apt-sortpkgs.cc @@ -20,6 +20,8 @@ #include #include #include +#include +#include #include #include -- cgit v1.2.3 From 81ce578199d8fa83283fc6b1e759acafaee7fbf0 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 20 Sep 2011 13:27:53 +0200 Subject: * cmdline/apt-get.cc: - follow Provides in the evaluation of saving candidates, too, for statisfying garbage package dependencies (Closes: #640590) --- cmdline/apt-get.cc | 59 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 25 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 5e950332f..88e734697 100644 --- a/cmdline/apt-get.cc +++ b/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); -- cgit v1.2.3