pkgCache::VerIterator Ver = Pkg.VersionList();
for (; Ver.end() == false; ++Ver)
{
- if (Type == Version)
- {
- if (MatchVer(Ver.VerStr(),VerStr,VerPrefixMatch) == true)
- return Ver;
- if (ExpressionMatches(VerStr, Ver.VerStr()) == true)
- return Ver;
- continue;
- }
-
- for (pkgCache::VerFileIterator VF = Ver.FileList(); VF.end() == false; ++VF)
- if (FileMatch(VF.File()) == true)
- return Ver;
+ if (VersionMatches(Ver))
+ return Ver;
}
-
+
// This will be Ended by now.
return Ver;
}
/*}}}*/
+// VersionMatch::Find - Locate the best match for the select type /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+bool pkgVersionMatch::VersionMatches(pkgCache::VerIterator Ver)
+{
+ if (Type == Version)
+ {
+ if (MatchVer(Ver.VerStr(),VerStr,VerPrefixMatch) == true)
+ return true;
+ if (ExpressionMatches(VerStr, Ver.VerStr()) == true)
+ return true;
+ return false;
+ }
+
+ for (pkgCache::VerFileIterator VF = Ver.FileList(); VF.end() == false; ++VF)
+ if (FileMatch(VF.File()) == true)
+ return true;
+
+ return false;
+}
+ /*}}}*/
+
#ifndef FNM_CASEFOLD
#define FNM_CASEFOLD 0
#endif
if (OrSite.empty() == false) {
if (File.Site() == NULL)
return false;
- } else // so we are talking about file:// or status file
- {
- pkgCache::RlsFileIterator const RlsFile = File.ReleaseFile();
- if (strcmp(File.Site(),"") == 0 && RlsFile->Archive != 0 && strcmp(RlsFile.Archive(),"now") == 0) // skip the status file
- return false;
}
+ else if (File->Release == 0)// only 'bad' files like dpkg.status file has no release file
+ return false;
return (ExpressionMatches(OrSite, File.Site())); /* both strings match */
}