summaryrefslogtreecommitdiff
path: root/apt-pkg/depcache.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2024-05-16 13:41:48 +0000
committerDavid Kalnischkies <david@kalnischkies.de>2024-05-16 20:12:51 +0000
commitb1c3039dae19553bff19615fbb4d116aeaa644a7 (patch)
tree3030b6e96764f1c090c89f29a9d51ff23bec8a24 /apt-pkg/depcache.cc
parent15f7214fa2144eeff5ada93e680acd368e9e763a (diff)
Do not mark new if we have already installed providers
The test is actually documenting another bug hidden a bit by this one as we do not need to install a NEW package in this situation as the upgrade needing it was kept back, but it was protected from considering it to be autoremoveable as all providers tend to be considered protected, but by limiting us to installed providers if we have some we can drag those new packages out of hiding. Now, we "just" have to get right of the NEW package in a next step.
Diffstat (limited to 'apt-pkg/depcache.cc')
-rw-r--r--apt-pkg/depcache.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index 72cbf8dcc..4e8f5222a 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -2455,6 +2455,25 @@ static bool MarkPackage(pkgCache::PkgIterator const &Pkg,
if (not unsatisfied_choice)
fullyExplored[T->ID] = true;
+
+ // do not follow newly installed providers if we have already installed providers
+ if (providers_by_source.size() >= 2)
+ {
+ if (std::any_of(providers_by_source.begin(), providers_by_source.end(), [](auto const PV) {
+ return std::any_of(PV.second.begin(), PV.second.end(), [](auto const &Prv) {
+ auto const PP = Prv.ParentPkg();
+ return not PP.end() && PP->CurrentVer != 0;
+ });}))
+ {
+ for (auto &providers : providers_by_source)
+ providers.second.erase(std::remove_if(providers.second.begin(), providers.second.end(),
+ [](auto const &Prv) {
+ auto const PP = Prv.ParentPkg();
+ return not PP.end() && PP->CurrentVer == 0;
+ }), providers.second.end());
+ }
+ }
+
for (auto const &providers : providers_by_source)
{
for (auto const &PV : providers.second)