building rc23/umts
[infrastructure.git] / scripts / all-builds.sh
index d4808a2..e91f794 100755 (executable)
@@ -1,23 +1,46 @@
 #!/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
+# http://svn.onelab.eu/infrastructure/scripts/all-builds.sh
+# it is triggered every night at 0:05 french time on build.onelab.eu aka blitz.inria.fr
 
 COMMAND=$(basename $0)
 
 function usage () {
-    echo "Usage: $COMMAND"
+    echo "Usage: $COMMAND [options [ -- vbuild-nightly-options ]]"
     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 "MAJOR_DISTROS (-d) TRUNK_DISTROS (-td) TRUNK_FCDISTROS (-tf) VS_DISTROS (-vd)"
     echo "FCDISTROS (-f) BITS (-i) BASE (-b)"
-    echo "RETRY (-O) TEST (-T) DRY_RUN (-n)"
+    echo "BUILD_BRANCH (-bb) BUILD_TRUNK (-bt)"
+    echo "Overwrite (-o) TEST (-T) DRY_RUN (-n)"
     echo "Use at least one space for blanking a set of distros"
     exit 1
 }
 
+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;;
+       f?)             echo $distro;;
+       centos5)        echo c5;;
+       *)              echo xx;;
+    esac
+}
+
 # comment off for usual dailies
+#MAJOR=5.0
+#MINOR=rc01
 MAJOR=4.2
-MINOR=rc4
+MINOR=rc23
+base_option=-b
 
 while [[ -n "$@" ]] ; do
     case "$1" in
@@ -25,35 +48,63 @@ while [[ -n "$@" ]] ; do
        -f) shift ; FCDISTROS="$FCDISTROS $1" ;;
        -i) shift ; BITS="$BITS $1" ;;
        -td) shift; TRUNK_DISTROS="$1" ;;
+       -tf) shift; TRUNK_FCDISTROS="$1" ;;
        -vd) shift; VS_DISTROS="$1" ;;
        -b) shift; BASE="$1" ;;
-       -O) RETRY=true ;;
+       -bb) BUILD_BRANCH=true ;;
+       -bt) BUILD_TRUNK=true ;;
+       -o) base_option=-o ;;
        -T) TEST=true ;;
        -n) DRY_RUN=true ;;
        -z) MINOR="" ;;
+       --) shift; extra_option="$@" ; shift $# ;;
        *) usage ;;
     esac
     shift
 done
 
-DEFAULT_FCDISTROS="f8"
-DEFAULT_BITS="32 64"
+FCDISTRO=centos5
+DEFAULT_FCDISTROS="centos5"
 DEFAULT_BASE="@DATE@"
 
-if [ -z "$MINOR" ] ; then
+function trunk_builds () {
+    DEFAULT_BITS="32 64"
     DEFAULT_MAJOR_DISTROS=""
     DEFAULT_VS_DISTROS=""
-    DEFAULT_TRUNK_DISTROS="onelab planetlab"
-    BUILDOPT=""
-else
-    DEFAULT_MAJOR_DISTROS="planetlab onelab"
+# 5.0 ready for planetlab distro only so far
+    DEFAULT_TRUNK_DISTROS="planetlab"
+#    DEFAULT_TRUNK_DISTROS="onelab planetlab"
+    DEFAULT_TRUNK_FCDISTROS="f8 f9"
+}
+
+function branch_builds () {
+    DEFAULT_BITS="32 64"
+    DEFAULT_MAJOR_DISTROS="onelab planetlab"
+    DEFAULT_VS_DISTROS=""
+    DEFAULT_BITS="32"
+    DEFAULT_TRUNK_DISTROS=""
+    DEFAULT_TRUNK_FCDISTROS=""
+}
+
+function tagged_builds () {
+    DEFAULT_BITS="32 64"
+    DEFAULT_MAJOR_DISTROS="onelab planetlab"
     DEFAULT_VS_DISTROS="onelab"
     DEFAULT_TRUNK_DISTROS=""
+    DEFAULT_TRUNK_FCDISTROS=""
+}
+
+if [ -n "$BUILD_BRANCH" ] ; then
+    branch_builds
+    BUILDOPT="-s http://svn.planet-lab.org/svn/build/branches/${MAJOR}"
+elif [ -n "$BUILD_TRUNK" ] ; then
+    trunk_builds
+    BUILDOPT=""
+else
+    tagged_builds
     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
