rc16
[infrastructure.git] / scripts / all-builds.sh
index d010298..b5e258a 100755 (executable)
 #!/bin/bash
+# $Id$
 # this script is managed under subversion at 
 # http://svn.one-lab.org/infrastructure/scripts/all-builds.sh
 # it is triggered every night at 0:05 french time on build.one-lab.org aka blitz.inria.fr
 
-# tuned for allowing manual re-runs, mostly for tests
+COMMAND=$(basename $0)
+
+function usage () {
+    echo "Usage: $COMMAND"
+    echo "In manual mode you should export the following vars (or use related option)"
+    echo "MAJOR_DISTROS (-d) TRUNK_DISTROS (-td) VS_DISTROS (-vd)"
+    echo "FCDISTROS (-f) BITS (-i) BASE (-b)"
+    echo "RETRY (-O) TEST (-T) DRY_RUN (-n)"
+    echo "Use at least one space for blanking a set of distros"
+    exit 1
+}
+
+# comment off for usual dailies
+MAJOR=4.2
+MINOR=rc16
+
+while [[ -n "$@" ]] ; do
+    case "$1" in
+       -d) shift ; MAJOR_DISTROS="$MAJOR_DISTROS $1" ;;
+       -f) shift ; FCDISTROS="$FCDISTROS $1" ;;
+       -i) shift ; BITS="$BITS $1" ;;
+       -td) shift; TRUNK_DISTROS="$1" ;;
+       -vd) shift; VS_DISTROS="$1" ;;
+       -b) shift; BASE="$1" ;;
+       -O) RETRY=true ;;
+       -T) TEST=true ;;
+       -n) DRY_RUN=true ;;
+       -z) MINOR="" ;;
+       *) usage ;;
+    esac
+    shift
+done
 
-DEFAULT_PLDISTROS="planetlab onelab"
 DEFAULT_FCDISTROS="f8"
 DEFAULT_BITS="32 64"
+DEFAULT_BASE="@DATE@"
+
+if [ -z "$MINOR" ] ; then
+    DEFAULT_MAJOR_DISTROS=""
+    DEFAULT_VS_DISTROS=""
+# 5.0 ready for planetlab distro only so far
+    DEFAULT_TRUNK_DISTROS="planetlab"
+#    DEFAULT_TRUNK_DISTROS="onelab planetlab"
+    BUILDOPT=""
+else
+    DEFAULT_MAJOR_DISTROS="planetlab onelab"
+    DEFAULT_VS_DISTROS="onelab"
+    DEFAULT_TRUNK_DISTROS=""
+    BUILDOPT="-s http://svn.planet-lab.org/svn/build/tags/${MAJOR}-${MINOR}"
+fi
+
+
+
+[[ -n "$@" ]] && usage
 
 # export any of these to override - this is for manual use only
-[ -z "$PLDISTROS" ] && { PLDISTROS=$DEFAULT_PLDISTROS ; manual=true ; }
-[ -z "$FCDISTROS" ] && { FCDISTROS=$DEFAULT_FCDISTROS ; manual=true ; }
-[ -z "$BITS" ] &&      { BITS=$DEFAULT_BITS ; manual=true ; }
-[ -n "$RETRY" ] &&     { extra_option="$extra_option -o" ; manual=true ; }
+if [ -z "$MAJOR_DISTROS" ] ;   then MAJOR_DISTROS=$DEFAULT_MAJOR_DISTROS ;     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_DISTROS" ] ;   then TRUNK_DISTROS=$DEFAULT_TRUNK_DISTROS ;     else manual=true ; fi
+if [ -z "$VS_DISTROS" ] ;      then VS_DISTROS=$DEFAULT_VS_DISTROS ;           else manual=true ; fi
+if [ -z "$BASE" ] ;            then BASE=$DEFAULT_BASE ;                       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 ; }
 
-for d in $PLDISTROS ; do
+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
+}
+
+############################## ${MAJOR}
+for d in $MAJOR_DISTROS ; do
     for f in $FCDISTROS ; do 
        for bits in $BITS; do
            p=linux${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} $test_option
-           [ -n "$manual" ] && echo $command
-           if [ -n "$DRY_RUN" ] ; then
-               echo "dry-run: skipped"
+           s=$(shortname $d)
+           if [ -z "$MINOR" ] ; then
+               buildname="${BASE}--${s}.${MAJOR}--${f}-${bits}"
            else
-               $command
+               buildname="${d}-${MAJOR}-${MINOR}.1lab-${f}-${bits}"
            fi
+           command="/root/bin/vbuild-nightly.sh -m onelab-build@one-lab.org ${BUILDOPT} \
+               -d $d -p $p -f $f -t ${d}-tags-${MAJOR}.mk \
+               -b $buildname $extra_option"
+           run $command
        done
     done
 done
 
+############################## ${MAJOR}/centos5
 # centos5 : for both archs, make the vserver rpms
-for d in onelab ; do
-    for bits in 32 64; do
+# does not test, so skip if test is requested
+if [ -z "$TEST" ] ; then
+    f=centos5
+    for d in $VS_DISTROS ; do
+       for bits in $BITS ; do
+           p=linux${bits}
+           s=$(shortname $d)
+           if [ -z "$MINOR" ] ; then
+               buildname="${BASE}--${s}.${MAJOR}--${f}-${bits}"
+           else
+               buildname="${d}-${MAJOR}-${MINOR}.1lab-${f}-${bits}"
+           fi
+           command="/root/bin/vbuild-nightly.sh -m onelab-build@one-lab.org ${BUILDOPT} \
+           -d $d -p $p -f $f -t ${d}-tags-${MAJOR}.mk \
+           -b $buildname -B vserver"
+           run $command
+       done
+    done
+fi
+
+############################## TRUNK
+# raw - std planetlab x f8 x 32bits for deploying on alpha nodes
+for d in $TRUNK_DISTROS; do
+    for bits in $BITS; do
        p=linux${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 "manual: skipped"
-       else
-           $command
-       fi
+       s=$(shortname $d)
+       buildname="${BASE}--tr${s}-${bits}"
+       command="/root/bin/vbuild-nightly.sh -m onelab-build@one-lab.org ${BUILDOPT} \
+        -d $d -p $p -b $buildname $extra_option"
+       run $command
     done
 done
+
+##############################