summaryrefslogtreecommitdiff
path: root/apt-pkg/solver3.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/solver3.cc')
-rw-r--r--apt-pkg/solver3.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/apt-pkg/solver3.cc b/apt-pkg/solver3.cc
index ab66c9501..58fb07c01 100644
--- a/apt-pkg/solver3.cc
+++ b/apt-pkg/solver3.cc
@@ -46,8 +46,15 @@ struct CompareProviders3 /*{{{*/
{
if (AV == BV)
return false;
- if (not upgrade && A->CurrentVer != 0 && A.CurrentVer() == AV)
- return true;
+ // The current version should win, unless we are upgrading and the other is the
+ // candidate.
+ // If AV is the current version, AV only wins on upgrades if BV is not the candidate.
+ if (A.CurrentVer() == AV)
+ return upgrade ? Policy.GetCandidateVer(A) != BV : true;
+ // If BV is the current version, AV only wins on upgrades if it is the candidate.
+ if (A.CurrentVer() == BV)
+ return upgrade ? Policy.GetCandidateVer(A) == AV : false;
+ // If neither are the current version, order them by priority.
if (Policy.GetPriority(AV) < Policy.GetPriority(BV))
return false;