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