summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2017-12-12 21:31:35 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2017-12-13 23:52:07 +0100
commitb857d586edeb3639d996a75fccd55ebea370b491 (patch)
treebe1b3126c04f4721e27f4ac043599b2525494417 /apt-pkg
parent197c53951430bcb267ddd6e398439a8a5d9a83ad (diff)
don't auto-switch candidate if installed is good enough
If we perform candidate switching in requests like "apt install foo/bar" we should first check if the dependencies of foo from release bar are already satisfied by what is already installed before checking if the candidate (or switched candidate) would.
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/depcache.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index c66ab2ded..3787106f7 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -1559,6 +1559,13 @@ bool pkgDepCache::SetCandidateRelease(pkgCache::VerIterator TargetVer,
// virtual packages can't be a solution
if (P.end() == true || (P->ProvidesList == 0 && P->VersionList == 0))
continue;
+ // if its already installed, check if this one is good enough
+ pkgCache::VerIterator const Now = P.CurrentVer();
+ if (Now.end() == false && Start.IsSatisfied(Now))
+ {
+ itsFine = true;
+ break;
+ }
pkgCache::VerIterator const Cand = PkgState[P->ID].CandidateVerIter(*this);
// no versioned dependency - but is it installable?
if (Start.TargetVer() == 0 || Start.TargetVer()[0] == '\0')