PageRenderTime 9ms CodeModel.GetById 2ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/contrib/ntp/flock-build

https://bitbucket.org/freebsd/freebsd-head/
Shell | 106 lines | 64 code | 19 blank | 23 comment | 5 complexity | 532530108aa77fb568a39c670af8f7d3 MD5 | raw file
  1#! /bin/sh
  2
  3BUILD_ARGS="$@"
  4PARSE="--enable-parse-clocks"
  5#PARSE=
  6STD="--enable-simulator"
  7
  8case "$SIMUL" in
  9 '') PARALLEL_BUILDS=1
 10     ;;
 11 *)  PARALLEL_BUILDS=$SIMUL
 12esac
 13
 14case "$PARALLEL_BUILDS" in
 15 1)  ;;
 16 *)  echo Launching $PARALLEL_BUILDS parallel builds on each machine
 17esac
 18
 19# Backroom:
 20#   barnstable	   freebsd-6.1
 21#   beauregard	   freebsd-6.0
 22# X churchy	   alpha-dec-osf5.1
 23#   deacon	   sparc-sun-solaris2.10
 24#   grundoon	   freebsd-6.2
 25#   howland	   freebsd-6.1
 26# o macabre	   freebsd-6.1-STABLE
 27# o mort	   freebsd-6.1
 28#   whimsy	   sparc-sun-solaris2.10
 29
 30# Campus:
 31# * baldwin	   sparc-sun-solaris2.10
 32# * bridgeport	   sparc-sun-solaris2.10
 33# * cowbird	   freebsd-6.1
 34# * malarky	   sparc-sun-solaris2.10
 35# * pogo	   sparc-sun-solaris2.10
 36# * rackety	   freebsd-6.1
 37
 38# HMS: we need $PWD because solaris produces /deacon/backroom when
 39# we are in /backroom and in general there is no /deacon/backroom.
 40c_d=${PWD:-`pwd`}
 41
 42SIG=`perl -e 'print rand'`
 43
 44case "$LIST" in
 45 '') LIST="baldwin bridgeport cowbird malarky pogo rackety" ;;
 46esac
 47
 48for i in $LIST
 49do
 50    SKIPTHIS=0
 51    [ -f .buildkey-$i ] && SKIPTHIS=1
 52    case "$SKIPTHIS" in
 53     1)
 54        echo flock-build running on $i? check LIST, skipping
 55        ;;
 56     0)   
 57        echo $i
 58        echo $SIG > .buildkey-$i
 59        case "1" in
 60         0)
 61            ssh $i "cd $c_d ; ./build $SIG $PARSE $STD $BUILD_ARGS" &
 62            ssh $i "cd $c_d ; ./build $SIG $PARSE $STD --without-crypto $BUILD_ARGS" &
 63            ssh $i "cd $c_d ; ./build $SIG        $STD --disable-all-clocks $BUILD_ARGS" &
 64            ;;
 65         1)
 66            cat > .flockbuild-$i-$SIG <<ENDQUOT
 67#!/bin/sh
 68
 69# depends on job control and expects to be invoked under ssh -tt
 70
 71cd $c_d
 72COUNT=0
 73
 74./build $SIG $PARSE $STD $BUILD_ARGS &
 75
 76COUNT=\`expr \$COUNT + 1\`
 77echo $i started build \$COUNT of 4
 78[ 0 -lt \`expr \$COUNT % $PARALLEL_BUILDS\` ] || wait
 79
 80./build $SIG $PARSE $STD --disable-debugging $BUILD_ARGS &
 81
 82COUNT=\`expr \$COUNT + 1\`
 83echo $i started build \$COUNT of 4
 84[ 0 -lt \`expr \$COUNT % $PARALLEL_BUILDS\` ] || wait
 85
 86./build $SIG $PARSE $STD --without-crypto $BUILD_ARGS &
 87
 88COUNT=\`expr \$COUNT + 1\`
 89echo $i started build \$COUNT of 4
 90[ 0 -lt \`expr \$COUNT % $PARALLEL_BUILDS\` ] || wait
 91
 92./build $SIG        $STD --disable-all-clocks $BUILD_ARGS &
 93
 94COUNT=\`expr \$COUNT + 1\`
 95echo $i started build \$COUNT of 4
 96wait
 97echo \`date -u '+%H:%M:%S'\` $i flock-build $c_d done.
 98rm .buildkey-$i
 99ENDQUOT
100           chmod +x .flockbuild-$i-$SIG
101           ssh -tt $i "$c_d/.flockbuild-$i-$SIG ; \
102                    rm $c_d/.flockbuild-$i-$SIG" 2>/dev/null &
103        esac
104    esac
105done
106echo `date -u '+%H:%M:%S'` flock-build launched