2
# Create a bzr-builder recipe and build it.
4
# The package built by this script can be used for testing to verify
5
# the release candidate is viable. The recipe can be added to launchpad
6
# to build packages (after the RC has proven to be viable).
10
DEFAULT_JUJU_CORE="lp:juju-core"
11
DEFAULT_PACKAGING="lp:~ce-orange-squad/juju-core/unstable-packaging"
16
echo "usage: $0 REVNO [JUJU_CORE_BRANCH [PACKAGING_BRANCH]]"
17
echo " REVNO: The juju-core revno to build"
18
echo " JUJU_CORE_BRANCH: The juju-core branch; defaults to ${DEFAULT_JUJU_CORE}"
19
echo " PACKAGING_BRANCH: The packaging branch; defaults to ${DEFAULT_PACKAGING}"
25
echo "Phase 0: Checking requirements."
27
which dh || has_deps=0
28
which bzr || has_deps=0
29
bzr plugins | grep bzr-builder || has_deps=0
30
if [[ $has_deps == 0 ]]; then
31
echo "Install debhelper, bzr, and bzr-builder"
38
echo "Phase 1: Creating a recipe for juju-core r${REVNO}."
39
echo "Retrieving dependencies.tsv from $JUJU_CORE_BRANCH r$REVNO"
40
VERSION=$(bzr cat -q -d $JUJU_CORE_BRANCH -r $REVNO version/version.go |
41
sed -n 's/^const version = "\(.*\)"/\1/p')
42
DEPENDENCIES=$(bzr cat -d $JUJU_CORE_BRANCH -r $REVNO dependencies.tsv)
44
# bzr-builder format 0.3 deb-version ${VERSION}+${REVNO}-0
46
nest juju-core ${JUJU_CORE_BRANCH} src/launchpad.net/juju-core revno:${REVNO}
49
echo "${DEPENDENCIES}" |
51
-e 's,^\(.*\)/\([^/]*\)\tbzr.*\t\([0-9]*\)$,nest \2 lp:\2 src/\1/\2 revno:\3,;' \
52
-e 's,lp:mgo,lp:mgo/v2,' |
54
RECIPE="${BASE}${NESTED}"
55
echo "${RECIPE}" > $RECIPE_NAME
56
echo "Created ${RECIPE_NAME}"
60
create_source_package() {
61
echo "Phase 2: Creating a source package."
62
mkdir -p "${TESTING_DIR}"
63
bzr dailydeb --allow-fallback-to-native --append-version ~$LTS_SERIES \
64
$RECIPE_NAME $TESTING_DIR
68
create_binary_package() {
69
echo "Phase 3: creating a binary package."
72
cd juju-core-$VERSION+$REVNO/
73
fakeroot debian/rules binary
74
PACKAGES=$(ls ${TESTING_DIR}/*.deb)
75
echo "Created $PACKAGES"
79
test $# -ge 1 || usage
81
JUJU_CORE_BRANCH=${2:-$DEFAULT_JUJU_CORE}
82
PACKAGING_BRANCH=${3:-$DEFAULT_PACKAGING}
84
RECIPE_NAME="juju-core-r${REVNO}.recipe"
85
TESTING_DIR="${HERE}/testing-juju-core-r${REVNO}"