@@ -61,42 +112,28 @@ if [ -z "$MAJOR_DISTROS" ] ;       then MAJOR_DISTROS=$DEFAULT_MAJOR_DISTROS ;     else ma
 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 "$TRUNK_FCDISTROS" ] ; then TRUNK_FCDISTROS=$DEFAULT_TRUNK_FCDISTROS ; 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 "$TEST" ] &&      { extra_option="$extra_option -T" ; }
 [ -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
-}
-
 ############################## ${MAJOR}
-for d in $MAJOR_DISTROS ; do
+for bits in $BITS; do
     for f in $FCDISTROS ; do 
-       for bits in $BITS; do
+       for d in $MAJOR_DISTROS ; do
            p=linux${bits}
            s=$(shortname $d)
-           if [ -z "$MINOR" ] ; then
+           if [ -n "$BUILD_BRANCH" ] ; then
+               buildname="${d}-${MAJOR}-${BASE}-${f}-${bits}"
+           elif [ -n "$BUILD_TRUNK" ] ; then
                buildname="${BASE}--${s}.${MAJOR}--${f}-${bits}"
            else
-               buildname="${d}-${MAJOR}-${MINOR}.1lab-${f}-${bits}"
+               buildname="${d}-${MAJOR}-${MINOR}-${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"
+               ${base_option} $buildname $extra_option"
            run $command
        done
     done
@@ -111,14 +148,16 @@ if [ -z "$TEST" ] ; then
        for bits in $BITS ; do
            p=linux${bits}
            s=$(shortname $d)
-           if [ -z "$MINOR" ] ; then
-               buildname="${BASE}--${s}.${MAJOR}--${f}-${bits}"
+           if [ -n "$BUILD_BRANCH" ] ; then 
+               buildname="${d}-${MAJOR}-${BASE}-vs-${f}-${bits}"
+           elif [ -n "$BUILD_TRUNK" ] ; then
+               buildname="${BASE}--${s}.${MAJOR}--vs-${f}-${bits}"
            else
-               buildname="${d}-${MAJOR}-${MINOR}.1lab-${f}-${bits}"
+               buildname="${d}-${MAJOR}-${MINOR}-vs-${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"
+           ${base_option} $buildname -B $extra_option vserver"
            run $command
        done
     done
@@ -126,15 +165,28 @@ 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
+for bits in $BITS; do
+
+    for d in $TRUNK_DISTROS; do
+       ds=$(shortname $d)
        p=linux${bits}
-       s=$(shortname $d)
-       buildname="${BASE}--tr${s}-${bits}"
+       f=$FCDISTRO
+       fs=$(shortname $f)
+       buildname="${BASE}--tr${fs}-${ds}-${bits}"
        command="/root/bin/vbuild-nightly.sh -m onelab-build@one-lab.org ${BUILDOPT} \
-        -d $d -p $p -b $buildname $extra_option"
+        -d $d -p $p -f $f ${base_option} $buildname $extra_option"
        run $command
     done
-done
 
+    for f in $TRUNK_FCDISTROS; do 
+       fs=$(shortname $f)      
+       p=linux${bits}
+       d=planetlab
+       ds=$(shortname $d)
+       buildname="${BASE}--tr${fs}-${ds}-${bits}"
+       command="/root/bin/vbuild-nightly.sh -m onelab-build@one-lab.org ${BUILDOPT} \
+        -d $d -p $p -f $f ${base_option} $buildname $extra_option"
+       run $command
+    done
+done
 ##############################