From 985e0c6473d92131c2b196c864a7fd7e4e9c39c9 Mon Sep 17 00:00:00 2001 From: akwizgran <michael@briarproject.org> Date: Tue, 22 Nov 2022 14:49:46 +0000 Subject: [PATCH] Don't clobber built jar when downloading reference jar. --- build-binary.py | 11 +++++------ utils.py | 14 +++++++------- verify-binary.py | 6 +++--- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/build-binary.py b/build-binary.py index 2cb187a..c6f707b 100755 --- a/build-binary.py +++ b/build-binary.py @@ -3,8 +3,8 @@ import os, shutil from glob import glob from subprocess import check_call -from utils import get_build_versions, ex, get_sha256, zip_files, get_final_file_name, \ - get_sources_file_name, get_pom_file_name, reset_time, get_version_number, check_go_version, \ +from utils import get_build_versions, ex, get_sha256, zip_files, get_final_file_path, \ + get_sources_file_path, get_pom_file_path, reset_time, get_version_number, check_go_version, \ get_version_and_tool, get_output_dir, get_platform_output_dir, GO_PATH, GO_ROOT, NDK_DIR @@ -193,7 +193,7 @@ def package_windows(tool, versions): def package(tool, versions, file_list, platform): - zip_file = get_final_file_name(tool, versions, platform) + zip_file = get_final_file_path(tool, versions, platform) zip_files(file_list, zip_file, versions) create_sources_jar(tool, versions, platform) create_pom_file(tool, versions, platform) @@ -215,19 +215,18 @@ def create_sources_jar(tool, versions, platform): for file in glob(os.path.join(repo_dir, '*')): reset_time(file, versions) jar_files.append(os.path.relpath(file, repo_dir)) - jar_path = get_sources_file_name(tool, versions, platform) + jar_path = get_sources_file_path(tool, versions, platform) check_call(['jar', 'cf', jar_path] + jar_files, cwd=repo_dir) def create_pom_file(tool, versions, platform): tool_version = get_version_number(versions) - pom_file = get_pom_file_name(tool, versions, platform) + pom_file = get_pom_file_path(tool, versions, platform) template = 'template-%s-%s.pom' % (tool, platform) with open(template, 'rt') as infile: with open(pom_file, 'wt') as outfile: for line in infile: outfile.write(line.replace('VERSION', tool_version)) - return pom_file if __name__ == "__main__": diff --git a/utils.py b/utils.py index 68abaad..c45e88d 100644 --- a/utils.py +++ b/utils.py @@ -76,23 +76,23 @@ def get_version_number(versions): return versions['tag'] -def get_output_file(tool, versions, platform, suffix): +def get_output_file_path(tool, versions, platform, suffix): output_dir = get_platform_output_dir(tool, platform) version = get_version_number(versions) filename = '%s-%s-%s%s' % (tool, platform, version, suffix) return os.path.join(output_dir, filename) -def get_final_file_name(tool, versions, platform): - return get_output_file(tool, versions, platform, '.jar') +def get_final_file_path(tool, versions, platform): + return get_output_file_path(tool, versions, platform, '.jar') -def get_sources_file_name(tool, versions, platform): - return get_output_file(tool, versions, platform, '-sources.jar') +def get_sources_file_path(tool, versions, platform): + return get_output_file_path(tool, versions, platform, '-sources.jar') -def get_pom_file_name(tool, versions, platform): - return get_output_file(tool, versions, platform, '.pom') +def get_pom_file_path(tool, versions, platform): + return get_output_file_path(tool, versions, platform, '.pom') def get_output_dir(tool): diff --git a/verify-binary.py b/verify-binary.py index 7c69ebf..0e9f0ed 100755 --- a/verify-binary.py +++ b/verify-binary.py @@ -3,7 +3,7 @@ import os import sys from subprocess import check_call, CalledProcessError -from utils import get_sha256, fail, get_build_versions, get_final_file_name, \ +from utils import get_sha256, fail, get_build_versions, get_final_file_path, \ get_version_and_tool, get_version_number @@ -25,7 +25,7 @@ def verify(tool, command_line_version, platform): tool_version, versions = get_build_versions(tool, command_line_version) # download reference binary - file_name = get_final_file_name(tool, versions, platform) + file_name = os.path.basename(get_final_file_path(tool, versions, platform)) os.makedirs('reference', exist_ok=True) reference_file_name = os.path.join('reference', file_name) # try downloading from maven central @@ -58,7 +58,7 @@ def verify(tool, command_line_version, platform): def get_url(tool, versions, platform): version = get_version_number(versions) directory = "%s-%s" % (tool, platform) - file = get_final_file_name(tool, versions, platform) + file = os.path.basename(get_final_file_path(tool, versions, platform)) return "https://repo.maven.apache.org/maven2/org/briarproject/%s/%s/%s" % (directory, version, file) -- GitLab