blob: 2a0892952c2f9aada66ce61f9c8c3d356e16c9a6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#!/bin/sh
# Ensure we can find the setup.py file which
# should be at the root of the cloud-init tree
PKG_DIR=`pwd`
ROOT="$PKG_DIR/../"
if [ ! -e "$ROOT/setup.py" ]; then
echo "No setup.py found at $ROOT"
exit 1
fi
echo "Using root directory $ROOT for building your debian package"
# Ensure tempdir is cleaned and ready to go
TEMP_D=$(mktemp -d "${TMPDIR:-/tmp}/${0##*/}.XXXXXXX")
echo "With $TEMP_D as a temporary workspace"
rm -Rf "${TEMP_D}"; mkdir "${TEMP_D}"
set -e
# Ensure tempdir removed if breaks...
trap "rm -Rf '${TEMP_D}'" EXIT SIGINT SIGTERM
# Go to the root and start making a package!
cd $ROOT
files=$(bzr ls --versioned)
revno=$(bzr revno)
version=$(tools/read-version)
mkdir "${TEMP_D}/cloud-init"
otar="$TEMP_D/cloud-init_$version~bzr${revno}.orig.tar.gz"
tar -czf - ${files} > "$otar"
tar -C "${TEMP_D}/cloud-init" -xzf - < "$otar"
if [ ! -d "${TEMP_D}/cloud-init/debian" ]; then
rsync -a $PKG_DIR/debian.trunk/ "${TEMP_D}/cloud-init/debian"
fi
sed -i -e "s,VERSION,$version," -e "s,REVNO,bzr$revno," \
"$TEMP_D/cloud-init/debian/changelog"
cd "${TEMP_D}/cloud-init"
debuild "$@"
debname="cloud-init_${version}~bzr${revno}-1_all.deb"
mv "../$debname" "$PKG_DIR"
echo "Wrote $debname to $PKG_DIR"
|