- // Look for a package pin and evaluate it.
- signed Max = GetPriority(Pkg);
- pkgCache::VerIterator Pref = GetMatch(Pkg);
-
- // Alternatives in case we can not find our package pin (Bug#512318).
- signed MaxAlt = 0;
- pkgCache::VerIterator PrefAlt;
-
- // no package = no candidate version
- if (Pkg.end() == true)
- return Pref;
-
- // packages with a pin lower than 0 have no newer candidate than the current version
- if (Max < 0)
- return Pkg.CurrentVer();
-
- /* Falling through to the default version.. Setting Max to zero
- effectively excludes everything <= 0 which are the non-automatic
- priorities.. The status file is given a prio of 100 which will exclude
- not-automatic sources, except in a single shot not-installed mode.
- The second pseduo-status file is at prio 1000, above which will permit
- the user to force-downgrade things.
-
- The user pin is subject to the same priority rules as default
- selections. Thus there are two ways to create a pin - a pin that
- tracks the default when the default is taken away, and a permanent
- pin that stays at that setting.
- */
- bool PrefSeen = false;
- for (pkgCache::VerIterator Ver = Pkg.VersionList(); Ver.end() == false; ++Ver)
- {
- /* Lets see if this version is the installed version */
- bool instVer = (Pkg.CurrentVer() == Ver);