Home | History | Annotate | Line # | Download | only in dist
flock-build revision 1.1.1.2.2.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 if [ ! -r sntp/libevent/build-aux/config.guess ] ; then
     56 	echo "Error: bootstrap required." 1>&2 && exit 1
     57 fi
     58 
     59 # HMS: we need $PWD because solaris produces /deacon/backroom when
     60 # we are in /backroom and in general there is no /deacon/backroom.
     61 c_d=${PWD:-`pwd`}
     62 
     63 SIG=`perl -e 'print rand'`
     64 
     65 case "$LIST" in
     66  '') LIST="pogo" ;;
     67 esac
     68 
     69 for i in $LIST
     70 do
     71     SKIPTHIS=0
     72     [ -f .buildkey-$i ] && SKIPTHIS=1
     73     case "$SKIPTHIS" in
     74      1)
     75 	echo flock-build running on $i? check LIST, skipping
     76 	;;
     77      0)
     78 	echo $i
     79 	echo $SIG > .buildkey-$i
     80 	case "1" in
     81 	 0)
     82 	    ssh $i "cd $c_d ; ./build $SIG $PARSE $STD $BUILD_ARGS" &
     83 	    ssh $i "cd $c_d ; ./build $SIG $PARSE $STD --disable-debugging $BUILD_ARGS" &
     84 	    ssh $i "cd $c_d ; ./build $SIG $PARSE $STD --without-crypto --enable-c99-snprintf $BUILD_ARGS" &
     85 	    ssh $i "cd $c_d ; ./build $SIG        $STD --disable-all-clocks --disable-autokey --without-sntp --disable-thread-support $BUILD_ARGS" &
     86 	    ;;
     87 	 1)
     88 	    cat > .flockbuild-$i-$SIG <<-ENDQUOT
     89 		#!/bin/sh
     90 
     91 		# script uses job control and expects to be invoked
     92 		# in a ssh session started with the -tt option, 
     93 		# which forces a pseudo-tty to be used.
     94 		
     95 		cd $c_d
     96 		COUNT=0
     97 
     98 		./build $SIG $PARSE $STD $BUILD_ARGS &
     99 
    100 		COUNT=\`expr \$COUNT + 1\`
    101 		echo \`date -u '+%H:%M:%S'\` $i started build \$COUNT of 4
    102 		[ 0 -lt \`expr \$COUNT % $PARALLEL_BUILDS\` ] || wait
    103 
    104 		case $FB_FIRSTONLY in
    105 		 '0')
    106 			./build $SIG $PARSE $STD --disable-debugging $BUILD_ARGS &
    107 
    108 			COUNT=\`expr \$COUNT + 1\`
    109 			echo \`date -u '+%H:%M:%S'\` $i started build \$COUNT of 4
    110 			[ 0 -lt \`expr \$COUNT % $PARALLEL_BUILDS\` ] || wait
    111 
    112 			./build $SIG $PARSE $STD --without-crypto --enable-c99-snprintf $BUILD_ARGS &
    113 
    114 			COUNT=\`expr \$COUNT + 1\`
    115 			echo \`date -u '+%H:%M:%S'\` $i started build \$COUNT of 4
    116 			[ 0 -lt \`expr \$COUNT % $PARALLEL_BUILDS\` ] || wait
    117 
    118 			./build $SIG        $STD --disable-all-clocks --disable-autokey --without-sntp --disable-thread-support $BUILD_ARGS &
    119 
    120 			COUNT=\`expr \$COUNT + 1\`
    121 			echo \`date -u '+%H:%M:%S'\` $i started build \$COUNT of 4
    122 			wait
    123 		esac
    124 		echo \`date -u '+%H:%M:%S'\` $i flock-build $c_d done.
    125 		rm .buildkey-$i
    126 ENDQUOT
    127 	    chmod +x .flockbuild-$i-$SIG
    128 	    ssh -tt $i "$c_d/.flockbuild-$i-$SIG ; \
    129 		rm $c_d/.flockbuild-$i-$SIG" 2>/dev/null &
    130 	esac
    131     esac
    132 done
    133 echo `date -u '+%H:%M:%S'` flock-build launched
    134