~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/canonical/buildd/sbuild-package

  • Committer: Steve Kowalik
  • Date: 2011-08-07 04:05:52 UTC
  • mto: This revision was merged to the branch mainline in revision 13626.
  • Revision ID: stevenk@ubuntu.com-20110807040552-mwnxo0flmhvl35e8
Correct the notification based on review comments, and remove request{,ed}
from the function names, switching to create{,d}.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
#
 
3
# Copyright 2009 Canonical Ltd.  This software is licensed under the
 
4
# GNU Affero General Public License version 3 (see the file LICENSE).
 
5
#
 
6
# Authors: Daniel Silverstone <daniel.silverstone@canonical.com>
 
7
#      and Adam Conrad <adam.conrad@canonical.com>
 
8
 
 
9
# Buildd Slave tool to update a debian chroot
 
10
 
 
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
 
13
 
 
14
# Needs SBUILD to be set to a sbuild instance with passwordless sudo ability
 
15
 
 
16
exec 2>&1
 
17
 
 
18
export LANG=C LC_ALL=C 
 
19
 
 
20
SBUILD=/usr/bin/sbuild
 
21
BUILDID=$1
 
22
ARCHITECTURETAG=$2
 
23
SUITE=$3
 
24
 
 
25
shift 3
 
26
 
 
27
export NR_PROCESSORS=$(grep ^processor /proc/cpuinfo | wc -l)
 
28
 
 
29
echo "Initiating build $BUILDID with $NR_PROCESSORS processor cores."
 
30
 
 
31
if [ $NR_PROCESSORS -lt 2 ]; then
 
32
        unset NR_PROCESSORS
 
33
fi
 
34
 
 
35
cd "$HOME/build-$BUILDID"
 
36
 
 
37
hostarch=$(dpkg --print-architecture)
 
38
 
 
39
WARN=""
 
40
case $hostarch in
 
41
  hppa|powerpc|sparc)
 
42
    SBUILD="linux32 $SBUILD"
 
43
    WARN="--warnonly"
 
44
    ;;
 
45
  i386|lpia|armel)
 
46
    # SBUILD is already correct
 
47
    WARN="--warnonly"
 
48
    ;;
 
49
  amd64)
 
50
    if [ "$hostarch" != "$ARCHITECTURETAG" ]; then
 
51
      SBUILD="linux32 $SBUILD"
 
52
      WARN="--warnonly"
 
53
    fi
 
54
    ;;
 
55
  ia64)
 
56
    ;;
 
57
esac
 
58
 
 
59
case $SUITE in
 
60
    warty*|hoary*|breezy*|dapper*|edgy*|feisty*|gutsy*|hardy*|karmic*)
 
61
        WARN="--warnonly"
 
62
        ;;
 
63
esac
 
64
 
 
65
$SBUILD "$@" | /usr/bin/check-implicit-pointer-functions --inline $WARN
 
66
RET=$?
 
67
 
 
68
# really successful returns
 
69
[ $RET = 0 ] || exit $RET
 
70
 
 
71
STATE=$(cat build-progress | awk '{print $2}')
 
72
STEP=$(cat build-progress | awk '{print $3}')
 
73
 
 
74
# If the build was successful; return 0
 
75
[ "$STATE" = "successful" ] && exit 0
 
76
 
 
77
# If we think it's a dep-wait problem, exit 1
 
78
[ "$STEP" = "install-deps" ] && exit 1
 
79
 
 
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
 
86
 
 
87
# Any other reason (which we'll treat as a build failure), exit 3
 
88
exit 3
 
89
 
 
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.
 
92
# exit 4