diff options
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:] |