X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/ae4a4f91e90fb09a8de1699f18f3b28d095c4d73..8d3489abd90a64715b92976a7c60b42a386a4c5c:/apt-pkg/versionmatch.cc diff --git a/apt-pkg/versionmatch.cc b/apt-pkg/versionmatch.cc index 72c9bff2d..093180f9b 100644 --- a/apt-pkg/versionmatch.cc +++ b/apt-pkg/versionmatch.cc @@ -155,6 +155,8 @@ pkgCache::VerIterator pkgVersionMatch::Find(pkgCache::PkgIterator Pkg) { if (MatchVer(Ver.VerStr(),VerStr,VerPrefixMatch) == true) return Ver; + if (ExpressionMatches(VerStr, Ver.VerStr()) == true) + return Ver; continue; } @@ -173,7 +175,6 @@ pkgCache::VerIterator pkgVersionMatch::Find(pkgCache::PkgIterator Pkg) bool pkgVersionMatch::ExpressionMatches(const char *pattern, const char *string) { - std::cerr << "MATCH " << pattern; if (pattern[0] == '/') { bool res = false; size_t length = strlen(pattern); @@ -182,11 +183,12 @@ bool pkgVersionMatch::ExpressionMatches(const char *pattern, const char *string) char *regex = strdup(pattern + 1); regex[length - 2] = '\0'; if (regcomp(&preg, regex, REG_EXTENDED | REG_ICASE) != 0) { - std::cerr << "E: Invalid regular expression: " << regex << "\n"; + _error->Warning("Invalid regular expression: %s", regex); } else if (regexec(&preg, string, 0, NULL, 0) == 0) { res = true; } free(regex); + regfree(&preg); return res; } }