summaryrefslogtreecommitdiffstats
path: root/apt-private/private-install.cc
diff options
context:
space:
mode:
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);