diff --git a/CHANGES b/CHANGES index dbedb01ab3..c73878743d 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,12 @@ +6.0.0-dev.94 | 2023-02-22 19:29:52 +0100 + + * ci/collect-repo-info: No hard dependency on git (Arne Welzel, Corelight) + + The OBS builds run in an environment where no git is installed and + release tarballs assembled manually. + + Drop the hard-requirement on git from ci/collect-repo-info.json. + 6.0.0-dev.92 | 2023-02-22 16:49:36 +0100 * GH-2776: zeek-config: Move ZEEK_VERSION* out of zeek-config.h (Arne Welzel, Corelight) diff --git a/VERSION b/VERSION index 0eb13e471c..f2d0c37623 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.0.0-dev.92 +6.0.0-dev.94 diff --git a/ci/collect-repo-info.py b/ci/collect-repo-info.py index 81846f39cc..118a6f79cf 100755 --- a/ci/collect-repo-info.py +++ b/ci/collect-repo-info.py @@ -25,6 +25,16 @@ def git(*args, **kwargs): return subprocess.check_output([GIT, *args], **kwargs).decode("utf-8") +def git_available(): + try: + git("--version", stderr=subprocess.DEVNULL) + return True + except OSError: + pass + + return False + + def git_is_repo(d: pathlib.Path): try: git("-C", str(d), "rev-parse", "--is-inside-work-tree", stderr=subprocess.DEVNULL) @@ -150,16 +160,14 @@ def main(): logger.error("%s missing zeek-config.h.in", zeek_dir) return 1 - try: - git("--version") - except OSError as e: - logger.error("No git? (%s)", str(e)) + if args.only_git and not git_available(): + logger.error("git not found and --only-git provided") return 1 # Attempt to collect info from git first and alternatively # fall back to a repo-info.json file within what is assumed # to be a tarball. - if git_is_repo(zeek_dir): + if git_available() and git_is_repo(zeek_dir): info = collect_git_info(zeek_dir) elif not args.only_git: try: @@ -167,10 +175,13 @@ def main(): info = json.load(fp) info["source"] = "repo-info.json" except FileNotFoundError: - logger.error("%s is not a git repo and repo-info.json missing", zeek_dir) + git_info_msg = "" + if not git_available(): + git_info_msg = " (git not found)" + logger.error("%s has no repo-info.json%s", zeek_dir, git_info_msg) return 1 else: - logger.error("Not a git repo and --only-git provided") + logger.error("%s is not a git repo and --only-git provided", zeek_dir) return 1 included_plugins_info = []