diff options
author | Scott Moser <smoser@brickies.net> | 2016-08-05 11:56:48 -0400 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2016-08-05 15:00:12 -0400 |
commit | 10f82bd474c5bc91b330beccd883da06b0014a99 (patch) | |
tree | 2d7e815950bac66d905f5481b54b732a0458d1ef /tools/make-tarball | |
parent | 72d6adcb2e4cb5911f7809b89835965d4bf04476 (diff) | |
download | vyos-cloud-init-10f82bd474c5bc91b330beccd883da06b0014a99.tar.gz vyos-cloud-init-10f82bd474c5bc91b330beccd883da06b0014a99.zip |
adjust tools and version information.
upstream snapshots are versioned in the format 'X.Y.Z+<distance>.g<commit>'
where X.Y.Z are major, minor, and micro. Distance is number of commits
since last annotated tag, and commit is the git commit.
bddeb and brpm will now create and use the "upstream version" like above.
Things changed here:
- tools/make-tarball
update cloudinit/version.py to contain the full version
support --output
support '--long' to always create the long format version string.
- bddeb:
- use quilt debian source format
- use read-version and long version in changelog.
- brpm:
- change to use read-version and upstream long version in the spec.
- flake8 changes
- tools/read-version
- read version from git or from cloudinit/version.
- provide --json output with more nicely formed data.
Diffstat (limited to 'tools/make-tarball')
-rwxr-xr-x | tools/make-tarball | 59 |
1 files changed, 49 insertions, 10 deletions
diff --git a/tools/make-tarball b/tools/make-tarball index 4828a622..bd7399c1 100755 --- a/tools/make-tarball +++ b/tools/make-tarball @@ -1,16 +1,53 @@ #!/bin/sh set -e +TEMP_D="" +cleanup() { + [ -z "$TEMP_D" ] || rm -Rf "${TEMP_D}" +} +trap cleanup EXIT + +Usage() { + cat <<EOF +Usage: ${0##*/} [revision] + create a tarball of revision (default HEAD) + + options: + -o | --output FILE write to file +EOF +} + +short_opts="ho:v" +long_opts="help,output:,long,verbose" +getopt_out=$(getopt --name "${0##*/}" \ + --options "${short_opts}" --long "${long_opts}" -- "$@") && + eval set -- "${getopt_out}" || { Usage 1>&2; exit 1; } + +long_opt="" +while [ $# -ne 0 ]; do + cur=$1; next=$2 + case "$cur" in + -o|--output) output=$next; shift;; + --long) long_opt="--long";; + --) shift; break;; + esac + shift; +done + rev=${1:-HEAD} -revname=$(git describe $rev) +git_describe=$(git describe ${long_opt} $rev) -# revname could be 0.7.5 or 0.7.5-NNN-gHASH +# git_describe 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/-/./') +case "$git_describe" in + *-*) version=$(echo "$git_describe" | sed -e 's/-/+/' -e 's/-/./');; + *) version=${git_describe};; esac -archive_base="cloud-init-$revname" +archive_base="cloud-init-$version" +if [ -z "$output" ]; then + output="$archive_base.tar.gz" +fi # when building an archiving from HEAD, ensure that there aren't any # uncomitted changes in the working directory (because these would not @@ -25,9 +62,11 @@ if [ "$rev" = HEAD ] && ! git diff-index --quiet HEAD --; then fi fi -git archive \ - --format=tar.gz \ - --prefix="$archive_base/" "$rev" \ - "--output=$archive_base.tar.gz" +git archive --format=tar --prefix="$archive_base/" "$rev" | + ( cd "$TEMP_D" && tar xpf - ) + +sed -i "s,@@EXPORT_VERSION@@,$version," "$archive_base/cloudinit/version.py" + +( cd "$TEMP_D" && tar cpzf - "$archive_base/" ) > "$output" -echo "${archive_base}.tar.gz" +echo "$output" |