diff options
author | David Kalnischkies <david@kalnischkies.de> | 2021-03-06 14:12:01 +0100 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2021-04-25 16:25:57 +0200 |
commit | f90b892e6acc0ca725811ef0dd9be3fed66c444f (patch) | |
tree | c018dde822d51d8d624216eecf0c08d122be7850 /cmdline | |
parent | 408f4e0d32d11d3f7b7ec0e27fe8cf73cad23a6c (diff) |
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
Diffstat (limited to 'cmdline')
-rw-r--r-- | cmdline/apt-get.cc | 9 |
1 files changed, 7 insertions, 2 deletions
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 /*{{{*/ |