summaryrefslogtreecommitdiff
path: root/apt-private/private-upgrade.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2021-03-06 14:12:01 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2021-04-25 16:25:57 +0200
commitf90b892e6acc0ca725811ef0dd9be3fed66c444f (patch)
treec018dde822d51d8d624216eecf0c08d122be7850 /apt-private/private-upgrade.cc
parent408f4e0d32d11d3f7b7ec0e27fe8cf73cad23a6c (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 'apt-private/private-upgrade.cc')
-rw-r--r--apt-private/private-upgrade.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/apt-private/private-upgrade.cc b/apt-private/private-upgrade.cc
index c41e4d2f3..3423db525 100644
--- a/apt-private/private-upgrade.cc
+++ b/apt-private/private-upgrade.cc
@@ -2,6 +2,7 @@
#include <config.h>
#include <apt-pkg/cmndline.h>
+#include <apt-pkg/cacheset.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/error.h>
#include <apt-pkg/upgrade.h>
@@ -28,13 +29,14 @@ static bool UpgradeHelper(CommandLine &CmdL, int UpgradeFlags)
std::map<unsigned short, APT::VersionSet> verset;
std::set<std::string> UnknownPackages;
- if (!DoCacheManipulationFromCommandLine(CmdL, VolatileCmdL, Cache, verset, UpgradeFlags, UnknownPackages))
+ APT::PackageVector HeldBackPackages;
+ if (not DoCacheManipulationFromCommandLine(CmdL, VolatileCmdL, Cache, verset, UpgradeFlags, UnknownPackages, HeldBackPackages))
{
RunJsonHook("AptCli::Hooks::Upgrade", "org.debian.apt.hooks.install.fail", CmdL.FileList, Cache, UnknownPackages);
return false;
}
RunJsonHook("AptCli::Hooks::Upgrade", "org.debian.apt.hooks.install.pre-prompt", CmdL.FileList, Cache);
- if (InstallPackages(Cache, true, true, true, "AptCli::Hooks::Upgrade", CmdL))
+ if (InstallPackages(Cache, HeldBackPackages, true, true, true, "AptCli::Hooks::Upgrade", CmdL))
return RunJsonHook("AptCli::Hooks::Upgrade", "org.debian.apt.hooks.install.post", CmdL.FileList, Cache);
else
return RunJsonHook("AptCli::Hooks::Upgrade", "org.debian.apt.hooks.install.fail", CmdL.FileList, Cache);