diff options
author | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-06-25 12:28:59 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-06-25 12:28:59 -0700 |
commit | 6d74afcd0e11de5cb56623d9121472e9212e8481 (patch) | |
tree | 9256187f8e4a5b3e6e9212105c87a2de187f68a9 /packages/bddeb | |
parent | ffe4cde6d3fd95131b4434ca2d88af469dacfd51 (diff) | |
download | vyos-cloud-init-6d74afcd0e11de5cb56623d9121472e9212e8481.tar.gz vyos-cloud-init-6d74afcd0e11de5cb56623d9121472e9212e8481.zip |
1. Moving around the packages dir.
2. Adjusting the bddep shell script
3. Starting to add a brpm
Diffstat (limited to 'packages/bddeb')
-rwxr-xr-x | packages/bddeb | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/packages/bddeb b/packages/bddeb new file mode 100755 index 00000000..74932985 --- /dev/null +++ b/packages/bddeb @@ -0,0 +1,62 @@ +#!/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=$(awk -F: \ + '$1 ~ /[0-9][.][0-9]+[.][0-9]+/ { print $1 ; exit(0); }' ChangeLog ) + +# Ensure that the version found in 'Changelog' is the same in the python +# cloud-init version directory +py_version=$(python -c 'from cloudinit import version; import sys; \ +sys.stdout.write(version.version_string())') + +# Canonicalize the changelog version +ch_version=$(python -c "from distutils import version; import sys; \ +sys.stdout.write(str(version.StrictVersion('$version')));") + +if [ "$py_version" != "$ch_version" ]; then + echo "Cloud-init python version $py_version" \ + " != changelog version $ch_version" + echo "Please ensure they are the same!" + exit 1 +fi + +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" + |