remove the '[GIT]' mailprefix
[infrastructure.git] / scripts / all-modules.sh
index 76a4c4f..b0f5abf 100755 (executable)
@@ -1,5 +1,13 @@
 #!/bin/bash
-# $Id$
+
+# NOTE
+# as the svn diff operations from a remote location are so sssssslllllllooooooooowwwwww...
+# what we do:
+# maintain codebase in onelab.eu for historical reasons
+# (1) push scripts on princeton (manually run all-modules-update.sh)
+# (2) run the scripts cyclically over there through cron
+# and push the results on build.onelab.eu with all-modules.push.sh (as part of the cron job)
+#
 # this script is a wrapper around the module-tools (version and diff)
 # it is invoked cyclically
 # prior to that, the following directories will have been svn updated :
 
 COMMAND=$(basename $0)
 
+# make sure the cyclic tasks do not interfere with manual usage
+WORKDIR_SVN=${HOME}/all-modules-svn
+WORKDIR_GIT=${HOME}/all-modules-git
+
 # make the command usable as non-root user at Princeton for more efficiency
 if [ "$(id -u)" == "0" ] ; then
-    OUTPUT=/build/modules
+    OUTPUT=/build/modules/slow
     LOCK=/var/run/all-modules.pid
 else
     OUTPUT=~/all-modules
@@ -24,36 +36,40 @@ function do_update() {
     build_dir=$1; shift
     if [ -f $build_dir/auto-update.sh ] ; then
        $build_dir/auto-update.sh
+    elif [ -d $build_dir/.git ] ; then
+       ( cd $build_dir; git pull > .update.log 2>&1 )
     else
        ( cd $build_dir; svn update > .update.log 2>&1 )
     fi
 }
 
-# usage: do_version dir name 
+# usage: do_version dir workdir wwwname 
 function do_version () {
     build_dir=$1; shift
-    name=$1; shift
+    workdir=$1; shift
+    wwwname=$1; shift
 
-    out_dir=$OUTPUT/$name
+    out_dir=$OUTPUT/$wwwname
     out_file=$out_dir/version.html
     out_tmp=$out_dir/.version.html
     
     mkdir -p $out_dir
-    $build_dir/module-version --www $name -a --url &> $out_tmp
+    $build_dir/module-version $VERBOSE -w $workdir --www $wwwname -a &> $out_tmp
     mv -f $out_tmp $out_file
 }
 
-# usage: do_version dir name 
+# usage: do_version dir workdir wwwname 
 function do_diff () {
     build_dir=$1; shift
-    name=$1; shift
+    workdir=$1; shift
+    wwwname=$1; shift
 
-    out_dir=$OUTPUT/$name
+    out_dir=$OUTPUT/$wwwname
     out_file=$out_dir/diff.html
     out_tmp=$out_dir/.diff.html
     
     mkdir -p $out_dir
-    $build_dir/module-diff --www $name -a &> $out_tmp
+    $build_dir/module-diff $VERBOSE -w $workdir --www $wwwname -a &> $out_tmp
     mv -f $out_tmp $out_file
 
 }
@@ -68,7 +84,7 @@ function main () {
        case "$1" in 
            -f) rm -f $LOCK ;;
            -i) ls -l $LOCK ; exit 0 ;;
-           -v) set -x ;;
+           -v) set -x ; VERBOSE=-v ;;
            *) usage; exit 1;;
        esac
        shift
@@ -78,12 +94,14 @@ function main () {
     
     echo $$ > $LOCK
 
+# the 5.0 flavour now comes with a non-compatible flavour of the module-tools
+# and we need 2 distinc workdirs
     do_update  ~/svn-build
-    do_version ~/svn-build     5.0 
-    do_diff    ~/svn-build     5.0
+    do_version ~/svn-build     $WORKDIR_GIT 5.0 
+    do_diff    ~/svn-build     $WORKDIR_GIT 5.0
     do_update  ~/svn-build-4.3
-    do_version ~/svn-build-4.3 4.3 
-    do_diff    ~/svn-build-4.3 4.3
+    do_version ~/svn-build-4.3 $WORKDIR_SVN 4.3 
+    do_diff    ~/svn-build-4.3 $WORKDIR_SVN 4.3
 
     rm $LOCK