From patchwork Mon Apr 11 16:37:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Jackson X-Patchwork-Id: 8804311 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9BE15C0554 for ; Mon, 11 Apr 2016 16:40:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BA75420138 for ; Mon, 11 Apr 2016 16:40:10 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id D5DDF20253 for ; Mon, 11 Apr 2016 16:40:09 +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 1apeqv-0005Ct-Gv; Mon, 11 Apr 2016 16:38:17 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1apequ-0005Bo-26 for xen-devel@lists.xenproject.org; Mon, 11 Apr 2016 16:38:16 +0000 Received: from [85.158.143.35] by server-1.bemta-6.messagelabs.com id AC/8A-18833-7F2DB075; Mon, 11 Apr 2016 16:38:15 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplkeJIrShJLcpLzFFi42JxWrohUvfbJe5 wg3W/rS2+b5nM5MDocfjDFZYAxijWzLyk/IoE1oyOzrXMBbsFKlpb3rM1MF7g7WLk5JAQ8Je4 ua6VBcRmE9CVaNryl62LkYNDREBF4vZeA5Aws0CtxOVlzcwgtrBAgsSej2cYQWwWAVWJU+uXs YPYvAIeEl/fXGOGGKko0f1sAhuIzSngKbF78nawuBBQzdFLcxhBxgsJqEnMXR8P0SoocXLmEx aIVRISB1+8YAYpkRDglvjbbT+BkW8WkqpZSKoWMDKtYlQvTi0qSy3SNdRLKspMzyjJTczM0TU 0MNPLTS0uTkxPzUlMKtZLzs/dxAgMJgYg2MG487nTIUZJDiYlUd6d87nDhfiS8lMqMxKLM+KL SnNSiw8xynBwKEnwHr4IlBMsSk1PrUjLzAGGNUxagoNHSYR3Gkiat7ggMbc4Mx0idYpRUUqcl w0YDUICIImM0jy4NlgsXWKUlRLmZQQ6RIinILUoN7MEVf4VozgHo5Iw7wOQ8TyZeSVw018BLW YCWvzsHyfI4pJEhJRUA6Pwtg7l+V5HzmiekNDRfxlftOCxsefTohmToivSN95RFKhY4dTu/mJ DkeHdZsn2n8c2Pqm6LDuloJDxbbjxLvt482sGRg6yfzTe/y54fPPNRieGJsttf12kJ0XZ/+R5 7Tg1pj03+KajpfMfxqZzk7hfHXS8XjBz5d8qd56zi/gKlS9d3vrV8bUSS3FGoqEWc1FxIgCSj rSsoAIAAA== X-Env-Sender: prvs=902b7e3ca=Ian.Jackson@citrix.com X-Msg-Ref: server-10.tower-21.messagelabs.com!1460392693!8621852!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.28; banners=-,-,- X-VirusChecked: Checked Received: (qmail 15244 invoked from network); 11 Apr 2016 16:38:14 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-10.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 11 Apr 2016 16:38:14 -0000 X-IronPort-AV: E=Sophos;i="5.24,462,1454976000"; d="scan'208";a="346243958" From: Ian Jackson To: Date: Mon, 11 Apr 2016 17:37:16 +0100 Message-ID: <1460392641-7060-2-git-send-email-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1460392641-7060-1-git-send-email-ian.jackson@eu.citrix.com> References: <1460392641-7060-1-git-send-email-ian.jackson@eu.citrix.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: Ian Jackson , Ian Campbell Subject: [Xen-devel] [OSSTEST PATCH 1/6] mg-list-all-branches: avoid mistakenly generating `.' in the output 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The regex in mg-list-all-branches assumes that the BRANCHES= will either be a singleton entry separated from the following command by a hard tab or a single quoted list of space separated entries, however the xen-unstable-coverity line is singleton separated from the command by a single space. We could fix this by using a hard tab, but that ends up aligning things in an aesthetically displeasing way, and relying on hard tabs is fragile. Instead, improve the parsing in mg-list-all-branches: break out a couple of semantically (as well as syntactically) common regexp elements out into variables, and then provide two regexps: one which matches shell "assign default values" substitutions, and the other which matches the ordinary shell assignments. We use an empty pair of () in the first regexp to make sure that they both produce the branch name list in $2. (It would be possible to use named capture groups but I'm not sure whether all our perls are recent enough.) I have verified that the actual difference in output right now is just to remove the erroneous `.' entry. Reported-by: Ian Campbell Signed-off-by: Ian Campbell Signed-off-by: Ian Jackson Acked-by: Ian Campbell --- mg-list-all-branches | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mg-list-all-branches b/mg-list-all-branches index 87703c7..62d3ff1 100755 --- a/mg-list-all-branches +++ b/mg-list-all-branches @@ -7,11 +7,16 @@ use Sort::Versions; our %branches; +my $branchvar_re = '(?:EXTRA_)?BRANCHES'; +my $branchchr_re = '[-.0-9a-z ]'; + foreach my $f (qw(cr-for-branches crontab)) { open C, $f or die $!; while () { - next unless m/(?:EXTRA_)?BRANCHES[:+]?='?([-.0-9a-z ]+)/; - $branches{$_}=1 foreach split /\s+/, $1; + next unless + m/\$\{$branchvar_re[:+]?=()($branchchr_re+)\b/ || + m/$branchvar_re[:+]?=('?)($branchchr_re+?)\1\s/; + $branches{$_}=1 foreach split /\s+/, $2; } close C or die $!; }