[coreboot-gerrit] Change in coreboot[master]: abuild: Treat command line for recursive invocations as bash...

Julius Werner (Code Review) gerrit at coreboot.org
Tue Mar 28 22:10:19 CEST 2017


Julius Werner has submitted this change and it was merged. ( https://review.coreboot.org/18975 )

Change subject: abuild: Treat command line for recursive invocations as bash array
......................................................................


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: I76a1c6456ef8ab21286fdc1636d659a3b76bc5d7
Signed-off-by: Julius Werner <jwerner at chromium.org>
Reviewed-on: https://review.coreboot.org/18975
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martinroth at google.com>
---
M util/abuild/abuild
1 file changed, 9 insertions(+), 6 deletions(-)

Approvals:
  build bot (Jenkins): Verified
  Martin Roth: Looks good to me, approved



diff --git a/util/abuild/abuild b/util/abuild/abuild
index 93ceac5..95711a1 100755
--- a/util/abuild/abuild
+++ b/util/abuild/abuild
@@ -16,8 +16,8 @@
 
 #set -x # Turn echo on....
 
-ABUILD_DATE="Dec 6, 2016"
-ABUILD_VERSION="0.10.01"
+ABUILD_DATE="Mar 28, 2017"
+ABUILD_VERSION="0.10.02"
 
 TOP=$PWD
 
@@ -581,8 +581,8 @@
 export PATH=$PATH:util/abuild
 getopt - > /dev/null 2>/dev/null || gcc -o util/abuild/getopt util/abuild/getopt.c
 
-# command line for xargs parallelization. Thus overwrite -c X
-cmdline="$* -c 1"
+# Save command line for xargs parallelization.
+cmdline=("$@")
 
 # parse parameters.. try to find out whether we're running GNU getopt
 getoptbrand="$(getopt -V)"
@@ -735,6 +735,8 @@
 	local ABSPATH
 	local stime
 	local etime
+	local num_targets
+	local cpus_per_target
 
 	local targets=${*-$(get_mainboards)}
 	# seed shared utils
@@ -781,8 +783,9 @@
 		rmdir "${scanbuild_out}tmp"
 	fi
 	rm -rf "$TARGET/temp" "$TMPCFG"
-	# shellcheck disable=SC2086
-	echo $targets | xargs -P ${cpus:-0} -n 1 "$0" $cmdline -I -t
+	num_targets=$(wc -w <<<"$targets")
+	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
 

-- 
To view, visit https://review.coreboot.org/18975
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I76a1c6456ef8ab21286fdc1636d659a3b76bc5d7
Gerrit-PatchSet: 6
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Owner: Julius Werner <jwerner at chromium.org>
Gerrit-Reviewer: Aaron Durbin <adurbin at chromium.org>
Gerrit-Reviewer: Furquan Shaikh <furquan at google.com>
Gerrit-Reviewer: Julius Werner <jwerner at chromium.org>
Gerrit-Reviewer: Martin Roth <martinroth at google.com>
Gerrit-Reviewer: Patrick Georgi <pgeorgi at google.com>
Gerrit-Reviewer: Paul Menzel <paulepanter at users.sourceforge.net>
Gerrit-Reviewer: build bot (Jenkins)



More information about the coreboot-gerrit mailing list