[coreboot-gerrit] New patch to review for coreboot: buildgcc: replace [[ ... == ... ]] with something more portable

Patrick Georgi (pgeorgi@google.com) gerrit at coreboot.org
Thu Jun 11 21:09:05 CEST 2015


Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10518

-gerrit

commit 61d54cc50d32890a15234132ef06826f07c1347e
Author: Patrick Georgi <pgeorgi at chromium.org>
Date:   Thu Jun 11 21:07:31 2015 +0200

    buildgcc: replace [[ ... == ... ]] with something more portable
    
    using grep is an extra process invocation, but it's not a bashism.
    Also match precisely, so AGCC doesn't trigger on GCC (we don't have collisions
    right now, but we won't have to deal with them in the future)
    
    Change-Id: I242833c350b7f1e6a6793f288c1aae0b50d57a26
    Signed-off-by: Patrick Georgi <pgeorgi at chromium.org>
---
 util/crossgcc/buildgcc | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/util/crossgcc/buildgcc b/util/crossgcc/buildgcc
index ecc7ad4..7f440f7 100755
--- a/util/crossgcc/buildgcc
+++ b/util/crossgcc/buildgcc
@@ -238,6 +238,11 @@ fn_exists()
 	type $1 >/dev/null 2>&1
 }
 
+is_package_enabled()
+{
+	echo "$PACKAGES" |grep -q "\<$1\>"
+}
+
 build() {
 	package=$1
 
@@ -248,7 +253,7 @@ build() {
 
 	mkdir -p ${BUILDDIR}
 
-	[[ "$PACKAGES" == *$package* ]] && \
+	is_package_enabled "$package" && \
 	if [ -f ${BUILDDIR}/.success ]; then
 		printf "Skipping $package as it is already built\n"
 	else
@@ -569,7 +574,7 @@ fi
 # Set up host compiler and flags needed for various OSes
 
 CC=cc
-if [[ "$PACKAGES" == *GCC* ]]; then
+if is_package_enabled "GCC"; then
 if [ $UNAME = "Darwin" ]; then
 	#GCC_OPTIONS="$GCC_OPTIONS --enable-threads=posix"
 



More information about the coreboot-gerrit mailing list