Просмотр исходного кода

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.
Julian Andres Klode лет назад: 11
Родитель
Сommit
5f9386e543
1 измененных файлов с 10 добавлено и 1 удалено
  1. 10 1
      apt-pkg/policy.cc

+ 10 - 1
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)
 {