1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

pkgin: Fix bad regexp which did not catch packages such as p5-SVN-Notify

The previous version of my regexp did not take into account packages
such as 'p5-Perl-Tidy' or 'p5-Test-Output', so use a greedy match up to
the last occurrance of '-' for matching the package.  This regex has
been extensively tested using all packages as provided by pkgsrc-2016Q1[1].

Footnotes:
[1]  http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/?only_with_tag=pkgsrc-2016Q1
This commit is contained in:
Christopher M. Fuhrman 2016-04-14 03:51:29 -07:00 committed by Matt Clay
parent 7c19002f34
commit 310b7ce3d8

View file

@ -164,7 +164,7 @@ def query_package(module, name):
# Search for package, stripping version
# (results in sth like 'gcc47-libs' or 'emacs24-nox11')
pkg_search_obj = re.search(r'^([a-zA-Z]+[0-9]*[\-]*\w*)-[0-9]', pkgname_with_version, re.M)
pkg_search_obj = re.search(r'^(.*?)\-[0-9][0-9.]*(nb[0-9]+)*', pkgname_with_version, re.M)
# Do not proceed unless we have a match
if not pkg_search_obj: