summaryrefslogtreecommitdiff
path: root/apt-pkg/policy.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2015-08-10 15:52:06 +0200
committerJulian Andres Klode <jak@debian.org>2015-08-10 15:58:31 +0200
commit3d5e93f7cd6bea364ca811c7f64b5e1d4174a4ac (patch)
tree94de8ecbf078df58e2e0f7f60ce478cbe6912eac /apt-pkg/policy.cc
parent76b004d1a2122206925abc1a412e055430cef283 (diff)
policy: Fix the handling of config-files states
Gbp-Dch: ignore
Diffstat (limited to 'apt-pkg/policy.cc')
-rw-r--r--apt-pkg/policy.cc15
1 files changed, 12 insertions, 3 deletions
diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc
index 78e34a344..7947103d5 100644
--- a/apt-pkg/policy.cc
+++ b/apt-pkg/policy.cc
@@ -238,7 +238,7 @@ pkgCache::VerIterator pkgPolicy::GetCandidateVerNew(pkgCache::PkgIterator const
for (pkgCache::VerIterator ver = Pkg.VersionList(); ver.end() == false; ver++) {
int priority = GetPriority(ver);
- if (priority <= candPriority)
+ if (priority == 0 || priority <= candPriority)
continue;
// TODO: Maybe optimize to not compare versions
@@ -376,8 +376,17 @@ APT_PURE signed short pkgPolicy::GetPriority(pkgCache::VerIterator const &Ver)
int priority = INT_MIN;
for (pkgCache::VerFileIterator file = Ver.FileList(); file.end() == false; file++)
{
- if (GetPriority(file.File()) > priority)
- priority = GetPriority(file.File());
+ /* If this is the status file, and the current version is not the
+ version in the status file (ie it is not installed, or somesuch)
+ then it is not a candidate for installation, ever. This weeds
+ out bogus entries that may be due to config-file states, or
+ other. */
+ if (file.File().Flagged(pkgCache::Flag::NotSource) && Ver.ParentPkg().CurrentVer() != Ver) {
+ if (priority < 0)
+ priority = 0;
+ } else if (GetPriority(file.File()) > priority) {
+ priority = GetPriority(file.File());
+ }
}
return priority == INT_MIN ? 0 : priority;