From 4fe19044a7102f20c62f2f223d5624106f50ddb6 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 13 Sep 2011 17:39:57 +0200 Subject: * cmdline/apt-get.cc: - output list of virtual package providers to c1out in -q=1 instead of /dev/null to unbreak sbuild (LP: #816155) --- cmdline/apt-get.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 69b9dcda9..9096f263f 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -657,22 +657,22 @@ public: pkgCache::PkgIterator Pkg = I.OwnerPkg(); if (Cache[Pkg].CandidateVerIter(Cache) == I.OwnerVer()) { - out << " " << Pkg.FullName(true) << " " << I.OwnerVer().VerStr(); + c1out << " " << Pkg.FullName(true) << " " << I.OwnerVer().VerStr(); if (Cache[Pkg].Install() == true && Cache[Pkg].NewInstall() == false) - out << _(" [Installed]"); - out << endl; + c1out << _(" [Installed]"); + c1out << endl; ++provider; } } // if we found no candidate which provide this package, show non-candidates if (provider == 0) for (I = Pkg.ProvidesList(); I.end() == false; ++I) - out << " " << I.OwnerPkg().FullName(true) << " " << I.OwnerVer().VerStr() + c1out << " " << I.OwnerPkg().FullName(true) << " " << I.OwnerVer().VerStr() << _(" [Not candidate version]") << endl; else out << _("You should explicitly select one to install.") << endl; } else { - ioprintf(out, + ioprintf(c1out, _("Package %s is not available, but is referred to by another package.\n" "This may mean that the package is missing, has been obsoleted, or\n" "is only available from another source\n"),Pkg.FullName(true).c_str()); @@ -691,9 +691,9 @@ public: List += Dep.ParentPkg().FullName(true) + " "; //VersionsList += string(Dep.ParentPkg().CurVersion) + "\n"; ??? } - ShowList(out,_("However the following packages replace it:"),List,VersionsList); + ShowList(c1out,_("However the following packages replace it:"),List,VersionsList); } - out << std::endl; + c1out << std::endl; } return false; } -- cgit v1.2.3 From 778559db797ce61611e2b761b24dcb49c49f2652 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 20 Sep 2011 14:30:31 +0200 Subject: * apt-pkg/deb/dpkgpm.cc: - 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) * apt-pkg/algorithms.cc: - if a package is garbage, don't try to save it with FixByInstall --- 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 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); -- cgit v1.2.3