From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3110 invoked by alias); 5 Dec 2014 11:16:02 -0000 Mailing-List: contact crossgcc-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: crossgcc-owner@sourceware.org Received: (qmail 3098 invoked by uid 89); 5 Dec 2014 11:16:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ie0-f172.google.com Received: from mail-ie0-f172.google.com (HELO mail-ie0-f172.google.com) (209.85.223.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 05 Dec 2014 11:16:00 +0000 Received: by mail-ie0-f172.google.com with SMTP id tr6so502515ieb.3 for ; Fri, 05 Dec 2014 03:15:58 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.50.118.105 with SMTP id kl9mr1858351igb.32.1417778154651; Fri, 05 Dec 2014 03:15:54 -0800 (PST) Received: by 10.50.235.38 with HTTP; Fri, 5 Dec 2014 03:15:54 -0800 (PST) In-Reply-To: <1413912022-25263-1-git-send-email-andreas@biessmann.de> References: <1413912022-25263-1-git-send-email-andreas@biessmann.de> Date: Fri, 05 Dec 2014 11:16:00 -0000 Message-ID: Subject: Re: [RESENT] [PATCH v2] scripts/crosstool-NG.sh.in: patch regex to work with BSD grep From: Bryan Hundven To: =?ISO-8859-1?Q?Andreas_Bie=DFmann?= Cc: crossgcc maillist , "Jason T. Masker" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2014-12/txt/msg00021.txt.bz2 Andreas, Jason, On Tue, Oct 21, 2014 at 10:20 AM, Andreas Bie=DFmann = wrote: > From: "Jason T. Masker" > > BSD grep does not interpret a null alteration. It complains about an > empty sub-expression, e.g.: > > $ grep --version && grep -E '^(# |)CT_' .config > grep (BSD grep) 2.5.1-FreeBSD > grep: empty (sub)expression > > This patch replaces the null alteration with a zero or once quantifier > which works with both BSD & GNU grep. > > $ grep --version && grep -E '^(# )?CT_' .config > grep (BSD grep) 2.5.1-FreeBSD > CT_CONFIGURE_has_xz=3Dy > CT_CONFIGURE_has_svn=3Dy > ... > $ ggrep --version && ggrep -E '^(# )?CT_' .config > ggrep (GNU grep) 2.20 > Copyright (C) 2014 Free Software Foundation, Inc. > License GPLv3+: GNU GPL version 3 or later . > This is free software: you are free to change and redistribute it. > There is NO WARRANTY, to the extent permitted by law. > > Written by Mike Haertel and others, see > . > CT_CONFIGURE_has_xz=3Dy > CT_CONFIGURE_has_svn=3Dy > ... > > Signed-off-by: Jason T. Masker > Tested-by: Andreas Bie=DFmann > --- > This is just a resent cause the original message could not be applied > properly. I also add my Tested-by, tested on OS X 10.10. > > since v1: > * adopt commit message > > Jason's v2/v3 messge: > * Updated patch to also fix change another occurrence, found in > kconfig/kconfig.mk. > > kconfig/kconfig.mk | 2 +- > scripts/crosstool-NG.sh.in | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kconfig/kconfig.mk b/kconfig/kconfig.mk > index cb9f91c..06e022c 100644 > --- a/kconfig/kconfig.mk > +++ b/kconfig/kconfig.mk > @@ -38,7 +38,7 @@ defconfig: > # Always be silent, the stdout an be >.config > extractconfig: > @$(awk) 'BEGIN { dump=3D0; } = \ > - dump=3D=3D1 && $$0~/^\[.....\][[:space:]]+(# |)CT_/ { = \ > + dump=3D=3D1 && $$0~/^\[.....\][[:space:]]+(# )?CT_/ { = \ > $$1=3D""; = \ > gsub("^[[:space:]]",""); = \ > print; = \ > diff --git a/scripts/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in > index cd65d5b..53ac552 100644 > --- a/scripts/crosstool-NG.sh.in > +++ b/scripts/crosstool-NG.sh.in > @@ -125,7 +125,7 @@ CT_DoLog INFO "Build started ${CT_STAR_DATE_HUMAN}" > # We really need to extract from ,config and not .config.2, as we > # do want the kconfig's values, not our mangled config with arrays. > CT_DoStep DEBUG "Dumping user-supplied crosstool-NG configuration" > -CT_DoExecLog DEBUG ${grep} -E '^(# |)CT_' .config > +CT_DoExecLog DEBUG ${grep} -E '^(# )?CT_' .config > CT_EndStep > > CT_DoLog DEBUG "Unsetting and unexporting MAKEFLAGS" > -- > 1.9.3 (Apple Git-50) > > > -- > For unsubscribe information see http://sourceware.org/lists.html#faq > I've accepted this version of the patch. Thanks goes to both of you! Cheers, -Bryan /me squints at the regular expression a few times... sticks thumbs up :D ... runs away -- For unsubscribe information see http://sourceware.org/lists.html#faq