Logo AND Algorithmique Numérique Distribuée

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