Mercurial > hg > aboriginal
changeset 454:ccca664cbac1
Upgrade build wrapper, teach wait4background to skip certain processes (such as ssh) mentioned in optional second argument.
author | Rob Landley <rob@landley.net> |
---|---|
date | Wed, 05 Nov 2008 00:55:28 -0600 |
parents | 61a26b8092bf |
children | e6259842abd5 |
files | sources/build-all-targets.sh sources/functions.sh |
diffstat | 2 files changed, 12 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/sources/build-all-targets.sh Tue Nov 04 22:51:33 2008 -0600 +++ b/sources/build-all-targets.sh Wed Nov 05 00:55:28 2008 -0600 @@ -2,9 +2,8 @@ # Nightly snapshot build script. -# TODO: +# Wrapper can set: # -# Wrapper must set: # UPLOAD_TO=busybox.net:public_html/fwlnew # UNSTABLE=busybox,toybox,uClibc @@ -61,24 +60,20 @@ function build_this_target() { ./cross-compiler.sh $1 || dienow - [ ! -z "$SERVER" ] && - scp build/cross-compiler-$1.tar.bz2 ${SERVER}:${SERVERDIR} >/dev/null & ./mini-native.sh $1 || dienow - [ ! -z "$SERVER" ] && - scp build/mini-native-$1.tar.bz2 ${SERVER}:${SERVERDIR} >/dev/null & ./package-mini-native.sh $1 || dienonw - [ ! -z "$SERVER" ] && - scp build/system-image-$1.tar.bz2 ${SERVER}:${SERVERDIR} >/dev/null & } function build_log_upload() { - build_this_target $1 2>&1 | tee out-$1.txt - [ ! -z "$SERVER" ] && (cat out-$1 | bzip2 | ssh ${SERVER} \ - "cat > ${SERVERDIR}/buildlog-$(echo $1 | sed 's/^out-//').bz2") & + build_this_target $1 2>&1 | tee out-$1.txt | + tee >(bzip2 > build/buildlog-$1.txt.bz2) + [ -z "$SERVER" ] && return + scp build/{cross-compiler,mini-native,system-image}-$1.tar.bz2 \ + build/buildlog-$1.txt.bz2 ${SERVER}:${SERVERDIR} } -# Clean up old builds, fesh fresh packages. +# Clean up old builds, fetch fresh packages. (hg pull -u; ./download.sh || dienow) & rm -rf build out-*.txt & @@ -98,8 +93,8 @@ if [ "$1" == "--fork" ] then echo Launching $i - (build_log_upload $i 2>&1 </dev/null | grep ===) & - [ ! -z "$2" ] && wait4background $[${2}-1] + (build_log_upload $i 2>&1 </dev/null | grep "^==="; echo Completed $i ) & + [ ! -z "$2" ] && wait4background $[${2}-1] "ssh " else build_log_upload $i fi
--- a/sources/functions.sh Tue Nov 04 22:51:33 2008 -0600 +++ b/sources/functions.sh Wed Nov 05 00:55:28 2008 -0600 @@ -309,8 +309,10 @@ function wait4background() { + local EXCLUDE="$2" + [ -z "$EXCLUDE" ] && EXCLUDE="thisdoesnotmatchanything" # Wait for background tasks to finish - while [ $(jobs | wc -l) -gt $1 ] + while [ $(jobs | grep -v "$EXCLUDE" | wc -l) -gt $1 ] do sleep 1 # Without this next line, bash never notices a change in the number of jobs.