-// DepCache::GetCandidateVer - Returns the Candidate install version /*{{{*/
-// ---------------------------------------------------------------------
-/* The default just returns the target version if it exists or the
- highest version. */
-pkgDepCache::VerIterator pkgDepCache::GetCandidateVer(PkgIterator Pkg)
-{
- // Try to use an explicit target
- if (Pkg->TargetVer == 0)
- {
- string DistHack = _config->Find("to");
-
- /* If disthack is set then we look for a dist by that name to install
- from */
- if (DistHack.empty() == false)
- {
- for (VerIterator I = Pkg.VersionList(); I.end() == false; I++)
- {
- for (VerFileIterator J = I.FileList(); J.end() == false; J++)
- if ((J.File()->Flags & Flag::NotSource) == 0 &&
- (J.File()->Flags & Flag::NotAutomatic) == 0 &&
- J.File().Archive() == DistHack)
- return I;
- }
-
- // Hmm, target is current if there is no alternative.
- if (Pkg->CurrentVer != 0)
- return Pkg.CurrentVer();
- }
- else
- {
- /* Not source/not automatic versions cannot be a candidate version
- unless they are already installed */
- for (VerIterator I = Pkg.VersionList(); I.end() == false; I++)
- {
- if (Pkg.CurrentVer() == I)
- return I;
- for (VerFileIterator J = I.FileList(); J.end() == false; J++)
- if ((J.File()->Flags & Flag::NotSource) == 0 &&
- (J.File()->Flags & Flag::NotAutomatic) == 0)
- return I;
- }
- }
-
- return VerIterator(*this,0);
- }
- else
- return Pkg.TargetVer();
-}
- /*}}}*/
-// DepCache::IsImportantDep - True if the dependency is important /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-bool pkgDepCache::IsImportantDep(DepIterator Dep)
-{
- return Dep.IsCritical();
-}
- /*}}}*/