// choose a good candidate and proceed with that.
// Maybe we will find a source later on with the right VerTag
// or RelTag
- pkgCache::VerIterator Ver = Cache->GetCandidateVer(Pkg);
- if (Ver.end() == false)
+ pkgCache::VerIterator const Ver = Cache->GetCandidateVersion(Pkg);
+ if (Ver.end() == false)
{
if (strcmp(Ver.SourcePkgName(),Ver.ParentPkg().Name()) != 0)
Src = Ver.SourcePkgName();
while ((Parse = SrcRecs.Find(Src.c_str(), MatchSrcOnly)) != 0)
{
const std::string Ver = Parse->Version();
+ bool CorrectRelTag = false;
// See if we need to look for a specific release tag
if (RelTag != "" && UserRequestedVerTag == "")
{
if ((Rls->Archive != 0 && RelTag == Rls.Archive()) ||
(Rls->Codename != 0 && RelTag == Rls.Codename()))
- {
- Last = Parse;
- Offset = Parse->Offset();
- Version = Ver;
- }
+ CorrectRelTag = true;
}
- }
+ } else
+ CorrectRelTag = true;
// Ignore all versions which doesn't fit
if (VerTag.empty() == false &&
continue;
// Newer version or an exact match? Save the hit
- if (Last == 0 || Cache->VS().CmpVersion(Version,Ver) < 0) {
+ if (CorrectRelTag && (Last == 0 || Cache->VS().CmpVersion(Version,Ver) < 0)) {
Last = Parse;
Offset = Parse->Offset();
Version = Ver;