From 81fc3be7c7ff0ee9194fcc7b575646d6885498d3 Mon Sep 17 00:00:00 2001 From: Ole Herman Schumacher Elgesem Date: Tue, 26 Nov 2024 19:55:01 +0100 Subject: [PATCH] cfbs generate-release-information: Moved git logic and comparison to --check option and clarified log messages Doing all the work with git repos is slow and not needed for the main functionality, summarizing the released versions of masterfiles policy with version / path / checksum information. In the check option, It is useful to perform an extensive check, comparing "everything" in GitHub and on the download page. Signed-off-by: Ole Herman Schumacher Elgesem --- cfbs/args.py | 4 ++-- cfbs/cfbs.1 | 4 ++-- cfbs/main.py | 6 +++--- cfbs/masterfiles/generate_release_information.py | 16 +++++++++------- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/cfbs/args.py b/cfbs/args.py index 28bf28dd..ffdacb32 100644 --- a/cfbs/args.py +++ b/cfbs/args.py @@ -106,8 +106,8 @@ def get_arg_parser(): action="store_true", ) parser.add_argument( - "--check-against-downloads", - help="Check whether downloadable files match git files in 'cfbs generate-release-information'", + "--check-against-git", + help="Check whether masterfiles from cfengine.com and github.com match in 'cfbs generate-release-information'", action="store_true", ) parser.add_argument( diff --git a/cfbs/cfbs.1 b/cfbs/cfbs.1 index 7b9794f0..c52295d2 100644 --- a/cfbs/cfbs.1 +++ b/cfbs/cfbs.1 @@ -77,8 +77,8 @@ Ignore versions.json. Necessary in case of a custom index or testing changes to Use existing masterfiles instead of downloading in 'cfbs generate-release-information' .TP -\fB\-\-check\-against\-downloads\fR -Check whether downloadable files match git files in 'cfbs generate-release-information' +\fB\-\-check\-against\-git\fR +Check whether masterfiles from cfengine.com and github.com match in 'cfbs generate-release-information' .TP \fB\-\-masterfiles\fR \fI\,MASTERFILES\/\fR diff --git a/cfbs/main.py b/cfbs/main.py index 5c08e8ee..ca1bc533 100644 --- a/cfbs/main.py +++ b/cfbs/main.py @@ -64,9 +64,9 @@ def main() -> int: % args.command ) - if args.check_against_downloads and args.command != "generate-release-information": + if args.check_against_git and args.command != "generate-release-information": user_error( - "The option --check-against-downloads is only for 'cfbs generate-release-information', not 'cfbs %s'" + "The option --check-against-git is only for 'cfbs generate-release-information', not 'cfbs %s'" % args.command ) @@ -105,7 +105,7 @@ def main() -> int: if args.command == "generate-release-information": return commands.generate_release_information_command( - omit_download=args.omit_download, check=args.check_against_downloads + omit_download=args.omit_download, check=args.check_against_git ) if not is_cfbs_repo(): diff --git a/cfbs/masterfiles/generate_release_information.py b/cfbs/masterfiles/generate_release_information.py index dcb25650..aec568fc 100644 --- a/cfbs/masterfiles/generate_release_information.py +++ b/cfbs/masterfiles/generate_release_information.py @@ -17,17 +17,19 @@ def generate_release_information(omit_download=False, check=False): else: downloaded_versions = immediate_subdirectories(DOWNLOAD_PATH) - print("Generating release information...") - + print("Downloading releases of masterfiles from cfengine.com and generating release information...") generate_vcf_download(DOWNLOAD_PATH, downloaded_versions) - generate_vcf_git_checkout(downloaded_versions) if check: + print("Downloading releases of masterfiles from git (github.com) and generating additional release information for comparison...") + generate_vcf_git_checkout(downloaded_versions) print("Candidate release information generated.") - print("Checking that downloadable files match git files...") + print("Comparing files from cfengine.com and github.com...") check_download_matches_git(downloaded_versions) - print("Downloadable files match git files.") - - print("Release information generation successfully finished.") + print("The masterfiles downloaded from github.com and cfengine.com match.") + else: + print("Release information successfully generated.") + print("See the results in ./versions.json, ./checksums.json, and ./files.json") + print("(Run again with --check-against-git to download and compare with files from git, and generate -git.json files)")