3 # Simple shell script that knows enough to download the sdcc build scripts
4 # and start them running.
6 # Use gmake over make by default.
7 if command -v gmake
> /dev
/null
; then
14 #test -z $BUILDROOT && \
15 # BUILDROOT=/var/tmp/`whoami`/build
17 # SVN sdcc-build repository
18 SVNROOT
=svn
://svn.code.sf.net
/p
/sdcc
/code
/trunk
20 BUILDDATE
=`date +%Y%m%d`
22 # The lockfile ensures that the new build doesn't start until the previous one s not done
26 # time to sleep until next check of lockfile, in seconds
28 # maximum age of lockfile; after this the lock will be removed
29 MAXMINUTES
=1440 #one day
31 LOCKFILE
=$BUILDROOT/sdcc-build.lock
32 # prefix for all messages, which is used to filter the messages out of the buildlogs
33 MSGPREFIX
="Buildlock: "
36 # but check first, if it's (still) our own lockfile.
39 echo $MSGPREFIX cleanup
40 test -f $LOCKFILE && head -n 1 $LOCKFILE |
grep $MYID > /dev
/null
&& rm $LOCKFILE && echo $MSGPREFIX "Lock released on " `date`
43 # Execute supported version of ls -l --full-time
46 # test if ls -l --full-time is supported
47 res
=`ls -l --full-time $1 2>&1`
49 # ls -l --full-time supported: echo the result
52 # ls -l --full-time not supported: execute ls -l
60 echo $MSGPREFIX Try to obtain lock on
`date`
61 test -f $LOCKFILE && printf "%s %s\n" $MSGPREFIX "`ls_l_full_time $LOCKFILE`"
67 res
=`find $LOCKFILE -mmin +$MAXMINUTES \
68 -exec echo $MSGPREFIX lock from \`cat $LOCKFILE\
` expired \; \
69 -exec rm -f {} \; 2> /dev/null`
73 echo $MSGPREFIX "Can't obtain the lock"
77 echo $MYID > $LOCKFILE
78 # check, if we're in the first line of lockfile;
79 # if we're not in the first line, another host was faster
80 # and we have to wait again.
81 head -n 1 $LOCKFILE |
grep $MYID > /dev
/null ||
continue
82 echo $MSGPREFIX "Obtained lock on " `date`
90 trap 'echo $MSGPREFIX caught signal ; cleanup ; exit 1' 1 2 3 13 15
98 if test -d ~
/local-
$HOSTNAME/bin
; then
99 PATH
=$PATH:$HOME/local-
$HOSTNAME/bin
100 elif test -d ~
/local
/bin
; then
101 PATH
=$PATH:$HOME/local
/bin
106 # Checkout the latest sdcc-build version to $BUILDROOT/sdcc-build
107 # Quick & dirty temporary fix: don't remove the build if uploading
108 test "$1" != "do-upload" && rm -rf $BUILDROOT/sdcc-build
109 if svn checkout
$SVNROOT/sdcc-build
$BUILDROOT/sdcc-build
118 if test "$success" = 1
120 # Spawn onto the actual build
121 # Don't use "make -C" to change directory since the "Entering directory" and
122 # "Leaving directory" messages are displayed in the regression test results
123 cd $BUILDROOT/sdcc-build
126 echo $MSGPREFIX "can't checkout"