wxWidgets/build/buildbot/config/testdrive-inc.xml
2007-10-04 15:55:18 +00:00

301 lines
8.9 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!--
Name: testdrive-inc.xml
Purpose: Declarations for the testdrive build slave
Author: Mike Wetherell
RCS-ID: $Id$
Copyright: (c) 2007 Mike Wetherell
Licence: wxWidgets licence
-->
<bot xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
xsl:version="1.0">
<xi:include href="include.xml" xpointer="xpointer(*/*)"/>
<!--
checkout - build step for source checkout.
Usage: as <svn> with additional <command> element and defaults for
<baseURL> and <defaultBranch>
Typically just:
<checkout/>
for the trunk, or:
<checkout branch="branches/WX_2_8_BRANCH"/>
to checkout a branch.
-->
<xsl:template name="checkout">
<xsl:param name="content"/>
<xsl:param name="branch" select="'trunk'"/>
<xsl:variable name="nodes" select="exsl:node-set($content)"/>
<testdrive-svn>
<xsl:if test="not($nodes/svnurl)">
<xsl:if test="not($nodes/baseURL)">
<baseURL><SVN_URL/></baseURL>
</xsl:if>
<xsl:if test="not($nodes/defaultBranch)">
<defaultBranch><xsl:value-of select="$branch"/></defaultBranch>
</xsl:if>
</xsl:if>
<xsl:if test="not($nodes/command)">
<profile/>
<post-checkout/>
</xsl:if>
<xsl:copy-of select="$content"/>
</testdrive-svn>
</xsl:template>
<xsl:template name="post-checkout">
<command>
mkdir -p $TOPDIR
chown $USER $TOPDIR
rm -rf $BUILDDIR
cp -pR . $BUILDDIR || { cd; rm -rf $BUILDDIR; exit 1; }
</command>
</xsl:template>
<!--
configure - make disable-precomp-headers a default configure option for
the testdrive, and post process the Makefiles to use ccache.
Usage: <configure options="-with-foobar"/>
-->
<xsl:template name="configure">
<xsl:param name="content"/>
<xsl:param name="options"/>
<configure>
<copy-with-defaults content="{$content}">
<command>./configure --disable-precomp-headers <xsl:value-of select="$options"/></command>
</copy-with-defaults>
<command>find . -name Makefile | xargs perl -pi -e 's/^(?:CC|CXX) = /$&amp;ccache /'</command>
</configure>
</xsl:template>
<!--
setup - a build step that makes sure any prerequisites are set up for
the current testdrive build.
Usage: <setup/>
<setup cppunit-options="-host=i686-apple-darwin8"/>
One of the things it sets up is cppunit. There is more than one compiler
available on some of the testdrive machines, and generally speaking
cppuint needs to be compiled by the same one that will be used for the
build.
-->
<xsl:template name="setup">
<xsl:param name="content"/>
<xsl:param name="options"/>
<xsl:param name="ccache-configure" select="'./configure INSTALL=./install-sh\ -c --prefix=$HOME --bindir=$OPTDIR/bin'"/>
<xsl:param name="ccache-options"/>
<xsl:param name="cppunit-configure" select="'./configure INSTALL=config/install-sh\ -c --prefix=$HOME --bindir=$OPTDIR/bin --libdir=$OPTDIR/lib --disable-static'"/>
<xsl:param name="cppunit-options"/>
<shellcommand>
<description>setting up</description>
<descriptionDone>set up</descriptionDone>
<haltOnFailure/>
<command>
MINSPACE=1000000
DSPACE=`df -Pk $BUILDDIR | tail -1 | awk '{ print $4 }'`
if [ $DSPACE -lt $MINSPACE ]; then
echo "Disk space low, skipping build"
exit 1
fi
if [ -z "$CCACHE_DIR" ]; then
gunzip -c $HOME/src/ccache-*.tar.gz | tar xf -
cd ccache-*
<xsl:value-of select="concat($ccache-configure, ' ', $ccache-options, ' ', $options)"/>
make
strip ccache
make install
cd $BUILDDIR
rm -r ccache-*
fi
if { cppunit-config --version || "$CPPUNIT_CONFIG" --version; } 2>/dev/null; then
HAVE_CPPUNIT=1
fi
if [ -z "$HAVE_CPPUNIT" ]; then
gunzip -c $HOME/src/cppunit-*.tar.gz | tar xf -
cd cppunit-*
<xsl:value-of select="concat($cppunit-configure, ' ', $cppunit-options, ' ', $options)"/>
make install-strip
chmod +x $OPTDIR/bin/cppunit-config
cd $BUILDDIR
rm -rf cppunit-*
fi
</command>
</shellcommand>
</xsl:template>
<!--
builddir - override <builddir> to accept a full path
Usage: <builddir>/tmp/wx/foobar</builddir>
Normally builddir is a single directory name not a full path. Override
to allow a working directory to be selected on the remote testdrive
machine.
The actual builddir (i.e. last part 'foobar') as usual must be unique
across all the builds of all the slaves.
-->
<xsl:template name="builddir">
<xsl:param name="content"/>
<builddir>
<basename><xsl:copy-of select="$content"/></basename>
</builddir>
</xsl:template>
<!--
steps - overrides <steps> to prepend <profile/> and <prologue/> and
append <epilogue/> to the <command/> of each build step.
Usage: as <steps>
The differences between <profile/> and <prologue/> are:
1. <profile/> is also used by <checkout> for its post checkout command,
<proglogue/> isn't.
2. <profile/> has access to the build's fields, for example it can
use <get name="builddir"/>, while <prologue/> can't.
-->
<xsl:template name="steps">
<xsl:param name="content"/>
<xsl:variable name="profile"><profile/></xsl:variable>
<steps>
<xsl:for-each select="exsl:node-set($content)/*">
<xsl:choose>
<xsl:when test="contains(name(), 'svn')">
<xsl:copy-of select="."/>
</xsl:when>
<xsl:otherwise>
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:copy-of select="$profile"/>
<prologue/>
<xsl:copy-of select="node()"/>
<xsl:if test="not(command)">
<command/>
</xsl:if>
<epilogue/>
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</steps>
</xsl:template>
<!--
profile - see <steps> above.
-->
<xsl:template name="profile">
<command>
set -e
uname -smnr
umask 022
LANG=C
TOPDIR=<get name="builddir"/>
BUILDDIR=$TOPDIR/build
OPTDIR=$HOME/opt/<basename><get name="builddir"/></basename>
</command>
</xsl:template>
<!--
prologue - see <steps> above.
-->
<xsl:template name="prologue">
<command>
INSTALLDIR=$TOPDIR/install
case `uname -sm` in
Linux*86*) PATH=$HOME/linux-x86/bin:$PATH ;;
esac
PATH=$OPTDIR/bin:$PATH
LD_LIBRARY_PATH=$BUILDDIR/lib:$OPTDIR/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
if { ccache -V; } >/dev/null 2>&amp;1; then
CCACHE_DIR=$TOPDIR/ccache
export CCACHE_DIR
ccache -M 90M
fi
cd $BUILDDIR
<if-del-on-fail>trap 'cd; rm -rf $BUILDDIR' EXIT</if-del-on-fail>
</command>
</xsl:template>
<!--
epilogue - see <steps> above.
-->
<xsl:template name="epilogue">
<xsl:if test="position() != last()">
<if-del-on-fail>
<command>trap '' EXIT</command>
</if-del-on-fail>
</xsl:if>
</xsl:template>
<!--
if-del-on-fail - used in the context of a build step, copies its content
if the build step should cleanup on failure.
Usage: <if-del-on-fail>foobar</if-del-on-fail>
On the testdrive the working directory is deleted after a build to save
space. If the step has <haltOnFailure/> (which is the default or
<configure> and <compile> steps) then this cleanup needs to happen
whenever the step fails.
-->
<xsl:template name="if-del-on-fail">
<xsl:param name="content"/>
<xsl:if test = "position() = last() or
haltOnFailure = '' or
haltOnFailure = 'true' or
(not(haltOnFailure) and
(name() = 'configure' or name() = 'compile'))">
<xsl:copy-of select="$content"/>
</xsl:if>
</xsl:template>
<!--
Add slave locks so that each testdrive machine only runs one bulid at a
time
-->
<xsl:for-each select="../build/sandbox">
<xsl:if test="not(../preceding-sibling::build[sandbox = current()])">
<slavelock>
<name><xsl:apply-templates select="node()"/></name>
</slavelock>
</xsl:if>
</xsl:for-each>
<xsl:template name="sandbox">
<xsl:param name="content"/>
<sandbox><xsl:copy-of select="$content"/></sandbox>
<lock><xsl:copy-of select="$content"/></lock>
</xsl:template>
<!--
basename - returns the final component of a path
Usage: <basename>/foo/bar</basename>
Evaluates to 'bar'.
-->
<xsl:template name="basename">
<xsl:param name="path"/>
<xsl:choose>
<xsl:when test="contains($path, '/')">
<xsl:call-template name="basename">
<xsl:with-param name="path" select="substring-after($path, '/')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$path"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</bot>