From b81238fa02b2348f3fbb90e4d5e54a3ad8d78ac4 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 14 May 2024 21:18:38 +0200 Subject: Adding upstream version 2.9.3. Signed-off-by: Daniel Baumann --- apt-private/private-install.cc | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) (limited to 'apt-private/private-install.cc') diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc index 9a2ed0b..4f71f18 100644 --- a/apt-private/private-install.cc +++ b/apt-private/private-install.cc @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -214,16 +215,6 @@ bool InstallPackages(CacheFile &Cache, APT::PackageVector &HeldBackPackages, boo return false; } - APT::PackageVector PhasingPackages; - APT::PackageVector NotPhasingHeldBackPackages; - for (auto const &Pkg : HeldBackPackages) - { - if (Cache->PhasingApplied(Pkg)) - PhasingPackages.push_back(Pkg); - else - NotPhasingHeldBackPackages.push_back(Pkg); - } - // Show all the various warning indicators if (_config->FindI("APT::Output-Version") < 30) ShowDel(c1out,Cache); @@ -234,6 +225,16 @@ bool InstallPackages(CacheFile &Cache, APT::PackageVector &HeldBackPackages, boo ShowWeakDependencies(Cache); if (ShwKept == true) { + APT::PackageVector PhasingPackages; + APT::PackageVector NotPhasingHeldBackPackages; + for (auto const &Pkg : HeldBackPackages) + { + if (Cache->PhasingApplied(Pkg)) + PhasingPackages.push_back(Pkg); + else + NotPhasingHeldBackPackages.push_back(Pkg); + } + ShowPhasing(c1out, Cache, PhasingPackages); ShowKept(c1out, Cache, NotPhasingHeldBackPackages); if (not PhasingPackages.empty() && not NotPhasingHeldBackPackages.empty()) @@ -620,12 +621,14 @@ bool DoAutomaticRemove(CacheFile &Cache) for (APT::PackageSet::iterator Pkg = tooMuch.begin(); Pkg != tooMuch.end(); ++Pkg) { - APT::PackageSet too; - too.insert(*Pkg); - for (pkgCache::PrvIterator Prv = Cache[Pkg].CandidateVerIter(Cache).ProvidesList(); - Prv.end() == false; ++Prv) - too.insert(Prv.ParentPkg()); - for (APT::PackageSet::const_iterator P = too.begin(); P != too.end(); ++P) + auto const PkgCand = Cache[Pkg].CandidateVerIter(Cache); + if (unlikely(PkgCand.end())) + continue; + std::vector> too; + too.emplace_back(*Pkg, PkgCand.VerStr()); + for (pkgCache::PrvIterator Prv = PkgCand.ProvidesList(); not Prv.end(); ++Prv) + too.emplace_back(Prv.ParentPkg(), Prv.ProvideVersion()); + for (auto const &[P, PVerStr] : too) { for (pkgCache::DepIterator R = P.RevDependsList(); R.end() == false; ++R) @@ -650,6 +653,11 @@ bool DoAutomaticRemove(CacheFile &Cache) } else // ignore dependency from a non-candidate version continue; + if (R->Version != 0) + { + if (not Cache->VS().CheckDep(PVerStr, R->CompareOp, R.TargetVer())) + continue; + } if (Debug == true) std::clog << "Save " << APT::PrettyPkg(Cache, Pkg) << " as another installed package depends on it: " << APT::PrettyPkg(Cache, RP) << std::endl; Cache->MarkInstall(Pkg, false, 0, false); -- cgit v1.2.3