1
by Martin Pool
Add snapshot of buildd source extracted from the Launchpad tree |
1 |
#!/bin/sh
|
2 |
#
|
|
4
by Martin Pool
Move buildd code from canonical.buildd to lpbuildd python package |
3 |
# Copyright 2010,2011 Canonical Ltd. This software is licensed under the
|
1
by Martin Pool
Add snapshot of buildd source extracted from the Launchpad tree |
4 |
# GNU Affero General Public License version 3 (see the file LICENSE).
|
5 |
||
6 |
# Buildd Slave tool to generate translation templates. Boiler plate code
|
|
7 |
# copied from sbuild-package.
|
|
8 |
||
9 |
# Expects build id as arg 1.
|
|
10 |
# Expects branch url as arg 2.
|
|
11 |
# Expects output tarball name as arg 3.
|
|
12 |
||
13 |
# Must run as user with password-less sudo ability.
|
|
14 |
||
15 |
exec 2>&1 |
|
16 |
||
17 |
export LANG=C LC_ALL=C |
|
18 |
||
19 |
CHMOD=/bin/chmod |
|
20 |
CHROOT=/usr/sbin/chroot |
|
21 |
CP=/bin/cp |
|
22 |
INSTALL=/usr/bin/install |
|
23 |
MKDIR=/bin/mkdir |
|
24 |
SU=/bin/su |
|
25 |
SUDO=/usr/bin/sudo |
|
26 |
TOUCH=/usr/bin/touch |
|
27 |
||
28 |
BUILDID=$1 |
|
29 |
BRANCH_URL=$2 |
|
30 |
RESULT_NAME=$3 |
|
31 |
||
32 |
BUILDD_HOME=/usr/share/launchpad-buildd |
|
37
by Martin Pool
Correction to generate-translation-templates for the new file location. |
33 |
BUILDD_LIB=/usr/lib/launchpad-buildd |
1
by Martin Pool
Add snapshot of buildd source extracted from the Launchpad tree |
34 |
SLAVEBIN=$BUILDD_HOME/slavebin |
35 |
BUILD_CHROOT="$HOME/build-$BUILDID/chroot-autobuild" |
|
36 |
USER=$(whoami) |
|
37 |
||
38 |
# Debug output.
|
|
39 |
echo "Running as $USER for build $BUILDID on $BRANCH_URL." |
|
40 |
echo "Results expected in $RESULT_NAME." |
|
41 |
||
4
by Martin Pool
Move buildd code from canonical.buildd to lpbuildd python package |
42 |
BUILDD_PACKAGE=lpbuildd |
1
by Martin Pool
Add snapshot of buildd source extracted from the Launchpad tree |
43 |
POTTERY=$BUILDD_PACKAGE/pottery |
44 |
# The script should be smarter about detecting the python version.
|
|
45 |
PYMODULES=/usr/lib/pymodules/python2.7 |
|
46 |
echo -n "Default Python in the chroot is: " |
|
47 |
$BUILD_CHROOT/usr/bin/python --version
|
|
48 |
||
49 |
GENERATE_SCRIPT=$PYMODULES/$POTTERY/generate_translation_templates.py |
|
50 |
||
51 |
debug_exec() { |
|
52 |
echo "Executing '$1'..." |
|
53 |
$1 || echo "Got error $? from '$1'." |
|
54 |
}
|
|
55 |
||
56 |
# Copy pottery files to chroot.
|
|
57 |
debug_exec "$SUDO $MKDIR -vp $BUILD_CHROOT$PYMODULES/$BUILDD_PACKAGE" |
|
4
by Martin Pool
Move buildd code from canonical.buildd to lpbuildd python package |
58 |
debug_exec "$SUDO $TOUCH $BUILD_CHROOT$PYMODULES/$BUILDD_PACKAGE/__init__.py" |
37
by Martin Pool
Correction to generate-translation-templates for the new file location. |
59 |
debug_exec "$SUDO $CP -vr $BUILDD_LIB/$POTTERY $BUILD_CHROOT$PYMODULES/$BUILDD_PACKAGE" |
4
by Martin Pool
Move buildd code from canonical.buildd to lpbuildd python package |
60 |
debug_exec "$SUDO $CHMOD -v -R go+rX $BUILD_CHROOT$PYMODULES/$BUILDD_PACKAGE" |
1
by Martin Pool
Add snapshot of buildd source extracted from the Launchpad tree |
61 |
debug_exec "$SUDO $CHMOD -v 755 $BUILD_CHROOT$GENERATE_SCRIPT" |
62 |
||
63 |
# Enter chroot, switch back to unprivileged user, execute the generate script.
|
|
64 |
$SUDO $CHROOT $BUILD_CHROOT \ |
|
65 |
$SU - $USER \ |
|
66 |
-c "PYTHONPATH=$PYMODULES $GENERATE_SCRIPT $BRANCH_URL $RESULT_NAME" |