summaryrefslogtreecommitdiffstats
path: root/apt-private/private-install.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-14 19:18:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-14 19:18:38 +0000
commitb81238fa02b2348f3fbb90e4d5e54a3ad8d78ac4 (patch)
treebf5624f8edc149dca9d78bfa8bcbf2d493c8b128 /apt-private/private-install.cc
parentAdding upstream version 2.9.2. (diff)
downloadapt-b81238fa02b2348f3fbb90e4d5e54a3ad8d78ac4.tar.xz
apt-b81238fa02b2348f3fbb90e4d5e54a3ad8d78ac4.zip
Adding upstream version 2.9.3.upstream/2.9.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'apt-private/private-install.cc')
-rw-r--r--apt-private/private-install.cc40
1 files changed, 24 insertions, 16 deletions
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 <apt-pkg/prettyprinters.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/upgrade.h>
+#include <apt-pkg/version.h>
#include <algorithm>
#include <cstdlib>
@@ -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<std::pair<pkgCache::PkgIterator, char const *>> 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);