shows failing module when a version/taglevel key cannot be found
[build.git] / vbuild-nightly.sh
index 5930019..ecd7007 100755 (executable)
@@ -18,8 +18,7 @@ DEFAULT_WEBPATH="/build/@PLDISTRO@/"
 
 # for the test part
 TESTBUILDURL="http://build.one-lab.org/"
-TESTBOX=onelab-test.inria.fr
-TESTBOXSSH=root@onelab-test.inria.fr
+TESTBOXSSH=root@testbox1.one-lab.org
 ####################
 # assuming vserver runs in UTC
 DATE=$(date +'%Y.%m.%d')
@@ -118,34 +117,6 @@ function success () {
     exit 0
 }
 
-# parses ifconfig's output to find out ip address and mask
-# will then be passed to vserver as e.g. --interface 138.96.250.126/255.255.0.0
-# default is to use lo, that's enough for local mirrors
-# use -i eth0 in case your fedora mirror is on a separate box on the network
-function vserverIfconfig () {
-    ifname=$1; shift
-    local result="" 
-    line=$(ifconfig $ifname 2> /dev/null | grep 'inet addr')
-    if [ -n "$line" ] ; then
-       set $line
-       for word in "$@" ; do
-           addr=$(echo $word | sed -e s,[aA][dD][dD][rR]:,,)
-           mask=$(echo $word | sed -e s,[mM][aA][sS][kK]:,,)
-           if [ "$word" != "$addr" ] ; then
-               result="${addr}"
-           elif [ "$word" != "$mask" ] ; then
-               result="${result}/${mask}"
-           fi
-       done
-    fi
-    if [ -z "$result" ] ; then 
-       echo "vserverIfconfig failed to locate $ifname"
-       exit 1
-    else
-       echo $result
-    fi
-}
-
 # run in the vserver - do not manage success/failure, will be done from the root ctx
 function build () {
     set -x
@@ -189,13 +160,13 @@ function runtest () {
     echo -n "============================== Starting $COMMAND:runtest on $(date)"
 
     ### the URL to the myplc package
-    rpm=$( (cd /vservers/$BASE/build/RPMS/i386 ; ls myplc-[0-9]*.rpm) )
+    rpm=$( find /vservers/$BASE/build/RPMS -name 'myplc-[0-9]*' )
     if [ ${#rpm[@]} != 1 ] ; then
        echo "$COMMAND: Cannot locate rpm for testing"
        failure
        exit 1
     fi
-    url=${TESTBUILDURL}${PLDISTRO}/${BASE}/RPMS/i386/${rpm}
+    url=$(echo $rpm | sed -e "s,/vservers/$BASE/build,${TESTBUILDURL}${PLDISTRO}/${BASE},")
 
     # compute test directory name on test box
     testdir=test-${BASE}
@@ -252,7 +223,7 @@ function usage () {
     echo " -m mailto"
     echo " -a makevar=value - space in values are not supported"
     echo " -w webpath - defaults to $DEFAULT_WEBPATH"
-    echo " -i ifname - defaults to $DEFAULT_IFNAME - set to e.g. eth0 for non-local mirrors"
+    echo " -i ifname - defaults to $DEFAULT_IFNAME - used to determine local IP"
     echo " -B : run build only"
     echo " -T : run test only"
     echo " -x testsvnpath - defaults to $DEFAULT_TESTSVNPATH"
@@ -265,10 +236,6 @@ function main () {
 
     set -e
 
-    # preserve arguments for passing them again later
-    declare -a argv
-    for arg in "$@"; do argv=(${argv[@]} "$arg") ; done
-    
     # parse arguments
     MAKEVARS=()
     DRY_RUN=
@@ -298,7 +265,11 @@ function main () {
        esac
     done
        
-    shift $(($OPTIND - 1))
+    # preserve options for passing them again later, together with expanded base
+    declare -a options
+    toshift=$(($OPTIND - 1))
+    arg=1; while [ $arg -le $toshift ] ; do options=(${options[@]} "$1") ; shift; arg=$(($arg+1)) ; done
+
     MAKETARGETS="$@"
     
     # set defaults
@@ -374,8 +345,7 @@ function main () {
            svn export $SVNPATH $tmpdir
             # Create vserver
            cd $tmpdir
-           localip=$(vserverIfconfig $IFNAME)
-           ./vbuild-init-vserver.sh -f ${FCDISTRO} -d ${PLDISTRO} -p ${PERSONALITY} ${BASE} -- --interface $localip
+           ./vbuild-init-vserver.sh -f ${FCDISTRO} -d ${PLDISTRO} -p ${PERSONALITY} -i ${IFNAME} ${BASE} 
            # cleanup
            cd -
            rm -rf $tmpdir
@@ -402,7 +372,7 @@ function main () {
 
            # invoke this command in the vserver for building (-T)
            vserver ${BASE} exec chmod +x /build/$COMMAND
-           vserver ${BASE} exec /build/$COMMAND "${argv[@]}" -b "${BASE}"
+           vserver ${BASE} exec /build/$COMMAND "${options[@]}" -b "${BASE}" $MAKETARGETS
        fi
 
        # publish to the web so runtest can find them