4 # as the svn diff operations from a remote location are so sssssslllllllooooooooowwwwww...
6 # maintain codebase in onelab.eu for historical reasons
7 # (1) push scripts on princeton (manually run all-modules-update.sh)
8 # (2) run the scripts cyclically over there through cron
9 # and push the results on build.onelab.eu with all-modules.push.sh (as part of the cron job)
11 # this script is a wrapper around the module-tools (version and diff)
12 # it is invoked cyclically
13 # prior to that, the following directories will have been svn updated :
15 # ~/root/svn-build-4.2
17 # avoid running several instances of this script
18 # when the svn server has problems, this can very well last quite a while
20 COMMAND=$(basename $0)
22 # make sure the cyclic tasks do not interfere with manual usage
23 #WORKDIR_SVN=${HOME}/all-modules-svn
24 WORKDIR_GIT=${HOME}/all-modules-git
26 # make the command usable as non-root user at Princeton for more efficiency
27 if [ "$(id -u)" == "0" ] ; then
28 OUTPUT=/build/modules/slow
29 LOCK=/var/run/all-modules.pid
32 LOCK=~/all-modules.run
35 function do_update() {
37 if [ -f $build_dir/auto-update.sh ] ; then
38 $build_dir/auto-update.sh
39 elif [ -d $build_dir/.git ] ; then
40 ( cd $build_dir; git pull > .update.log 2>&1 )
42 ( cd $build_dir; svn update > .update.log 2>&1 )
46 # usage: do_version dir workdir wwwname
47 function do_version () {
52 out_dir=$OUTPUT/$wwwname
53 out_file=$out_dir/version.html
54 out_tmp=$out_dir/.version.html
57 $build_dir/module-version $VERBOSE -w $workdir --www $wwwname -a &> $out_tmp
58 mv -f $out_tmp $out_file
61 # usage: do_version dir workdir wwwname
67 out_dir=$OUTPUT/$wwwname
68 out_file=$out_dir/diff.html
69 out_tmp=$out_dir/.diff.html
72 $build_dir/module-diff $VERBOSE -w $workdir --www $wwwname -a &> $out_tmp
73 mv -f $out_tmp $out_file
78 echo "Usage: $COMMAND [-v] [-f] [-i]"
83 while [[ -n "$@" ]] ; do
86 -i) ls -l $LOCK ; exit 0 ;;
87 -v) set -x ; VERBOSE=-v ;;
93 [ -f $LOCK ] && exit 1
97 # the 5.0 flavour now comes with a non-compatible flavour of the module-tools
98 # and we need 2 distinc workdirs
100 do_version ~/git-build $WORKDIR_GIT 5.0
101 do_diff ~/git-build $WORKDIR_GIT 5.0
102 ### dropped the 4.3 branxh while moving to git...
103 # do_update ~/svn-build-4.3
104 # do_version ~/svn-build-4.3 $WORKDIR_SVN 4.3
105 # do_diff ~/svn-build-4.3 $WORKDIR_SVN 4.3