[coreboot-gerrit] Change in coreboot[master]: abuild: Fix shellcheck errors

Martin Roth (Code Review) gerrit at coreboot.org
Mon Jul 23 05:10:14 CEST 2018


Martin Roth has uploaded this change for review. ( https://review.coreboot.org/27597


Change subject: abuild: Fix shellcheck errors
......................................................................

abuild: Fix shellcheck errors

Fix 6 new errors found by a newer version of shellcheck:
SC2155: Declare and assign separately to avoid masking return values.
4 x SC2086: Double quote to prevent globbing and word splitting.
SC2196: egrep is non-standard and deprecated. Use grep -E instead.

One of the SC2086 errors is masked because it needs word splitting.

Change-Id: I7f869e6d208f7247f739619c538be6075b802719
Signed-off-by: Martin Roth <gaumless at gmail.com>
---
M util/abuild/abuild
1 file changed, 8 insertions(+), 8 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/97/27597/1

diff --git a/util/abuild/abuild b/util/abuild/abuild
index f67117c..48549b6 100755
--- a/util/abuild/abuild
+++ b/util/abuild/abuild
@@ -167,12 +167,14 @@
 function normalize_target
 {
 	local targets
+	local VARIANT_UC
 
-	local VARIANT_UC=$(echo "${variant}" | tr '[:lower:]' '[:upper:]')
+	VARIANT_UC=$(echo "${variant}" | tr '[:lower:]' '[:upper:]')
 
 	targets=$(get_mainboards "$1")
 	if [ -n "$targets" ]; then
-		targets=$(grep "${VARIANT_UC}\$" <<< ${targets})
+		# shellcheck disable=SC2086
+		targets="$(grep "${VARIANT_UC}\$" <<< ${targets})"
 		echo "$targets"
 		return
 	fi
@@ -355,10 +357,10 @@
 
 	CURR=$( pwd )
 	#stime=`perl -e 'print time();' 2>/dev/null || date +%s`
-	eval $BUILDPREFIX $MAKE "$verboseopt" DOTCONFIG="${build_dir}/config.build" obj="${build_dir}" objutil="$TARGET/sharedutils" BUILD_TIMELESS=$TIMELESS \
+	eval "$BUILDPREFIX" "$MAKE" "$verboseopt" DOTCONFIG="${build_dir}/config.build" obj="${build_dir}" objutil="$TARGET/sharedutils" BUILD_TIMELESS=$TIMELESS \
 		&> "${build_dir}/make.log" ; \
 		MAKE_FAILED=$?
-	cp ${ROOT}/.xcompile "${build_dir}/xcompile.build"
+	cp "${ROOT}/.xcompile" "${build_dir}/xcompile.build"
 	cd "${build_dir}" || return $?
 
 	etime=$(perl -e 'print time();' 2>/dev/null || date +%s)
@@ -459,7 +461,7 @@
 		return
 	fi
 
-	required_arches=$(egrep "^CONFIG_ARCH_(BOOTBLOCK|R.MSTAGE|VERSTAGE)" "$TARGET/${BUILD_NAME}/config.build" | \
+	required_arches=$(grep -E "^CONFIG_ARCH_(BOOTBLOCK|R.MSTAGE|VERSTAGE)" "$TARGET/${BUILD_NAME}/config.build" | \
 			sed "s,^CONFIG_ARCH_[^_]*_\([^=]*\)=.*$,\1," |sort -u |tr 'A-Z\n\r' 'a-z  ')
 	# shellcheck disable=SC2016,SC2059
 	missing_arches=$(printf 'include .xcompile\nall: ; @echo $(foreach arch,'"$required_arches"',$(if $(filter $(arch),$(SUBARCH_SUPPORTED)),,$(arch)))' | $MAKE --no-print-directory -f -)
@@ -800,7 +802,7 @@
 	local XMLFILE="$ABSPATH/__util.xml"
 	rm -f "${XMLFILE}"
 	stime=$(perl -e 'print time();' 2>/dev/null || date +%s)
-	$BUILDPREFIX $MAKE -j "$cpus" DOTCONFIG="$TMPCFG" obj="$TARGET/temp" objutil="$TARGET/sharedutils" tools > "$TARGET/sharedutils/make.log" 2>&1
+	$BUILDPREFIX "$MAKE" -j "$cpus" DOTCONFIG="$TMPCFG" obj="$TARGET/temp" objutil="$TARGET/sharedutils" tools > "$TARGET/sharedutils/make.log" 2>&1
 	local ret=$?
 	etime=$(perl -e 'print time();' 2>/dev/null || date +%s)
 	local duration=$(( etime - stime ))
@@ -831,8 +833,6 @@
 }
 fi
 
-debug "ROOT=$ROOT"
-
 junit '<?xml version="1.0" encoding="utf-8"?>'
 junit '<testsuite>'
 

-- 
To view, visit https://review.coreboot.org/27597
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7f869e6d208f7247f739619c538be6075b802719
Gerrit-Change-Number: 27597
Gerrit-PatchSet: 1
Gerrit-Owner: Martin Roth <martinroth at google.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180723/70b0ee16/attachment-0001.html>


More information about the coreboot-gerrit mailing list