| 1 | This sample recipe builds using a monotone repository. |
| 2 | |
| 3 | {{{ |
| 4 | <build description="Build system" |
| 5 | xmlns:sh="http://bitten.cmlenz.net/tools/sh" |
| 6 | xmlns:c="http://bitten.cmlenz.net/tools/c"> |
| 7 | |
| 8 | <step id="Checkout"> |
| 9 | <sh:exec file="/bin/rm" args="-rf /tmp/bld_${config}_${build}"/> |
| 10 | <sh:exec file="/bin/sh" |
| 11 | args="-c 'if [ ! -f /tmp/db.mtn ]; then mtn -d /tmp/db.mtn db init; fi'"/> |
| 12 | <sh:exec file="/usr/bin/mtn" |
| 13 | args="--ticker none -d /tmp/db.mtn pull mtn-db-host *"/> |
| 14 | <sh:exec file="/usr/bin/mtn" |
| 15 | args="-d /tmp/db.mtn co -b ${repository.branch} /tmp/bld_${config}_${build} -r ${revision}"/> |
| 16 | </step> |
| 17 | |
| 18 | <step id="Compile"> |
| 19 | <c:make directory="/tmp/bld_${config}_${build}"/> |
| 20 | </step> |
| 21 | |
| 22 | <step id="Test"> |
| 23 | <c:make directory="/tmp/bld_${config}_${build}" target="test"/> |
| 24 | </step> |
| 25 | |
| 26 | <step id="Cleanup"> |
| 27 | <sh:exec file="/bin/rm" args="-rf /tmp/bld_${config}_${build}"/> |
| 28 | </step> |
| 29 | |
| 30 | </build> |
| 31 | }}} |
| 32 | |
| 33 | '''Comments:''' |
| 34 | |
| 35 | * Note that the above recipe uses the ${repository.branch} variable to specify the monotone branch. Either specify in the slave configuration (see example at [wiki:SlaveConfiguration]), or replace the variable name with a literal branch name in the recipe. |
| 36 | * 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. |
| 37 | * Compile: Just calls make. |
| 38 | * Test: Just calls make test. |
| 39 | * Cleanup: Trashes the temporary directory. |
| 40 | * 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. |