summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/read-version39
1 files changed, 2 insertions, 37 deletions
diff --git a/tools/read-version b/tools/read-version
index e69c2ce0..06fd61a8 100755
--- a/tools/read-version
+++ b/tools/read-version
@@ -45,49 +45,14 @@ def which(program):
return None
-def is_gitdir(path):
- # Return boolean indicating if path is a git tree.
- git_meta = os.path.join(path, '.git')
- if os.path.isdir(git_meta):
- return True
- if os.path.exists(git_meta):
- # in a git worktree, .git is a file with 'gitdir: x'
- with open(git_meta, "rb") as fp:
- if b'gitdir:' in fp.read():
- return True
- return False
-
-
use_long = '--long' in sys.argv or os.environ.get('CI_RV_LONG')
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_long = None
-
-if is_gitdir(_tdir) and which("git"):
- flags = []
- if use_tags:
- flags = ['--tags']
- cmd = ['git', 'describe', '--abbrev=8', '--match=[0-9]*'] + flags
-
- 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.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 = src_version
+version_long = None
# version is X.Y.Z[+xxx.gHASH]
# version_long is None or X.Y.Z-xxx-gHASH