[nycbug-talk] tracking for multiple machines

Bjorn Nelson o_sleep
Mon Nov 28 16:14:10 EST 2005


NYCBuggers,

I ended up making a shell script (see below) that puts a lock file  
in /usr/src before starting a build.  Then I made a BSDmakefile that  
includes the Makefile as long as the lock file isn't there or you set  
the BUILDOVERRIDE variable.  make grabs BSDmakefile or makefile  
before Makefile:

< snip to line 789 from /usr/src/usr.bin/make.c >
         } else if (!ReadMakefile("BSDmakefile", NULL))
             if (!ReadMakefile("makefile", NULL))
                 (void)ReadMakefile("Makefile", NULL);

So as long this doesn't change, this method should be okay.  Let me  
know if you see any land-mines.

Thanks,
Bjorn Nelson

=========build_all.sh=============

#!/bin/sh

# Created by: Bjorn Nelson 051128
#
# Description: Builds sources while locking them.
#


# Check for proper usage
if [ ! $1 ]; then
   echo "Usage: $0 numberofthreads"
   exit 1
fi

# Set Your Variables
THREADS=$1
DIRLOC="/usr/src"
CATLOC="/bin/cat"
RMLOC="/bin/rm"
TOUCHLOC="/usr/bin/touch"
DATELOC="/bin/date"
LOGDIR="/var/log"
MAKEFILE_NAME="BSDmakefile"
LOCKFILE_NAME="BUILDING"

# Start "here" document to supercede /usr/src/Makefile
$CATLOC << EOF > $DIRLOC/$MAKEFILE_NAME

.if exists($DIRLOC/$LOCKFILE_NAME) && empty(BUILDOVERRIDE)
.error $DIRLOC/$LOCKFILE_NAME file exists. Cancelling install.
.else
.include <Makefile>
.endif

EOF

# Lock sources
$TOUCHLOC $DIRLOC/$LOCKFILE_NAME

# Start buildworld while overriding lock
echo "buildworld Started: `$DATELOC`" >> $LOGDIR/buildworld.out
#/usr/bin/make -C $DIRLOC -j $THREADS buildworld BUILDOVERRIDE=TRUE  
 >> $LOGDIR/b
uildworld.out 2> /var/log/buildworld.err
make -C $DIRLOC BUILDOVERRIDE=TRUE test
echo "buildworld Completed: `$DATELOC`" >> $LOGDIR/buildworld.out


# Start buildkernel while overriding lock
echo "buildkernel Started: `$DATELOC`" >> $LOGDIR/buildkernel.out
#make buildkernel -C $DIRLOC BUILDOVERRIDE=TRUE >> $LOGDIR/ 
buildkernel.out 2> /v
ar/log/buildkernel.err
make -C $DIRLOC BUILDOVERRIDE=TRUE test
echo "buildkernel Completed: `$DATELOC`" >> $LOGDIR/buildkernel.out

# Unlock sources
$RMLOC $DIRLOC/$LOCKFILE_NAME






More information about the talk mailing list