diff options
author | Julian Andres Klode <jak@debian.org> | 2015-08-10 12:18:28 +0200 |
---|---|---|
committer | Julian Andres Klode <jak@debian.org> | 2015-08-10 12:18:28 +0200 |
commit | 5f9386e54360c403772e2a876d48d31dde9d5097 (patch) | |
tree | 177cc6b75801285d8ce8fd7a8d4bd39eb6069351 | |
parent | 20cf708a62df5e4aa45a506819db425c6cc975fe (diff) |
policy: Return highest file pin if version pin == 0 in GetPriority()
This makes sure that we display a useful value instead of 0 for
versions that are pinned due to package files.
-rw-r--r-- | apt-pkg/policy.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc index 370819e0b..2d1f2a5d4 100644 --- a/apt-pkg/policy.cc +++ b/apt-pkg/policy.cc @@ -336,7 +336,16 @@ APT_PURE signed short pkgPolicy::GetPriority(pkgCache::VerIterator const &Ver) { if (VerPins[Ver->ID].Type != pkgVersionMatch::None) return VerPins[Ver->ID].Priority; - return 0; + + + int priority = INT_MIN; + for (pkgCache::VerFileIterator file = Ver.FileList(); file.end() == false; file++) + { + if (GetPriority(file.File()) > priority) + priority = GetPriority(file.File()); + } + + return priority == INT_MIN ? 0 : priority; } APT_PURE signed short pkgPolicy::GetPriority(pkgCache::PkgFileIterator const &File) { |