Edgewall Software

Version 1 (modified by alien.technology+trac@…, 15 years ago) (diff)

--

This sample recipe builds using a monotone repository.

<build description="Build system"
    xmlns:sh="http://bitten.cmlenz.net/tools/sh"
    xmlns:c="http://bitten.cmlenz.net/tools/c">

  <step id="Checkout">
    <sh:exec file="/bin/rm" args="-rf /tmp/bld_${config}_${build}"/>
    <sh:exec file="/bin/sh" 
       args="-c 'if [ ! -f /tmp/db.mtn ]; then mtn -d /tmp/db.mtn db init; fi'"/>
    <sh:exec file="/usr/bin/mtn"
       args="--ticker none -d /tmp/db.mtn pull mtn-db-host *"/>
    <sh:exec file="/usr/bin/mtn"
       args="-d /tmp/db.mtn co -b ${repository.branch} /tmp/bld_${config}_${build} -r ${revision}"/>
  </step>

  <step id="Compile">
    <c:make directory="/tmp/bld_${config}_${build}"/>
  </step>

  <step id="Test">
    <c:make directory="/tmp/bld_${config}_${build}" target="test"/>
  </step>

  <step id="Cleanup">
    <sh:exec file="/bin/rm" args="-rf /tmp/bld_${config}_${build}"/>
  </step>

</build>

Comments:

  • Note that the above recipe uses the ${repository.branch} variable to specify the monotone branch. Either specify in the slave configuration (see example at Slave Configuration), or replace the variable name with a literal branch name in the recipe.
  • Checkout: This creates a temporary directory, deleting it first to guarantee it's empty. Then, creates a local monotone repository database if it doesn't already exist. Then, synchronises with the remote repository, and finally checks out the appropriate revision.
  • Compile: Just calls make.
  • Test: Just calls make test.
  • Cleanup: Trashes the temporary directory.
  • Note that the local copy of the monotone repository is left lying around in /tmp/db.mtn. It obviously saves some network bandwidth if the repository isn't re-copied to the slave for each build, so this is worth doing. You might want to put it somewhere else other than /tmp.