catalyst-auto: Allow parallel building of spec sets
This assumes that the spec sets are logically independent from each other, i.e., building different ABIs. Code shamelessly adapted from locale-gen. Signed-off-by: Andreas K. Huettel <dilfridge@gentoo.org>
This commit is contained in:
parent
4e6ebec966
commit
e2d27f67f5
|
@ -23,6 +23,7 @@ testing=0
|
|||
preclean=0
|
||||
lastrun=0
|
||||
lock_file=
|
||||
parallel_sets=1
|
||||
|
||||
usage() {
|
||||
local msg=$1
|
||||
|
@ -38,6 +39,7 @@ Usage:
|
|||
Options:
|
||||
-c|--config Specifies the config file to use (required)
|
||||
-C|--preclean Clean up loose artifacts from previous runs
|
||||
-j|--jobs <n> Build <n> spec sets in parallel
|
||||
-v|--verbose Send output of commands to console as well as log
|
||||
-k|--keep-tmpdir Don't remove temp dir when build finishes
|
||||
-t|--test Stop after mangling specs and copying files
|
||||
|
@ -133,6 +135,10 @@ parse_args() {
|
|||
config_files+=("$1")
|
||||
shift
|
||||
;;
|
||||
-j|--jobs)
|
||||
parallel_sets="$1"
|
||||
shift
|
||||
;;
|
||||
-v|--verbose)
|
||||
verbose=$(($verbose+1))
|
||||
;;
|
||||
|
@ -385,7 +391,20 @@ run_catalyst_commands() {
|
|||
timeprefix=()
|
||||
which time >/dev/null && timeprefix=( "time" )
|
||||
|
||||
JOB_PIDS=()
|
||||
JOB_RETS=()
|
||||
JOB_IDX_S=0
|
||||
JOB_IDX_E=0
|
||||
|
||||
for a in "" ${SETS}; do
|
||||
|
||||
if [[ $(( JOB_IDX_E - JOB_IDX_S )) == ${parallel_sets} ]] ; then
|
||||
wait ${JOB_PIDS[$(( JOB_IDX_S++ ))]}
|
||||
JOB_RETS+=( $? )
|
||||
fi
|
||||
|
||||
(
|
||||
|
||||
if [[ -z ${a} ]]; then
|
||||
specs_var="SPECS"
|
||||
optional_specs_var="OPTIONAL_SPECS"
|
||||
|
@ -401,7 +420,7 @@ run_catalyst_commands() {
|
|||
if [[ $? != 0 ]]; then
|
||||
build_failure=1
|
||||
send_email "Catalyst fatal build error - ${i}" "" "${LOGFILE}"
|
||||
continue 2
|
||||
exit 1
|
||||
else
|
||||
trigger_post_build "${a}" "${i}"
|
||||
fi
|
||||
|
@ -424,8 +443,24 @@ run_catalyst_commands() {
|
|||
# in different build sets!
|
||||
|
||||
update_symlinks
|
||||
|
||||
exit ${build_failure}
|
||||
|
||||
)&
|
||||
|
||||
JOB_PIDS+=( $! )
|
||||
: $(( ++JOB_IDX_E ))
|
||||
|
||||
|
||||
done
|
||||
|
||||
for (( i = JOB_IDX_S; i < JOB_IDX_E; ++i )) ; do
|
||||
wait ${JOB_PIDS[i]}
|
||||
JOB_RETS+=( $? )
|
||||
done
|
||||
build_failure=$(( 0 ${JOB_RETS[@]/#/+} ))
|
||||
|
||||
|
||||
# Now do the cleanup
|
||||
for a in "" ${SETS}; do
|
||||
if [[ -z ${a} ]]; then
|
||||
|
|
Loading…
Reference in a new issue