diff options
author | Göktürk Yüksek <gokturk@gentoo.org> | 2016-12-30 16:43:02 -0500 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2016-12-31 13:41:35 -0800 |
commit | aa57d60d9c77a46f542475dcf448c83af40e73e1 (patch) | |
tree | 46dfa472404dc7a29b0eaf860875c5ba6357fda6 /bin/portageq | |
parent | depgraph: clarify "update has been skipped" message (bug 602854) (diff) | |
download | portage-aa57d60d9c77a46f542475dcf448c83af40e73e1.tar.gz portage-aa57d60d9c77a46f542475dcf448c83af40e73e1.tar.bz2 portage-aa57d60d9c77a46f542475dcf448c83af40e73e1.zip |
portageq: allow disabling regex matching of maintainer emails #604164
When the email address of a maintainer contains unescaped
regex-special characters (such as '+'), the maintainer-email match may
return undesirable results.
Add a command line option '--no-regex' to use re.escape() with list
comprehension on maintainer emails when constructing the matcher
regex. This way, an exact string match can be made rather than a regex
match.
X-Gentoo-bug: 604164
X-Gentoo-bug-url: https://bugs.gentoo.org/604164
Diffstat (limited to 'bin/portageq')
-rwxr-xr-x | bin/portageq | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/bin/portageq b/bin/portageq index d645635a6..06c8e0e57 100755 --- a/bin/portageq +++ b/bin/portageq @@ -1082,6 +1082,8 @@ def pquery(parser, opts, args): maintainer_emails = [] for x in opts.maintainer_email: maintainer_emails.extend(x.split(",")) + if opts.no_regex: # Escape regex-special characters for an exact match + maintainer_emails = [re.escape(x) for x in maintainer_emails] xml_matchers.append(MaintainerEmailMatcher(maintainer_emails)) if opts.orphaned: xml_matchers.append(match_orphaned) @@ -1240,6 +1242,11 @@ def add_pquery_arguments(parser): "help": "comma-separated list of maintainer email regexes to search for" }, { + "longopt": "--no-regex", + "action": "store_true", + "help": "Use exact matching instead of regex matching for --maintainer-email" + }, + { "longopt": "--orphaned", "action": "store_true", "help": "match only orphaned (maintainer-needed) packages" |