summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorScott Moser <smoser@brickies.net>2016-08-08 13:24:59 -0400
committerScott Moser <smoser@brickies.net>2016-08-08 17:52:24 -0400
commit48ec60ae19c749223cb58dcbdbf0ecb7343f2a31 (patch)
tree983b5efe44d5c92aa67d34e8ad304fc60acfeb98 /tools
parentd0b2863bc8dfab2919b11bbcc2584c1c51223028 (diff)
downloadvyos-cloud-init-48ec60ae19c749223cb58dcbdbf0ecb7343f2a31.tar.gz
vyos-cloud-init-48ec60ae19c749223cb58dcbdbf0ecb7343f2a31.zip
For upstream snapshot versions do not modify git-describe output.
For upstream version directly use the output of git-describe (X.Y.Z-number.gHASH) rather than rather than changing it to (X.Y.Z+number.gHASH). The rpm version does not allow '-' in Version, so we create and use rpm_upstream_version in the rpm spec file. That is of format: X.Y.Z+number.gHASH
Diffstat (limited to 'tools')
-rwxr-xr-xtools/make-tarball9
-rwxr-xr-xtools/read-version17
2 files changed, 6 insertions, 20 deletions
diff --git a/tools/make-tarball b/tools/make-tarball
index 57358447..d8705896 100755
--- a/tools/make-tarball
+++ b/tools/make-tarball
@@ -35,14 +35,7 @@ while [ $# -ne 0 ]; do
done
rev=${1:-HEAD}
-git_describe=$(git describe ${long_opt} $rev)
-
-# 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 "$git_describe" in
- *-*) version=$(echo "$git_describe" | sed -e 's/-/+/' -e 's/-/./');;
- *) version=${git_describe};;
-esac
+version=$(git describe ${long_opt} $rev)
archive_base="cloud-init-$version"
if [ -z "$output" ]; then
diff --git a/tools/read-version b/tools/read-version
index 78e34157..85c62343 100755
--- a/tools/read-version
+++ b/tools/read-version
@@ -34,26 +34,19 @@ src_version = ci_version.version_string()
version_long = None
if os.path.isdir(os.path.join(_tdir, ".git")):
- def fix_git_version(ver):
- ver = ver.strip()
- if "-" in ver:
- # change X.Y.Z-1023-gHASH to X.Y.Z+1023.ghash
- return "{0}+{1}.{2}".format(*ver.split("-"))
- return ver
-
flags = []
if use_tags:
flags = ['--tags']
cmd = ['git', 'describe'] + flags
- version = fix_git_version(tiny_p(cmd))
+ version = tiny_p(cmd).strip()
if not version.startswith(src_version):
sys.stderr.write("git describe version (%s) differs from "
"cloudinit.version (%s)\n" % (version, src_version))
sys.exit(1)
- version_long = fix_git_version(tiny_p(cmd + ["--long"]))
+ version_long = tiny_p(cmd + ["--long"]).strip()
else:
version = src_version
version_long = None
@@ -66,9 +59,9 @@ commit = None
distance = None
if version_long:
- info = version_long.partition("+")[2]
- extra = "+" + info
- distance, commit = info.split(".")
+ info = version_long.partition("-")[2]
+ extra = "-" + info
+ distance, commit = info.split("-")
# remove the 'g' from gHASH
commit = commit[1:]