Home | History | Annotate | Line # | Download | only in dist
flock-build revision 1.1.1.1.6.1
      1          1.1  kardel #! /bin/sh
      2          1.1  kardel 
      3          1.1  kardel IAM=`hostname || uname -n`
      4          1.1  kardel MYNAME=`IFS=. ; set $IAM ; echo $1`
      5          1.1  kardel 
      6          1.1  kardel case "$1" in
      7          1.1  kardel  '--one'|'-1')
      8          1.1  kardel      shift
      9          1.1  kardel      FB_FIRSTONLY=1
     10          1.1  kardel      LIST=$MYNAME
     11          1.1  kardel      ;;
     12          1.1  kardel  *)
     13          1.1  kardel      FB_FIRSTONLY=0
     14          1.1  kardel esac
     15          1.1  kardel 
     16          1.1  kardel BUILD_ARGS="$@"
     17          1.1  kardel PARSE="--enable-parse-clocks"
     18          1.1  kardel #PARSE=
     19          1.1  kardel STD="--enable-simulator"
     20          1.1  kardel 
     21  1.1.1.1.6.1    yamt case "$SIMUL::$FB_FIRSTONLY" in
     22  1.1.1.1.6.1    yamt  ::*)
     23  1.1.1.1.6.1    yamt     PARALLEL_BUILDS=1
     24  1.1.1.1.6.1    yamt     ;;
     25  1.1.1.1.6.1    yamt  *::0)
     26  1.1.1.1.6.1    yamt     PARALLEL_BUILDS=$SIMUL
     27  1.1.1.1.6.1    yamt     ;;
     28  1.1.1.1.6.1    yamt  *)
     29  1.1.1.1.6.1    yamt     PARALLEL_BUILDS=1
     30          1.1  kardel esac
     31          1.1  kardel 
     32          1.1  kardel case "$PARALLEL_BUILDS" in
     33          1.1  kardel  1)  ;;
     34          1.1  kardel  *)  echo Launching $PARALLEL_BUILDS parallel builds on each machine
     35          1.1  kardel esac
     36          1.1  kardel 
     37          1.1  kardel # Backroom:
     38          1.1  kardel #   barnstable	   freebsd-6.1
     39          1.1  kardel #   beauregard	   freebsd-6.0
     40          1.1  kardel # X churchy	   alpha-dec-osf5.1
     41          1.1  kardel #   deacon	   sparc-sun-solaris2.10
     42          1.1  kardel #   grundoon	   freebsd-6.2
     43          1.1  kardel #   howland	   freebsd-6.1
     44          1.1  kardel # o macabre	   freebsd-6.1-STABLE
     45          1.1  kardel # o mort	   freebsd-6.1
     46          1.1  kardel #   whimsy	   sparc-sun-solaris2.10
     47          1.1  kardel 
     48          1.1  kardel # Campus:
     49          1.1  kardel # * baldwin	   sparc-sun-solaris2.10
     50          1.1  kardel # * bridgeport	   sparc-sun-solaris2.10
     51          1.1  kardel # * malarky	   sparc-sun-solaris2.10
     52          1.1  kardel # * pogo	   sparc-sun-solaris2.10
     53          1.1  kardel # * rackety	   freebsd-6.1
     54          1.1  kardel 
     55          1.1  kardel # HMS: we need $PWD because solaris produces /deacon/backroom when
     56          1.1  kardel # we are in /backroom and in general there is no /deacon/backroom.
     57          1.1  kardel c_d=${PWD:-`pwd`}
     58          1.1  kardel 
     59          1.1  kardel SIG=`perl -e 'print rand'`
     60          1.1  kardel 
     61          1.1  kardel case "$LIST" in
     62          1.1  kardel  '') LIST="malarky rackety" ;;
     63          1.1  kardel esac
     64          1.1  kardel 
     65          1.1  kardel for i in $LIST
     66          1.1  kardel do
     67          1.1  kardel     SKIPTHIS=0
     68          1.1  kardel     [ -f .buildkey-$i ] && SKIPTHIS=1
     69          1.1  kardel     case "$SKIPTHIS" in
     70          1.1  kardel      1)
     71  1.1.1.1.6.1    yamt 	echo flock-build running on $i? check LIST, skipping
     72  1.1.1.1.6.1    yamt 	;;
     73  1.1.1.1.6.1    yamt      0)
     74  1.1.1.1.6.1    yamt 	echo $i
     75  1.1.1.1.6.1    yamt 	echo $SIG > .buildkey-$i
     76  1.1.1.1.6.1    yamt 	case "1" in
     77  1.1.1.1.6.1    yamt 	 0)
     78  1.1.1.1.6.1    yamt 	    ssh $i "cd $c_d ; ./build $SIG $PARSE $STD $BUILD_ARGS" &
     79  1.1.1.1.6.1    yamt 	    ssh $i "cd $c_d ; ./build $SIG $PARSE $STD --without-crypto $BUILD_ARGS" &
     80  1.1.1.1.6.1    yamt 	    ssh $i "cd $c_d ; ./build $SIG        $STD --disable-all-clocks $BUILD_ARGS" &
     81  1.1.1.1.6.1    yamt 	    ;;
     82  1.1.1.1.6.1    yamt 	 1)
     83  1.1.1.1.6.1    yamt 	    cat > .flockbuild-$i-$SIG <<-ENDQUOT
     84          1.1  kardel 		#!/bin/sh
     85          1.1  kardel 
     86          1.1  kardel 		# script uses job control and expects to be invoked
     87          1.1  kardel 		# in a ssh session started with the -tt option, 
     88          1.1  kardel 		# which forces a pseudo-tty to be used.
     89          1.1  kardel 		
     90          1.1  kardel 		cd $c_d
     91          1.1  kardel 		COUNT=0
     92          1.1  kardel 
     93          1.1  kardel 		./build $SIG $PARSE $STD $BUILD_ARGS &
     94          1.1  kardel 
     95          1.1  kardel 		COUNT=\`expr \$COUNT + 1\`
     96          1.1  kardel 		echo \`date -u '+%H:%M:%S'\` $i started build \$COUNT of 4
     97          1.1  kardel 		[ 0 -lt \`expr \$COUNT % $PARALLEL_BUILDS\` ] || wait
     98          1.1  kardel 
     99          1.1  kardel 		case $FB_FIRSTONLY in
    100          1.1  kardel 		 '0')
    101          1.1  kardel 			./build $SIG $PARSE $STD --disable-debugging $BUILD_ARGS &
    102          1.1  kardel 
    103          1.1  kardel 			COUNT=\`expr \$COUNT + 1\`
    104          1.1  kardel 			echo \`date -u '+%H:%M:%S'\` $i started build \$COUNT of 4
    105          1.1  kardel 			[ 0 -lt \`expr \$COUNT % $PARALLEL_BUILDS\` ] || wait
    106          1.1  kardel 
    107          1.1  kardel 			./build $SIG $PARSE $STD --without-crypto $BUILD_ARGS &
    108          1.1  kardel 
    109          1.1  kardel 			COUNT=\`expr \$COUNT + 1\`
    110          1.1  kardel 			echo \`date -u '+%H:%M:%S'\` $i started build \$COUNT of 4
    111          1.1  kardel 			[ 0 -lt \`expr \$COUNT % $PARALLEL_BUILDS\` ] || wait
    112          1.1  kardel 
    113          1.1  kardel 			./build $SIG        $STD --disable-all-clocks $BUILD_ARGS &
    114          1.1  kardel 
    115          1.1  kardel 			COUNT=\`expr \$COUNT + 1\`
    116          1.1  kardel 			echo \`date -u '+%H:%M:%S'\` $i started build \$COUNT of 4
    117          1.1  kardel 			wait
    118          1.1  kardel 		esac
    119          1.1  kardel 		echo \`date -u '+%H:%M:%S'\` $i flock-build $c_d done.
    120          1.1  kardel 		rm .buildkey-$i
    121          1.1  kardel ENDQUOT
    122  1.1.1.1.6.1    yamt 	    chmod +x .flockbuild-$i-$SIG
    123  1.1.1.1.6.1    yamt 	    ssh -tt $i "$c_d/.flockbuild-$i-$SIG ; \
    124  1.1.1.1.6.1    yamt 		rm $c_d/.flockbuild-$i-$SIG" 2>/dev/null &
    125  1.1.1.1.6.1    yamt 	esac
    126          1.1  kardel     esac
    127          1.1  kardel done
    128          1.1  kardel echo `date -u '+%H:%M:%S'` flock-build launched
    129