abuild: Fix shellcheck errors
Fix 6 new errors found by shellcheck 0.4.6 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@gmail.com> Reviewed-on: https://review.coreboot.org/27597 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Alex Thiessen <alex.thiessen.de+coreboot@gmail.com>
This commit is contained in:
parent
7a98591a1d
commit
5b7c6f52e6
|
@ -166,13 +166,16 @@ function mainboard_vendor
|
||||||
# If a directory contains multiple boards, returns them all.
|
# If a directory contains multiple boards, returns them all.
|
||||||
function normalize_target
|
function normalize_target
|
||||||
{
|
{
|
||||||
|
# TODO: Change 'targets' variable to an array
|
||||||
local targets
|
local targets
|
||||||
|
local VARIANT_UC
|
||||||
|
|
||||||
local VARIANT_UC=$(echo "${variant}" | tr '[:lower:]' '[:upper:]')
|
VARIANT_UC=$(echo "${variant}" | tr '[:lower:]' '[:upper:]')
|
||||||
|
|
||||||
targets=$(get_mainboards "$1")
|
targets=$(get_mainboards "$1")
|
||||||
if [ -n "$targets" ]; then
|
if [ -n "$targets" ]; then
|
||||||
targets=$(grep "${VARIANT_UC}\$" <<< ${targets})
|
# shellcheck disable=SC2086
|
||||||
|
targets="$(grep "${VARIANT_UC}\$" <<< ${targets})"
|
||||||
echo "$targets"
|
echo "$targets"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
@ -355,10 +358,10 @@ function compile_target
|
||||||
|
|
||||||
CURR=$( pwd )
|
CURR=$( pwd )
|
||||||
#stime=`perl -e 'print time();' 2>/dev/null || date +%s`
|
#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" ; \
|
&> "${build_dir}/make.log" ; \
|
||||||
MAKE_FAILED=$?
|
MAKE_FAILED=$?
|
||||||
cp ${ROOT}/.xcompile "${build_dir}/xcompile.build"
|
cp "${ROOT}/.xcompile" "${build_dir}/xcompile.build"
|
||||||
cd "${build_dir}" || return $?
|
cd "${build_dir}" || return $?
|
||||||
|
|
||||||
etime=$(perl -e 'print time();' 2>/dev/null || date +%s)
|
etime=$(perl -e 'print time();' 2>/dev/null || date +%s)
|
||||||
|
@ -459,7 +462,7 @@ function build_config
|
||||||
return
|
return
|
||||||
fi
|
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 ')
|
sed "s,^CONFIG_ARCH_[^_]*_\([^=]*\)=.*$,\1," |sort -u |tr 'A-Z\n\r' 'a-z ')
|
||||||
# shellcheck disable=SC2016,SC2059
|
# 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 -)
|
missing_arches=$(printf 'include .xcompile\nall: ; @echo $(foreach arch,'"$required_arches"',$(if $(filter $(arch),$(SUBARCH_SUPPORTED)),,$(arch)))' | $MAKE --no-print-directory -f -)
|
||||||
|
@ -800,7 +803,7 @@ build_targets()
|
||||||
local XMLFILE="$ABSPATH/__util.xml"
|
local XMLFILE="$ABSPATH/__util.xml"
|
||||||
rm -f "${XMLFILE}"
|
rm -f "${XMLFILE}"
|
||||||
stime=$(perl -e 'print time();' 2>/dev/null || date +%s)
|
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=$?
|
local ret=$?
|
||||||
etime=$(perl -e 'print time();' 2>/dev/null || date +%s)
|
etime=$(perl -e 'print time();' 2>/dev/null || date +%s)
|
||||||
local duration=$(( etime - stime ))
|
local duration=$(( etime - stime ))
|
||||||
|
@ -831,8 +834,6 @@ build_targets()
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
debug "ROOT=$ROOT"
|
|
||||||
|
|
||||||
junit '<?xml version="1.0" encoding="utf-8"?>'
|
junit '<?xml version="1.0" encoding="utf-8"?>'
|
||||||
junit '<testsuite>'
|
junit '<testsuite>'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue