diff options
author | Lars Kellogg-Stedman <lars@redhat.com> | 2016-07-22 15:09:24 -0400 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2016-08-03 16:00:52 -0400 |
commit | 72d6adcb2e4cb5911f7809b89835965d4bf04476 (patch) | |
tree | 64b33f605847b5b26f67e37882442ea0c3620552 /tools/make-tarball | |
parent | eed7fccdb9e59e5b2cc9e6d94af06f075c6ced67 (diff) | |
download | vyos-cloud-init-72d6adcb2e4cb5911f7809b89835965d4bf04476.tar.gz vyos-cloud-init-72d6adcb2e4cb5911f7809b89835965d4bf04476.zip |
Update build tools to work with git
- Update HACKING.rst to include git instructions
- update MANIFEST.in and .gitignore to ignore git-related things
- replaced tarball generation scripts with git-based script
- have the spec files correctly identify themselves as cheetah templates
- make brpm work with git
Diffstat (limited to 'tools/make-tarball')
-rwxr-xr-x | tools/make-tarball | 54 |
1 files changed, 24 insertions, 30 deletions
diff --git a/tools/make-tarball b/tools/make-tarball index b7039150..4828a622 100755 --- a/tools/make-tarball +++ b/tools/make-tarball @@ -1,39 +1,33 @@ #!/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" -} +rev=${1:-HEAD} +revname=$(git describe $rev) -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 - -REVNO=$(bzr revno "$ROOT_DIR") +# revname could be 0.7.5 or 0.7.5-NNN-gHASH +# turn that into 0.7.5 or 0.7.5+NNN.gHASH +case "$revname" in + *-*) revname=$(echo "$revname" | sed -e 's/-/+/' -e 's/-/./') +esac -if [ ! -z "$1" ]; then - ARCHIVE_FN="$1" -else - VERSION=$("$ROOT_DIR/tools/read-version") - ARCHIVE_FN="$PWD/cloud-init-$VERSION~bzr$REVNO.tar.gz" -fi +archive_base="cloud-init-$revname" -export_uncommitted="" -if [ "${UNCOMMITTED:-0}" != "0" ]; then - export_uncommitted="--uncommitted" +# when building an archiving from HEAD, ensure that there aren't any +# uncomitted changes in the working directory (because these would not +# end up in the archive). +if [ "$rev" = HEAD ] && ! git diff-index --quiet HEAD --; then + if [ -z "$SKIP_UNCOMITTED_CHANGES_CHECK" ]; then + echo "ERROR: There are uncommitted changes in your working directory." >&2 + exit 1 + else + echo "WARNING: There are uncommitted changes in your working directory." >&2 + echo " This changes will not be included in the archive." >&2 + fi fi -bzr export ${export_uncommitted} \ - --format=tgz --root="cloud-init-$VERSION~bzr$REVNO" \ - "--revision=${REVNO}" "${ARCHIVE_FN}" "$ROOT_DIR" +git archive \ + --format=tar.gz \ + --prefix="$archive_base/" "$rev" \ + "--output=$archive_base.tar.gz" -echo "$ARCHIVE_FN" +echo "${archive_base}.tar.gz" |