From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id B73A4139085 for ; Sat, 31 Dec 2016 22:08:45 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 04EE822419C; Sat, 31 Dec 2016 22:08:44 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id D142C22419C for ; Sat, 31 Dec 2016 22:08:43 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B3703340EE1 for ; Sat, 31 Dec 2016 22:08:42 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id B7B1824F4 for ; Sat, 31 Dec 2016 22:08:40 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1483220495.aa57d60d9c77a46f542475dcf448c83af40e73e1.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/portageq X-VCS-Directories: bin/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: aa57d60d9c77a46f542475dcf448c83af40e73e1 X-VCS-Branch: master Date: Sat, 31 Dec 2016 22:08:40 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: fa7cc482-86d8-43e3-9665-46df43078fa4 X-Archives-Hash: 9ed0b68779ec187e3c1a0b20466bf2fe commit: aa57d60d9c77a46f542475dcf448c83af40e73e1 Author: Göktürk Yüksek gentoo org> AuthorDate: Fri Dec 30 21:43:02 2016 +0000 Commit: Zac Medico gentoo org> CommitDate: Sat Dec 31 21:41:35 2016 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=aa57d60d 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 bin/portageq | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bin/portageq b/bin/portageq index d645635..06c8e0e 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"