1 |
commit: aa57d60d9c77a46f542475dcf448c83af40e73e1 |
2 |
Author: Göktürk Yüksek <gokturk <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Dec 30 21:43:02 2016 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Dec 31 21:41:35 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=aa57d60d |
7 |
|
8 |
portageq: allow disabling regex matching of maintainer emails #604164 |
9 |
|
10 |
When the email address of a maintainer contains unescaped |
11 |
regex-special characters (such as '+'), the maintainer-email match may |
12 |
return undesirable results. |
13 |
|
14 |
Add a command line option '--no-regex' to use re.escape() with list |
15 |
comprehension on maintainer emails when constructing the matcher |
16 |
regex. This way, an exact string match can be made rather than a regex |
17 |
match. |
18 |
|
19 |
X-Gentoo-bug: 604164 |
20 |
X-Gentoo-bug-url: https://bugs.gentoo.org/604164 |
21 |
|
22 |
bin/portageq | 7 +++++++ |
23 |
1 file changed, 7 insertions(+) |
24 |
|
25 |
diff --git a/bin/portageq b/bin/portageq |
26 |
index d645635..06c8e0e 100755 |
27 |
--- a/bin/portageq |
28 |
+++ b/bin/portageq |
29 |
@@ -1082,6 +1082,8 @@ def pquery(parser, opts, args): |
30 |
maintainer_emails = [] |
31 |
for x in opts.maintainer_email: |
32 |
maintainer_emails.extend(x.split(",")) |
33 |
+ if opts.no_regex: # Escape regex-special characters for an exact match |
34 |
+ maintainer_emails = [re.escape(x) for x in maintainer_emails] |
35 |
xml_matchers.append(MaintainerEmailMatcher(maintainer_emails)) |
36 |
if opts.orphaned: |
37 |
xml_matchers.append(match_orphaned) |
38 |
@@ -1240,6 +1242,11 @@ def add_pquery_arguments(parser): |
39 |
"help": "comma-separated list of maintainer email regexes to search for" |
40 |
}, |
41 |
{ |
42 |
+ "longopt": "--no-regex", |
43 |
+ "action": "store_true", |
44 |
+ "help": "Use exact matching instead of regex matching for --maintainer-email" |
45 |
+ }, |
46 |
+ { |
47 |
"longopt": "--orphaned", |
48 |
"action": "store_true", |
49 |
"help": "match only orphaned (maintainer-needed) packages" |