summaryrefslogtreecommitdiff
path: root/apt-pkg/policy.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2010-03-21 17:38:43 +0100
committerJulian Andres Klode <jak@debian.org>2010-03-21 17:38:43 +0100
commit8f5525e96777133e18772e398a2bb22ffc497d44 (patch)
treed85efa6c9ec854d10c64c265b187cb8987732af3 /apt-pkg/policy.cc
parent9f240996cf1c5c10b5cdcca3b59a302d28e49608 (diff)
* apt-pkg/policy.cc:
- Always return a candidate if there is at least one version pinned > 0 (Closes: #512318)
Diffstat (limited to 'apt-pkg/policy.cc')
-rw-r--r--apt-pkg/policy.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc
index f9901bc9a..b12a50d0a 100644
--- a/apt-pkg/policy.cc
+++ b/apt-pkg/policy.cc
@@ -121,6 +121,10 @@ pkgCache::VerIterator pkgPolicy::GetCandidateVer(pkgCache::PkgIterator Pkg)
signed Max = GetPriority(Pkg);
pkgCache::VerIterator Pref = GetMatch(Pkg);
+ // Alternatives in case we can not find our package pin (Bug#512318).
+ signed MaxAlt = 0;
+ pkgCache::VerIterator PrefAlt;
+
// no package = no candidate version
if (Pkg.end() == true)
return Pref;
@@ -159,6 +163,11 @@ pkgCache::VerIterator pkgPolicy::GetCandidateVer(pkgCache::PkgIterator Pkg)
{
Pref = Ver;
Max = Prio;
+ }
+ if (Prio > MaxAlt)
+ {
+ PrefAlt = Ver;
+ MaxAlt = Prio;
}
}
@@ -175,6 +184,11 @@ pkgCache::VerIterator pkgPolicy::GetCandidateVer(pkgCache::PkgIterator Pkg)
break;
}
}
+ // If we do not find our candidate, use the one with the highest pin.
+ // This means that if there is a version available with pin > 0; there
+ // will always be a candidate (Closes: #512318)
+ if (!Pref.IsGood() && MaxAlt > 0)
+ Pref = PrefAlt;
return Pref;
}
/*}}}*/