summaryrefslogtreecommitdiff
path: root/tools/make-tarball
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-07-09 15:36:16 -0400
committerScott Moser <smoser@ubuntu.com>2012-07-09 15:36:16 -0400
commit7cd3e340264365c2e968b72cce78db9ff74b24a7 (patch)
tree4a7872cde84ca0d29e7e163f768aed564a8fa208 /tools/make-tarball
parent492dc7478e0ab3eb03eb3b0b5d0e47812339b83f (diff)
parentc7aeea86fb8a17e4402cfc42626dfff2fb04c1a0 (diff)
downloadvyos-cloud-init-7cd3e340264365c2e968b72cce78db9ff74b24a7.tar.gz
vyos-cloud-init-7cd3e340264365c2e968b72cce78db9ff74b24a7.zip
rework packaging tools to find the right cloud-init topdir
This also fixes 'brpm' to address --init-system change that smoser made to setup.py before the large 'rework' merge.
Diffstat (limited to 'tools/make-tarball')
-rwxr-xr-xtools/make-tarball34
1 files changed, 34 insertions, 0 deletions
diff --git a/tools/make-tarball b/tools/make-tarball
new file mode 100755
index 00000000..7fdeb7df
--- /dev/null
+++ b/tools/make-tarball
@@ -0,0 +1,34 @@
+#!/bin/sh
+set -e
+
+find_root() {
+ local topd
+ if [ -z "${CLOUD_INIT_TOP_D}" ]; then
+ topd=$(cd "$(dirname "${0}")" && cd .. && pwd)
+ else
+ topd=$(cd "${CLOUD_INIT_TOP_D}" && pwd)
+ fi
+ [ $? -eq 0 -a -f "${topd}/setup.py" ] || return
+ ROOT_DIR="$topd"
+}
+
+if ! find_root; then
+ echo "Unable to locate 'setup.py' file that should" \
+ "exist in the cloud-init root directory." 1>&2
+ exit 1;
+fi
+
+if [ ! -z "$1" ]; then
+ ARCHIVE_FN="$1"
+else
+ REVNO=$(bzr revno $ROOT_DIR)
+ VERSION=$($ROOT_DIR/tools/read-version)
+ ARCHIVE_FN="$PWD/cloud-init-$REVNO-$VERSION.tar.gz"
+fi
+
+FILES=$(cd $ROOT_DIR && bzr ls --versioned --recursive)
+echo "$FILES" | tar czf $ARCHIVE_FN \
+ -C "$ROOT_DIR" \
+ --no-recursion --files-from -
+
+echo "$ARCHIVE_FN"