]> git.saurik.com Git - apt.git/commitdiff
policy: Return highest file pin if version pin == 0 in GetPriority()
authorJulian Andres Klode <jak@debian.org>
Mon, 10 Aug 2015 10:18:28 +0000 (12:18 +0200)
committerJulian Andres Klode <jak@debian.org>
Mon, 10 Aug 2015 10:18:28 +0000 (12:18 +0200)
This makes sure that we display a useful value instead of 0 for
versions that are pinned due to package files.

apt-pkg/policy.cc

index 370819e0bc9ea4a9c14e034adc4f767a75789b1f..2d1f2a5d4cd4bb5b9881e1a70844e74df6837420 100644 (file)
@@ -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;
 {
    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)
 {
 }
 APT_PURE signed short pkgPolicy::GetPriority(pkgCache::PkgFileIterator const &File)
 {