X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=scripts%2Fall-modules.sh;h=b33276e965c8855bba5d319ba84aa5ea6eb2ca8c;hb=8ee8e2cc579caba54a2787c4885f185c8e640697;hp=7bf21809e0faa6e5313bd9a980051d3601ce26d0;hpb=01e6c3e19cd8f226d361c85f2c8c4fc13a9d7e46;p=infrastructure.git diff --git a/scripts/all-modules.sh b/scripts/all-modules.sh index 7bf2180..b33276e 100755 --- a/scripts/all-modules.sh +++ b/scripts/all-modules.sh @@ -1,52 +1,71 @@ #!/bin/bash -# $Id$ + +# reviewed in dec. 2010 +# moving back to running on the EU side +# # 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 +# ~/git-build # avoid running several instances of this script # when the svn server has problems, this can very well last quite a while COMMAND=$(basename $0) + +# running as root on liquid OUTPUT=/build/modules -LOCK=/var/run/all-modules.pid +LOCK=~/all-modules.run +# make sure the cyclic tasks do not interfere with manual usage +# (i.e. do not use ~/modules) +WORKDIR_GIT=${HOME}/all-modules-git +########## sample config running on liquid +#svnpath=http://svn.planet-lab.org/svn/ +#gitserver=git.onelab.eu +#gituser=root +#build=build +#username=not-needed-as-we-dont-write +#email=not-needed-as-we-dont-write +########## 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_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 } @@ -61,7 +80,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 @@ -71,15 +90,23 @@ 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.3 - do_diff /root/svn-build-4.3 4.3 - do_version /root/svn-build-4.3 4.3 + do_update ~/git-build + do_version ~/git-build $WORKDIR_GIT 5.0 + do_diff ~/git-build $WORKDIR_GIT 5.0 rm $LOCK } main "$@" + +######################################## +# this applied to the older version that was running at princeton +# 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) +#