From b1c3039dae19553bff19615fbb4d116aeaa644a7 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 16 May 2024 13:41:48 +0000 Subject: 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. --- apt-pkg/depcache.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'apt-pkg') 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) -- cgit v1.2.3-70-g09d2