X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/258b9e512c4001e806c5c0966acecd3d742ec6e9..69cea1ef2cfda3c4da79fd756a8edaf2be26998e:/apt-pkg/policy.cc?ds=sidebyside diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc index d442e5c90..7c57f9dea 100644 --- a/apt-pkg/policy.cc +++ b/apt-pkg/policy.cc @@ -374,7 +374,7 @@ APT_PURE signed short pkgPolicy::GetPriority(pkgCache::VerIterator const &Ver, b if (!ConsiderFiles) return 0; - int priority = std::numeric_limits::min(); + signed short priority = std::numeric_limits::min(); for (pkgCache::VerFileIterator file = Ver.FileList(); file.end() == false; file++) { /* If this is the status file, and the current version is not the @@ -382,14 +382,13 @@ APT_PURE signed short pkgPolicy::GetPriority(pkgCache::VerIterator const &Ver, b 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()); - } + if (file.File().Flagged(pkgCache::Flag::NotSource) && Ver.ParentPkg().CurrentVer() != Ver) + priority = std::max(priority, static_cast(-1)); + else + priority = std::max(priority, GetPriority(file.File())); } - return priority == std::numeric_limits::min() ? 0 : priority; + return priority == std::numeric_limits::min() ? 0 : priority; } APT_PURE signed short pkgPolicy::GetPriority(pkgCache::PkgFileIterator const &File) { @@ -438,11 +437,11 @@ bool ReadPinFile(pkgPolicy &Plcy,string File) return true; FileFd Fd(File,FileFd::ReadOnly); - pkgTagFile TF(&Fd); + pkgTagFile TF(&Fd, pkgTagFile::SUPPORT_COMMENTS); if (Fd.IsOpen() == false || Fd.Failed()) return false; - pkgUserTagSection Tags; + pkgTagSection Tags; while (TF.Step(Tags) == true) { // can happen when there are only comments in a record