From 310b7ce3d8a150e1e4011588886004a795253863 Mon Sep 17 00:00:00 2001 From: "Christopher M. Fuhrman" Date: Thu, 14 Apr 2016 03:51:29 -0700 Subject: [PATCH] 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 --- lib/ansible/modules/extras/packaging/os/pkgin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/extras/packaging/os/pkgin.py b/lib/ansible/modules/extras/packaging/os/pkgin.py index cd48385eefe..055891ebe08 100755 --- a/lib/ansible/modules/extras/packaging/os/pkgin.py +++ b/lib/ansible/modules/extras/packaging/os/pkgin.py @@ -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: