1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
Description: Drop all unused extended version handling
Author: Bastian Blank <waldi@debian.org>
Date: Sun, 4 Dec 2016 12:13:49 +0100
Last-Update: 2019-08-29
Index: cloud-init/tools/read-version
===================================================================
--- cloud-init.orig/tools/read-version
+++ cloud-init/tools/read-version
@@ -54,7 +54,7 @@ use_long = "--long" in sys.argv or os.en
use_tags = "--tags" in sys.argv or os.environ.get("CI_RV_TAGS")
output_json = "--json" in sys.argv
-src_version = ci_version.version_string()
+version = src_version = ci_version.version_string()
version_long = None
# If we're performing CI for a new release branch (which our tooling creates
@@ -68,44 +68,6 @@ travis_ci_release_br = bool(
)
is_release_branch_ci = bool(github_ci_release_br or travis_ci_release_br)
-if is_gitdir(_tdir) and which("git") and not is_release_branch_ci:
- # This cmd can be simplified to ["git", "branch", "--show-current"]
- # after bionic EOL.
- branch_name = tiny_p(["git", "rev-parse", "--abbrev-ref", "HEAD"]).strip()
- if branch_name.startswith(f"upstream/{src_version}"):
- version = src_version
- version_long = None
- else:
-
- flags = []
- if use_tags:
- flags = ["--tags"]
- cmd = ["git", "describe", "--abbrev=8", "--match=[0-9]*"] + flags
-
- try:
- version = tiny_p(cmd).strip()
- except RuntimeError:
- version = None
-
- if version is None or not version.startswith(src_version):
- sys.stderr.write(
- f"git describe version ({version}) differs from "
- f"cloudinit.version ({src_version})\n"
- )
- sys.stderr.write(
- "Please get the latest upstream tags.\n"
- "As an example, this can be done with the following:\n"
- "$ git remote add upstream https://git.launchpad.net/"
- "cloud-init\n"
- "$ git fetch upstream --tags\n"
- )
- sys.exit(1)
-
- version_long = tiny_p(cmd + ["--long"]).strip()
-else:
- version = src_version
- version_long = None
-
# version is X.Y.Z[+xxx.gHASH]
# version_long is None or X.Y.Z-xxx-gHASH
release = version.partition("-")[0]
@@ -114,9 +76,8 @@ commit = None
distance = None
if version_long:
- info = version_long.partition("-")[2]
- extra = "-" + info
- distance, commit = info.split("-")
+ distance, commit = version_long.split("-")[1:3]
+ extra = "-" + distance + "-" + commit
# remove the 'g' from gHASH
commit = commit[1:]
|