summaryrefslogtreecommitdiff
path: root/tools/bddeb
blob: 598f71bbc62de010d209fedf6e89c5abb1dbc034 (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
#!/bin/sh

TEMP_D=$(mktemp -d "${TMPDIR:-/tmp}/${0##*/}.XXXXXXX")
#TEMP_D=/tmp/my.d
start=${PWD}
rm -Rf "${TEMP_D}"; mkdir "${TEMP_D}"
set -e
trap "rm -Rf '${TEMP_D}'" exit
files=$(bzr ls --versioned)
revno=$(bzr revno)
version=$(awk \
  -F= '$1 ~ /version$/ { gsub("[^0-9.]","",$2); print $2; }' setup.py)
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 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 "$@"
#for x in ../*.deb; do
#   echo wrote ${x##*/}
#done
debname="cloud-init_${version}~bzr${revno}-0_all.deb"
mv "../$debname" "$start"
link="$start/cloud-init_all.deb"
echo "wrote $debname"
[ ! -e "$link" -o -L "$link" ] 
   { ln -sf "$debname" "$link" && echo "linked ${link##*/}"; }