From 10e157979915655d7030797bc09add644957aadb Mon Sep 17 00:00:00 2001 From: "Jason T. Masker" Date: Tue, 21 Oct 2014 19:20:22 +0200 Subject: [PATCH] scripts/crosstool-NG.sh.in: patch regex to work with BSD grep MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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=y CT_CONFIGURE_has_svn=y ... $ 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=y CT_CONFIGURE_has_svn=y ... Signed-off-by: Jason T. Masker Tested-by: Andreas Bießmann Signed-off-by: Bryan Hundven --- 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 cb9f91c0..06e022c1 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=0; } \ - dump==1 && $$0~/^\[.....\][[:space:]]+(# |)CT_/ { \ + dump==1 && $$0~/^\[.....\][[:space:]]+(# )?CT_/ { \ $$1=""; \ gsub("^[[:space:]]",""); \ print; \ diff --git a/scripts/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in index cd65d5bd..53ac552d 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"