mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
UPSTREAM: abuild: Treat command line for recursive invocations as bash array
This fix changes the $cmdline variable that is used for recursive
parallel abuild invocations through xargs from a string to a true bash
array (like $@). This allows bash to properly preserve and pass on
whitespace in parameters, like you get from invocations such as:
util/abuild/abuild -c 32 -t "MY_FIRST_BOARD MY_SECOND_BOARD"
Also add a mechanism to better spread CPUs across targets, since
otherwise we can leave a lot of CPUs idle if we're trying to build only
a few boards in parallel.
Change-Id: I01023ee909df1568b4aa26620176f17c33ebbce0
Original-Change-Id: I76a1c6456ef8ab21286fdc1636d659a3b76bc5d7
Original-Reviewed-on: https://review.coreboot.org/18975
Original-Tested-by: build bot (Jenkins)
Original-Reviewed-by: Martin Roth <martinroth@google.com>
Original-Commit-Id: 893eda0cc5
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/462004
This commit is contained in:
parent
c8fbfa6a31
commit
075dc0bf9d
1 changed files with 9 additions and 6 deletions
|
@ -16,8 +16,8 @@
|
||||||
|
|
||||||
#set -x # Turn echo on....
|
#set -x # Turn echo on....
|
||||||
|
|
||||||
ABUILD_DATE="Dec 6, 2016"
|
ABUILD_DATE="Mar 28, 2017"
|
||||||
ABUILD_VERSION="0.10.01"
|
ABUILD_VERSION="0.10.02"
|
||||||
|
|
||||||
TOP=$PWD
|
TOP=$PWD
|
||||||
|
|
||||||
|
@ -581,8 +581,8 @@ test "$ROOT" = "" && ROOT=$( cd ../.. && pwd )
|
||||||
export PATH=$PATH:util/abuild
|
export PATH=$PATH:util/abuild
|
||||||
getopt - > /dev/null 2>/dev/null || gcc -o util/abuild/getopt util/abuild/getopt.c
|
getopt - > /dev/null 2>/dev/null || gcc -o util/abuild/getopt util/abuild/getopt.c
|
||||||
|
|
||||||
# command line for xargs parallelization. Thus overwrite -c X
|
# Save command line for xargs parallelization.
|
||||||
cmdline="$* -c 1"
|
cmdline=("$@")
|
||||||
|
|
||||||
# parse parameters.. try to find out whether we're running GNU getopt
|
# parse parameters.. try to find out whether we're running GNU getopt
|
||||||
getoptbrand="$(getopt -V)"
|
getoptbrand="$(getopt -V)"
|
||||||
|
@ -735,6 +735,8 @@ build_targets()
|
||||||
local ABSPATH
|
local ABSPATH
|
||||||
local stime
|
local stime
|
||||||
local etime
|
local etime
|
||||||
|
local num_targets
|
||||||
|
local cpus_per_target
|
||||||
|
|
||||||
local targets=${*-$(get_mainboards)}
|
local targets=${*-$(get_mainboards)}
|
||||||
# seed shared utils
|
# seed shared utils
|
||||||
|
@ -781,8 +783,9 @@ build_targets()
|
||||||
rmdir "${scanbuild_out}tmp"
|
rmdir "${scanbuild_out}tmp"
|
||||||
fi
|
fi
|
||||||
rm -rf "$TARGET/temp" "$TMPCFG"
|
rm -rf "$TARGET/temp" "$TMPCFG"
|
||||||
# shellcheck disable=SC2086
|
num_targets=$(wc -w <<<"$targets")
|
||||||
echo $targets | xargs -P ${cpus:-0} -n 1 "$0" $cmdline -I -t
|
cpus_per_target=$(((${cpus:-1} + num_targets - 1) / num_targets))
|
||||||
|
echo "$targets" | xargs -P ${cpus:-0} -n 1 "$0" "${cmdline[@]}" -I -c "$cpus_per_target" -t
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue