3
# Copyright 2009 Canonical Ltd. This software is licensed under the
4
# GNU Affero General Public License version 3 (see the file LICENSE).
6
# Authors: Daniel Silverstone <daniel.silverstone@canonical.com>
7
# and Adam Conrad <adam.conrad@canonical.com>
9
# Buildd Slave tool to update a debian chroot
11
# Expects build id as arg 1, makes build-id to contain the build
12
# Expects rest of arguments to be to pass to sbuild
14
# Needs SBUILD to be set to a sbuild instance with passwordless sudo ability
18
export LANG=C LC_ALL=C
20
SBUILD=/usr/bin/sbuild
27
export NR_PROCESSORS=$(grep ^processor /proc/cpuinfo | wc -l)
29
echo "Initiating build $BUILDID with $NR_PROCESSORS processor cores."
31
if [ $NR_PROCESSORS -lt 2 ]; then
35
cd "$HOME/build-$BUILDID"
37
hostarch=$(dpkg --print-architecture)
42
SBUILD="linux32 $SBUILD"
46
# SBUILD is already correct
50
if [ "$hostarch" != "$ARCHITECTURETAG" ]; then
51
SBUILD="linux32 $SBUILD"
60
warty*|hoary*|breezy*|dapper*|edgy*|feisty*|gutsy*|hardy*|karmic*)
65
$SBUILD "$@" | /usr/bin/check-implicit-pointer-functions --inline $WARN
68
# really successful returns
69
[ $RET = 0 ] || exit $RET
71
STATE=$(cat build-progress | awk '{print $2}')
72
STEP=$(cat build-progress | awk '{print $3}')
74
# If the build was successful; return 0
75
[ "$STATE" = "successful" ] && exit 0
77
# If we think it's a dep-wait problem, exit 1
78
[ "$STEP" = "install-deps" ] && exit 1
80
# Is this a state where auto-give-back should kick in; exit 2
81
[ "$STEP" = "find-dsc" ] && exit 2
82
[ "$STEP" = "fetch-src" ] && exit 2
83
[ "$STEP" = "unpack-check" ] && exit 2
84
[ "$STEP" = "check-space" ] && exit 2
85
[ "$STEP" = "install-deps-env" ] && exit 2
87
# Any other reason (which we'll treat as a build failure), exit 3
90
# There is an exit code of "4" that means the builder itself
91
# is having problems. Currently, we don't use it at all.