From patchwork Wed Jun 22 17:28:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 9193399 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 175DD6075F for ; Wed, 22 Jun 2016 17:31:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0023428411 for ; Wed, 22 Jun 2016 17:31:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E91CD28415; Wed, 22 Jun 2016 17:31:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7740728411 for ; Wed, 22 Jun 2016 17:31:04 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFlxR-0006jy-Gg; Wed, 22 Jun 2016 17:28:57 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFlxP-0006js-LT for xen-devel@lists.xen.org; Wed, 22 Jun 2016 17:28:55 +0000 Received: from [85.158.137.68] by server-6.bemta-3.messagelabs.com id 43/DA-24961-6DACA675; Wed, 22 Jun 2016 17:28:54 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmphkeJIrShJLcpLzFFi42JxWrrBXvfaqax wg8b7ohZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8azucuZC1bxV3TcXMvcwDiZp4uRk0NCwF9i z59JrCA2m4CBxIrpVxlBbBEBWYnVXXPYuxi5OJgF3jNJbD3bxQSSEBawlDhx9QsziM0ioCrRs HwiO4jNK2ArsWHrRWaIoXISDefvg9lCAmoSNxYuY4GoEZQ4OfMJmM0sICFx8MULoBoOoHpuib /d9hMYeWYhqZqFpGoBI9MqRvXi1KKy1CJdI72kosz0jJLcxMwcXUMDY73c1OLixPTUnMSkYr3 k/NxNjMAQqWdgYNzBeKrZ+RCjJAeTkigv47ascCG+pPyUyozE4oz4otKc1OJDjDIcHEoSvDEn gXKCRanpqRVpmTnAYIVJS3DwKInwLgJJ8xYXJOYWZ6ZDpE4x6nK8O/B3L5MQS15+XqqUOK8mS JEASFFGaR7cCFjkXGKUlRLmZWRgYBDiKUgtys0sQZV/xSjOwagkzLsaZApPZl4J3KZXQEcwAR 2xrD8d5IiSRISUVANjVHTiwq6PnMnLrx0w2+qVeDpq9fv3a/5OyNwq68956HDq8Zb6vTV17ev 666dHmHSv2e3YULWFoYWjdOHPPTNyXirN3fZMQrheQ3lWmH3j8lebLqbtL3CNS5qdukFyU2+3 V8y74wfutS17KfrdanvCrGv3t4fzMSelsnSly5bGpGYb7Y0wFo5UYinOSDTUYi4qTgQAjBQMh JcCAAA= X-Env-Sender: prvs=9742ee4c2=anthony.perard@citrix.com X-Msg-Ref: server-12.tower-31.messagelabs.com!1466616532!29984794!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 28324 invoked from network); 22 Jun 2016 17:28:54 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-12.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 22 Jun 2016 17:28:54 -0000 X-IronPort-AV: E=Sophos;i="5.26,509,1459814400"; d="scan'208";a="369019898" From: Anthony PERARD To: Date: Wed, 22 Jun 2016 18:28:15 +0100 Message-ID: <20160622172815.6699-1-anthony.perard@citrix.com> X-Mailer: git-send-email 2.9.0 MIME-Version: 1.0 X-DLP: MIA1 Cc: Stefano Stabellini , Wei Liu , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Jan Beulich , Anthony PERARD Subject: [Xen-devel] [PATCH] get_maintainer.pl: Teach brace expansion X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP This only implement a simpler non-nested brace expansion. This will convert brace expansion style use in MAINTAINER into a regex that get_maintainer.pl can use to match a path again a maintainer section. It is done by using two different regex, the first one will take care of converting ',' inside '{}' to a '|', one by one, as long as there is at least two commas. The second regex will do the final convertion of '{,}' to '(|)'. Signed-off-by: Anthony PERARD --- scripts/get_maintainer.pl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 9fda278..40c6d03 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl @@ -283,6 +283,12 @@ while (<$maint>) { ##Filename pattern matching if ($type eq "F" || $type eq "X") { + # Bash brace expansion, not nested + # match {,*,*} and transform ',' to '|' one by one. + while ($value =~ s/([^\\])\{(|[^},]*[^,\\]),((|[^},]*[^,\\]),(|[^}]*[^\\]))\}/$1\{$2|$3\}/g) {} + # Finish convertion by transforming '{,}' to '(|)' + $value =~ s/([^\\])\{(|[^},]*[^,\\]),(|[^}]*[^\\])\}/$1($2|$3)/g; + $value =~ s@\.@\\\.@g; ##Convert . to \. $value =~ s/\*/\.\*/g; ##Convert * to .* $value =~ s/\?/\./g; ##Convert ? to . @@ -637,6 +643,11 @@ sub get_maintainers { $line =~ s/([^\\])\.$/$1\?/g; ##Convert . back to ? $line =~ s/\\\./\./g; ##Convert \. to . $line =~ s/\.\*/\*/g; ##Convert .* to * + ## Convert (|) back to {,} + # match (|*|*) and transform '|' to ',' one by one + while ($line =~ s/([^\\])\((|[^)|]*[^|\\])\|((|[^)|]*[^|\\])\|(|[^)]*[^\\]))\)/$1($2,$3)/g) {} + # Finish convertion by transforming '(|)' to '{,}' + $line =~ s/([^\\])\((|[^)|]*[^|\\])\|(|[^)]*[^\\])\)/$1\{$2,$3\}/g; } $line =~ s/^([A-Z]):/$1:\t/g; print("$line\n");