From f90b892e6acc0ca725811ef0dd9be3fed66c444f Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 6 Mar 2021 14:12:01 +0100 Subject: Count uninstallable packages in "not upgraded" If a first step of the solver can figure out that a package is uninstallable it might reset the candidate so that later steps are prevented from exploring this dead end. While that helps the resolver it can confuse the display of the found solution as this will include an incorrect count of packages not upgraded in this solution. It was possible before, but happens a fair bit more with the April/May resolver changes last year so finally doing proper counting is a good idea. Sadly this is a bit harder than just getting the number first and than subtracting the packages we upgraded from it as the user can influence candidates via the command line and a package which could be upgraded, but is removed instead shouldn't count as not upgraded as we clearly did something with it. So we keep a list of packages instead of a number which also help in the upgrade cmds as those want to show the list. Closes: #981535 --- cmdline/apt-get.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index efb5cfd73..010021991 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -206,8 +206,13 @@ static bool DoDSelectUpgrade(CommandLine &) ShowBroken(c1out,Cache,false); return _error->Error(_("Internal error, problem resolver broke stuff")); } - - return InstallPackages(Cache,false); + + APT::PackageVector HeldBackPackages; + for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); not Pkg.end(); ++Pkg) + if (Pkg->CurrentVer != 0 && Cache[Pkg].Upgradable() && not Cache[Pkg].Upgrade() && not Cache[Pkg].Delete()) + HeldBackPackages.push_back(Pkg); + + return InstallPackages(Cache, HeldBackPackages, false); } /*}}}*/ // DoCheck - Perform the check operation /*{{{*/ -- cgit v1.2.3-70-g09d2