diff options
-rwxr-xr-x | sbqrun | 90 |
1 files changed, 90 insertions, 0 deletions
@@ -0,0 +1,90 @@ +#!/bin/bash + +# sbrun wrapper, runs multiple builds. + +# usage: sbqrun arg [arg ...] + +if [ "$1" = "" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then + cat <<EOF +Usage: $( basename $0 ) [-n] [-t] arg [arg ...] + +Run this script from the top level of a SBo repo clone! + +If arg is a file, its contents are added to the list of builds. Use - +to read a list of builds from stdin (possibly piped from sbodeps -q). + +If arg is a directory, it's added to the list. + +If arg is neither, it's assumed to be a bare build name (with no category/ +directory) and searched for. + +Full sbopkg queue syntax is NOT supported, only a simple list of builds +(no |VAR=value, no @file, no -app). If you need sbopkg, use sbopkg! + +Once the list is built, each build is downloaded with sbodl, built with +sbrun -c, and installed with upkg, in the order given. If the -n and/or +-t options are given, they will be passed to sbrun. +EOF + exit 0 +fi + +source ~/sbostuff/sbostuff.sh +cdsb + +for arg; do + if [ "$arg" = "-t" -o "$arg" = "-n" ]; then + SBRUN_OPTS="$SBRUN_OPTS $arg" + elif [ "$arg" = "-" ]; then + while read build; do + BUILDS="$BUILDS $build" + done + elif [ -f "$arg" ]; then + BUILDS="$BUILDS `cat $arg`" + elif [ -d "$arg" ]; then + BUILDS="$BUILDS $arg" + else + arg=$( echo */$arg ) + if [ -d "$arg" ]; then + BUILDS="$BUILDS $arg" + else + echo "!!! no idea what '$arg' is, skipping" + fi + fi +done + +FAILED="" +COUNT=0 +FAILCOUNT=0 + +for build in $BUILDS; do + : $(( COUNT ++ )) + echo "==== sbqrun: COUNT=$COUNT, FAILCOUNT=$FAILCOUNT, starting $build" + if ! cdsb "$build"; then + echo "==== sbqrun: ERROR: no such build: $build" + FAILED+="$build " + : $(( FAILCOUNT ++ )) + continue + fi + + sbodl || echo "==== sbqrun: WARN: download failed, trying build anyway" + + if ! sbrun -c $SBRUN_OPTS; then + echo "==== sbqrun: BUILD FAILED: $build, see $(pwd)/build.log" + FAILED+="$build " + : $(( FAILCOUNT ++ )) + else + if ! upkg; then + echo "==== sbqrun: $build built, but FAILED to install" + : $(( FAILCOUNT ++ )) + fi + fi +done + +echo "==== Processed $COUNT builds" +if [ "$FAILCOUNT" = "0" ]; then + echo "==== No failures" + exit 0 +else + echo "==== $FAILCOUNT build failures: $FAILED" + exit 1 +fi |