diff options
author | Scott Moser <smoser@brickies.net> | 2016-08-08 13:24:59 -0400 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2016-08-08 17:52:24 -0400 |
commit | 48ec60ae19c749223cb58dcbdbf0ecb7343f2a31 (patch) | |
tree | 983b5efe44d5c92aa67d34e8ad304fc60acfeb98 /tools/read-version | |
parent | d0b2863bc8dfab2919b11bbcc2584c1c51223028 (diff) | |
download | vyos-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/read-version')
-rwxr-xr-x | tools/read-version | 17 |
1 files changed, 5 insertions, 12 deletions
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:] |