smarter modules.update, was missing onelab-specific modules
[build.git] / vbuild-nightly.sh
index d529562..8e86a3d 100755 (executable)
@@ -10,7 +10,6 @@ DEFAULT_PLDISTRO=planetlab
 DEFAULT_PERSONALITY=linux32
 DEFAULT_BASE="@DATE@--@PLDISTRO@-@FCDISTRO@-@PERSONALITY@"
 DEFAULT_SVNPATH="http://svn.planet-lab.org/svn/build/trunk"
-# TESTSVNPATH to be computed from the -tags.mk file - no default anymore
 DEFAULT_TESTCONFIG="default"
 DEFAULT_IFNAME=eth0
 
@@ -157,8 +156,8 @@ function build () {
     make -C /build $DRY_RUN "${MAKEVARS[@]}" stage1=true 
     # versions
     make -C /build $DRY_RUN "${MAKEVARS[@]}" versions
-    # store testsvnpath
-    make -C /build $DRY_RUN "${MAKEVARS[@]}" stage1=true testsvnpath
+    # store tests_svnpath
+    make -C /build $DRY_RUN "${MAKEVARS[@]}" stage1=true tests_svnpath
     # actual stuff
     make -C /build $DRY_RUN "${MAKEVARS[@]}" $MAKETARGETS
 
@@ -173,16 +172,18 @@ function runtest () {
 
     echo -n "============================== Starting $COMMAND:runtest on $(date)"
 
-    # where to find TESTSVNPATH
-    stamp=/vservers/$BASE/build/testsvnpath
+    # where to find TESTS_SVNPATH
+    stamp=/vservers/$BASE/build/tests_svnpath
     if [ ! -f $stamp ] ; then
-       echo "$COMMAND: Cannot figure TESTSVNPATH from missing $stamp"
+       echo "$COMMAND: Cannot figure TESTS_SVNPATH from missing $stamp"
        failure
        exit 1
     fi
-    TESTSVNPATH=$(cat $stamp)
-    # use only this pat of the tests right now
-    TESTSVNPATH=${TESTSVNPATH}/system
+    TESTS_SVNPATH=$(cat $stamp)
+    # xxx - Thierry - need to rework the test framework in tests/system so it can work
+    # with the entire tests/ module checked out, rather than only tests/system/ 
+    # ugly workaround for now
+    SYSTEM_SVNPATH=${TESTS_SVNPATH}/system
 
     ### the URL to the RPMS/<arch> location
     url=""
@@ -204,8 +205,10 @@ function runtest () {
     testdir=${BASE}
     # clean it
     ssh -n ${TESTBOXSSH} rm -rf ${testdir}
-    # check it out
-    ssh -n ${TESTBOXSSH} svn co ${TESTSVNPATH} ${testdir}
+    # check it out 
+    ssh -n ${TESTBOXSSH} svn co ${SYSTEM_SVNPATH} ${testdir}
+    # check out the entire tests/ module (with system/ duplicated) as a subdir - see xxx above
+    ssh -n ${TESTBOXSSH} svn co ${TESTS_SVNPATH} ${testdir}/tests
     # invoke test on testbox - pass url and build url - so the tests can use vtest-init-vserver.sh
     configs=""
     for config in ${TESTCONFIG} ; do
@@ -230,6 +233,10 @@ function runtest () {
     echo -n "============================== End $COMMAND:runtest on $(date)"
 }
 
+function in_root_context () {
+    rpm -q util-vserver > /dev/null 
+}
+
 function show_env () {
     set +x
     echo FCDISTRO=$FCDISTRO
@@ -242,7 +249,7 @@ function show_env () {
     echo TAGSRELEASE="$TAGSRELEASE"
     echo -n "(might be unexpanded)"
     echo WEBPATH="$WEBPATH"
-    if [ -d /vservers ] ; then
+    if in_root_context ; then
        echo PLDISTROTAGS="$PLDISTROTAGS"
     else
        echo "XXXXXXXXXXXXXXXXXXXX Contents of tags definition file /build/$PLDISTROTAGS"
@@ -290,7 +297,7 @@ function main () {
     DRY_RUN=
     DO_BUILD=true
     DO_TEST=true
-    while getopts "f:d:p:b:t:r:s:x:c:w:y:g:um:OBTnv7a:i:" opt ; do
+    while getopts "f:d:p:b:t:r:s:x:c:w:g:u:m:OBTnyv7a:i:" opt ; do
        case $opt in
            f) FCDISTRO=$OPTARG ;;
            d) PLDISTRO=$OPTARG ;;
@@ -331,6 +338,8 @@ function main () {
     [ -z "$PLDISTROTAGS" ] && PLDISTROTAGS="${PLDISTRO}-tags.mk"
     [ -z "$BASE" ] && BASE="$DEFAULT_BASE"
     [ -z "$WEBPATH" ] && WEBPATH="$DEFAULT_WEBPATH"
+    [ -z "$GPGPATH" ] && GPGPATH="$DEFAULT_GPGPATH"
+    [ -z "$GPGUID" ] && GPGUID="$DEFAULT_GPGUID"
     [ -z "$IFNAME" ] && IFNAME="$DEFAULT_IFNAME"
     [ -z "$SVNPATH" ] && SVNPATH="$DEFAULT_SVNPATH"
     [ -z "$TESTCONFIG" ] && TESTCONFIG="$DEFAULT_TESTCONFIG"
@@ -342,7 +351,7 @@ function main () {
     BASE=$(echo ${BASE} | sed $sedargs)
     WEBPATH=$(echo ${WEBPATH} | sed $sedargs)
 
-    if [ ! -d /vservers ] ; then
+    if ! in_root_context ; then
         # in the vserver
        echo "==================== Within vserver BEG $(date)"
        build
@@ -468,11 +477,9 @@ function main () {
                 new_stamps="$new_stamps $stamp"
             fi
             # Or than yum-arch headers
-            [ -n "$have_yum_arch" ] && [ $package -nt $repository/headers/header.info ] && need_yum
-_arch=true
+            [ -n "$have_yum_arch" ] && [ $package -nt $repository/headers/header.info ] && need_yum_arch=true
             # Or than createrepo database
-            [ -n "$have_createrepo" ] && [ $package -nt $repository/repodata/repomd.xml ] && need_c
-reaterepo=true
+            [ -n "$have_createrepo" ] && [ $package -nt $repository/repodata/repomd.xml ] && need_createrepo=true
         done
 
         if [ -n "$new_rpms" ] ; then
@@ -487,7 +494,6 @@ reaterepo=true
                 --define "_gpg_path $GPGPATH" \
                 --define "_gpg_name $GPGUID" \
                 --resign $new_rpms && touch $new_stamps
-            check
         fi
 
          # Update repository index / yum metadata. 
@@ -497,7 +503,6 @@ reaterepo=true
             # .oldheaders and .olddata directories accidentally.
             rm -rf $repository/{.oldheaders,.olddata}
             yum-arch $repository
-            check
         fi
 
         if [ -n "$need_createrepo" ] ; then
@@ -506,7 +511,6 @@ reaterepo=true
             else
                 createrepo --quiet $repository
             fi
-            check
         fi
 
     fi