Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
renaming some tracing functions to make easy to remember what they do
[simgrid.git] / tools / graspe-master
1 #! /bin/bash
2
3 MACHINES=${MACHINES:-\
4            graal.ens-lyon.fr   \
5            sperm.cs.ucsb.edu     basalt.cs.ucsb.edu valnure.cs.ucsb.edu \
6            AIX}
7
8 # no access anymore: nala.cs.utk.edu allo-psmn.ens-lyon.fr 
9
10 # ACTIONS: What to do there
11 # possible values:
12 #  - scp:     copy a tarball over
13 #  - rsync:   rsync the source (rsync must be installed remotely)
14 #
15 #  - clean:   erase any previously existing source tree and 
16 #             open the new open
17 #  - untar:   open the tarball which was just copied
18 #  - touch:   touch every file of the source tree to deal with 
19 #             clock brokenness. May help, may harm.
20 #  - config:  launch configure
21 #  - compile: run 'make'
22 #  - install: run 'make install'
23 #  - check:   run 'make check'
24 #
25 # default value:
26 ACTIONS=${ACTIONS:-scp clean untar config compile check}
27
28 REMOTE_PREFIX=${REMOTE_PREFIX:-simgrid}
29
30 ###
31 ### End of configuration. You shouldn't change anything below
32 ###
33
34 srcdir=`echo "@srcdir@"|./config.status --file=-:-`
35 PACKAGE=`echo "@PACKAGE@"|./config.status --file=-:-`
36 VERSION=`echo "@VERSION@"|./config.status --file=-:-`
37
38 echo;echo "----[ Recompile the package on remote hosts ]----"
39 test -e $srcdir/buildlogs/${PACKAGE}-${VERSION} || mkdir -p ${srcdir}/buildlogs/${PACKAGE}-${VERSION}
40 failed=0;
41  for site in ${MACHINES} ; do 
42    machine=`echo $site |sed 's/^\([^%]*\)%.*$/\1/'`;
43    machine2=`echo $site |sed 's/^\([^%]*\)%\(.*\)$/\2/'`;
44    cmd="\"sh -c 'env REMOTE_PREFIX=${REMOTE_PREFIX} ${REMOTE_PREFIX}/src/graspe-slave ${ACTIONS} 2>&1'\"";
45    if echo $site | grep  '%' >/dev/null ; then 
46      echo "----[ Compile on $machine2 (behind $machine) ]----";
47    else 
48      machine=$site;
49      echo "----[ Compile on $machine ]----";
50    fi;
51    
52    ##
53    ## Source diffusion
54    ##
55    
56    if echo ${ACTIONS} | grep -q scp ; then
57      echo "-- Copy the data over"; 
58      [ -e ${srcdir}/${PACKAGE}-${VERSION}.tar.gz ] || make -C ${srcdir} dist
59      scp ${srcdir}/${PACKAGE}-${VERSION}.tar.gz tools/graspe-slave \
60        $machine:${REMOTE_PREFIX}/src;
61    else if echo ${ACTIONS} | grep -q rsync ; then
62      echo "-- Rsync the data over"; 
63      [ -e ${srcdir}/${PACKAGE}-${VERSION} ] || make -C ${srcdir} distdir
64      rsync -t -r ${srcdir}/${PACKAGE}-${VERSION} tools/graspe-slave $machine:${REMOTE_PREFIX}/src/
65    fi fi 
66    
67    ##
68    ## Compilation
69    ##
70    
71    echo "-- Compiling... (the output gets into ${srcdir}/buildlogs/${PACKAGE}-${VERSION}/$site.log)"; 
72    if echo $site | grep  '%' >/dev/null ; then 
73      if ssh $machine "env REMOTE_PREFIX=${REMOTE_PREFIX} ssh -A $machine2 $cmd" 2>&1 > ${srcdir}/buildlogs/${PACKAGE}-${VERSION}/$site.log;
74      then echo "Sucessful"; else failed=1;echo "Failed (check ${srcdir}/buildlogs/${PACKAGE}-${VERSION}/$site.log)"; fi;echo; 
75    else 
76      if ssh $machine "eval $cmd" 2>&1 > ${srcdir}/buildlogs/${PACKAGE}-${VERSION}/$site.log ;
77      then echo "Sucessful"; else failed=1;echo "Failed (check ${srcdir}/buildlogs/${PACKAGE}-${VERSION}/$site.log)"; fi;echo; 
78    fi;
79 done;
80 ${srcdir}/tools/compile-stats;
81 exit $failed