+APT_PURE signed short pkgPolicy::GetPriority(pkgCache::VerIterator const &Ver, bool considerFiles)
+{
+ if (VerPins[Ver->ID].Type != pkgVersionMatch::None)
+ return VerPins[Ver->ID].Priority;
+ if (!considerFiles)
+ return 0;
+
+ int priority = std::numeric_limits<int>::min();
+ for (pkgCache::VerFileIterator file = Ver.FileList(); file.end() == false; 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) {
+ // Ignore
+ } else if (GetPriority(file.File()) > priority) {
+ priority = GetPriority(file.File());
+ }
+ }
+
+ return priority == std::numeric_limits<int>::min() ? 0 : priority;
+}