do not invoke centos builds when re-testing
[infrastructure.git] / scripts / all-builds.sh
index a461d6d..55ce3a4 100755 (executable)
@@ -7,11 +7,25 @@ COMMAND=$(basename $0)
 
 function usage () {
     echo "Usage: $COMMAND"
-    echo "In manual mode you should export either of these"
-    echo "PLDISTROS FCDISTROS BITS RETRY TEST DRY_RUN"
+    echo "In manual mode you should export the following vars (or use related option)"
+    echo "PLDISTROS (-d) FCDISTROS (-f) BITS (-b) TRUNK_DISTRO (-td) RETRY (-O) TEST (-T) DRY_RUN (-n)"
     exit 1
 }
 
+while [[ -n "$@" ]] ; do
+    case "$1" in
+       -d) shift ; PLDISTROS="$PLDISTROS $1" ;;
+       -f) shift ; FCDISTROS="$FCDISTROS $1" ;;
+       -b) shift ; BITS="$BITS $1" ;;
+       -td) shift; TRUNK_DISTRO="$1" ;;
+       -O) RETRY=true ;;
+       -T) TEST=true ;;
+       -n) DRY_RUN=true ;;
+       *) usage ;;
+    esac
+    shift
+done
+
 [[ -n "$@" ]] && usage
 
 # tuned for allowing manual re-runs, mostly for tests
@@ -19,57 +33,78 @@ function usage () {
 DEFAULT_PLDISTROS="planetlab onelab"
 DEFAULT_FCDISTROS="f8"
 DEFAULT_BITS="32 64"
+DEFAULT_TRUNK_DISTRO=onelab
 
 # export any of these to override - this is for manual use only
-if [ -z "$PLDISTROS" ] ; then PLDISTROS=$DEFAULT_PLDISTROS ; else manual=true ; fi
-if [ -z "$FCDISTROS" ] ; then FCDISTROS=$DEFAULT_FCDISTROS ; else manual=true ; fi
-if [ -z "$BITS" ] ;     then BITS=$DEFAULT_BITS ;           else manual=true ; fi
+if [ -z "$PLDISTROS" ] ;       then PLDISTROS=$DEFAULT_PLDISTROS ;             else manual=true ; fi
+if [ -z "$FCDISTROS" ] ;       then FCDISTROS=$DEFAULT_FCDISTROS ;             else manual=true ; fi
+if [ -z "$BITS" ] ;            then BITS=$DEFAULT_BITS ;                       else manual=true ; fi
+if [ -z "$TRUNK_DISTRO" ] ;    then TRUNK_DISTRO=$DEFAULT_TRUNK_DISTRO ;       else manual=true ; fi
 [ -n "$RETRY" ] &&     { extra_option="$extra_option -o" ; manual=true ; }
 [ -n "$TEST" ] &&      { extra_option="$extra_option -T" ; manual=true ; }
 [ -n "$DRY_RUN" ] &&   { manual=true ; }
 
+function run () {
+    [ -n "$manual" ] && echo "$@"
+    if [ -z "$DRY_RUN" ] ; then
+       "$@"
+    fi
+}
+
+function shortname () {
+    distro=$1; shift
+    case $distro in
+       onelab)         echo 1l;;
+       planetlab)      echo pl;;
+       *)              echo xx;;
+    esac
+}
+
+############################## 4.2
 for d in $PLDISTROS ; do
     for f in $FCDISTROS ; do 
        for bits in $BITS; do
            p=linux${bits}
+           s=$(shortname $d)
+           buildname="@DATE@--${s}.4.2--${f}-${bits}"
+#          buildname="${d}-4.2-rc2.1lab-${f}-${bits}"
            command="/root/bin/vbuild-nightly.sh -m onelab-build@one-lab.org \
-               -f $f -p $p -d $d \
-               -t ${d}-tags-4.2.mk \
-               -b @DATE@--${d}.4.2--${f}-${bits} $extra_option"
-           [ -n "$manual" ] && echo $command
-           if [ -n "$DRY_RUN" ] ; then
-               echo "dry-run: skipped"
-           else
-               $command
-           fi
+               -d $d -p $p -f $f -t ${d}-tags-4.2.mk \
+               -b $buildname $extra_option"
+           run $command
        done
     done
 done
 
-# raw - std planetlab x f8 x 32bits for deploying on alpha nodes
-command="/root/bin/vbuild-nightly.sh -m onelab-build@one-lab.org -b @DATE@-trunk"
-if [ -n "$manual" ] ; then
-    echo $command
-    echo "manual/dry_run: skipped"
-else
-    $command
+############################## 4.2/centos5
+# centos5 : for both archs, make the vserver rpms
+# does not test, so skip if test is requested
+if [ -z "$TEST" ] ; then
+    f=centos5
+    for d in $TRUNK_DISTRO ; do
+       for bits in $BITS ; do
+           p=linux${bits}
+           s=$(shortname $d)
+           buildname="@DATE@--tr${s}-c5vs-${bits}"
+#          buildname="${d}-4.2-rc2.1lab-${f}-${bits}"
+           command="/root/bin/vbuild-nightly.sh -m onelab-build@one-lab.org \
+           -d $d -p $p -f $f -t ${d}-tags-4.2.mk \
+           -b $buildname -B vserver"
+           run $command
+       done
+    done
 fi
 
-# the following gets skipped in any manual mode 
-# centos5 : for both archs, make the vserver rpms
-for d in onelab ; do
-    for bits in 32 64; do
+############################## TRUNK
+# raw - std planetlab x f8 x 32bits for deploying on alpha nodes
+for d in $TRUNK_DISTRO; do
+    for bits in $BITS; do
        p=linux${bits}
+       s=$(shortname $d)
+       buildname="@DATE@--tr${s}-${bits}"
        command="/root/bin/vbuild-nightly.sh -m onelab-build@one-lab.org \
-           -f centos5 -p $p -d $d \
-           -t ${d}-tags-4.2.mk \
-           -b @DATE@--${d}.4.2--c5vs-${bits} \
-           -B vserver"
-       if [ -n "$manual" ] ; then
-           echo $command
-           echo "manual/dry_run: skipped"
-       else
-           $command
-       fi
+        -d $d -p $p -b $buildname $extra_option"
+       run $command
     done
 done
+