- if (Pkg->TargetVer == 0)
- {
- /* 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);
- }
+ if (Pkg->TargetVer == 0 ||
+ (AllowCurrent == false && Pkg.TargetVer() == Pkg.CurrentVer()))
+ return pkgCache::GetCandidateVer(Pkg,AllowCurrent);