X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=scripts%2Fall-modules.sh;h=a89881eaa922bd5b4cee4b56fc88e31fe24ce8e0;hb=841c5a237b3ad1084d8b29533f304fe6122cfe08;hp=c3e3e81ef87a302b0701ce93350e1a11f75890e9;hpb=0483c15e094295becf092913c4778faf9af3d6b6;p=infrastructure.git diff --git a/scripts/all-modules.sh b/scripts/all-modules.sh index c3e3e81..a89881e 100755 --- a/scripts/all-modules.sh +++ b/scripts/all-modules.sh @@ -1,66 +1,77 @@ #!/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 every 30 minutes on onelab build box +# it is invoked cyclically # prior to that, the following directories will have been svn updated : -# /root/svn-build -# /root/svn-build-4.2 +# ~/svn-build +# ~/root/svn-build-4.2 # avoid running several instances of this script # when the svn server has problems, this can very well last quite a while COMMAND=$(basename $0) -OUTPUT=/build/modules -LOCK=/var/run/all-modules.pid + +# 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/slow + LOCK=/var/run/all-modules.pid +else + OUTPUT=~/all-modules + LOCK=~/all-modules.run +fi 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 - pushd $build_dir; svn update > .update.log 2>&1 ; popd + ( 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_file=$out_dir/version.txt - out_tmp=$out_dir/.version.txt + out_dir=$OUTPUT/$wwwname + out_file=$out_dir/version.html + out_tmp=$out_dir/.version.html mkdir -p $out_dir - - ( echo $name ; \ - date ; \ - $build_dir/module-version -a --url ; \ - date ) &> $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_file=$out_dir/diff.txt - out_tmp=$out_dir/.diff.txt + out_dir=$OUTPUT/$wwwname + out_file=$out_dir/diff.html + out_tmp=$out_dir/.diff.html mkdir -p $out_dir - - ( echo $name ; \ - date ; \ - $build_dir/module-diff -a -o ; \ - date ) &> $out_tmp - - ( echo 'WARNINGS (if any)' ; \ - egrep 'was not found|Skipping failed' $out_tmp ; - cat $out_tmp ) > $out_file + $build_dir/module-diff $VERBOSE -w $workdir --www $wwwname -a &> $out_tmp + mv -f $out_tmp $out_file - rm -f $out_tmp } function usage () { @@ -73,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 @@ -83,12 +94,15 @@ function main () { echo $$ > $LOCK - do_update /root/svn-build - do_diff /root/svn-build trunk - do_version /root/svn-build trunk -# do_update /root/svn-build-4.2 -# do_diff /root/svn-build-4.2 4.2 -# do_version /root/svn-build-4.2 4.2 +# the 5.0 flavour now comes with a non-compatible flavour of the module-tools +# and we need 2 distinc workdirs + do_update ~/git-build + do_version ~/git-build $WORKDIR_GIT 5.0 + do_diff ~/git-build $WORKDIR_GIT 5.0 +### dropped the 4.3 branxh while moving to git... +# do_update ~/svn-build-4.3 +# do_version ~/svn-build-4.3 $WORKDIR_SVN 4.3 +# do_diff ~/svn-build-4.3 $WORKDIR_SVN 4.3 rm $LOCK