diff --git a/cfbs/args.py b/cfbs/args.py index 1e608fae..28bf28dd 100644 --- a/cfbs/args.py +++ b/cfbs/args.py @@ -105,6 +105,11 @@ def get_arg_parser(): help="Use existing masterfiles instead of downloading in 'cfbs generate-release-information'", action="store_true", ) + parser.add_argument( + "--check-against-downloads", + help="Check whether downloadable files match git files in 'cfbs generate-release-information'", + action="store_true", + ) parser.add_argument( "--masterfiles", help="Add masterfiles on cfbs init choose between" ) diff --git a/cfbs/cfbs.1 b/cfbs/cfbs.1 index 1a0bca30..7b9794f0 100644 --- a/cfbs/cfbs.1 +++ b/cfbs/cfbs.1 @@ -1,4 +1,4 @@ -.TH CFBS "1" "2024\-11\-22" "cfbs" "CFEngine Build System manual" +.TH CFBS "1" "2024\-11\-26" "cfbs" "CFEngine Build System manual" .SH NAME cfbs \- combines multiple modules into 1 policy set to deploy on your infrastructure. Modules can be custom promise types, JSON files which enable certain functionality, or reusable CFEngine policy. The modules you use can be written by the CFEngine team, others in the community, your colleagues, or yourself. .SH SYNOPSIS @@ -76,6 +76,10 @@ Ignore versions.json. Necessary in case of a custom index or testing changes to \fB\-\-omit\-download\fR 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' + .TP \fB\-\-masterfiles\fR \fI\,MASTERFILES\/\fR Add masterfiles on cfbs init choose between diff --git a/cfbs/commands.py b/cfbs/commands.py index 324d793d..d1788dd0 100644 --- a/cfbs/commands.py +++ b/cfbs/commands.py @@ -1208,5 +1208,5 @@ def get_input_command(name, outfile): @cfbs_command("generate-release-information") -def generate_release_information_command(omit_download=False): - generate_release_information(omit_download) +def generate_release_information_command(omit_download=False, check=False): + generate_release_information(omit_download, check) diff --git a/cfbs/main.py b/cfbs/main.py index 83bd1018..5c08e8ee 100644 --- a/cfbs/main.py +++ b/cfbs/main.py @@ -64,6 +64,12 @@ def main() -> int: % args.command ) + if args.check_against_downloads and args.command != "generate-release-information": + user_error( + "The option --check-against-downloads is only for 'cfbs generate-release-information', not 'cfbs %s'" + % args.command + ) + if args.non_interactive and args.command not in ( "init", "add", @@ -99,7 +105,7 @@ def main() -> int: if args.command == "generate-release-information": return commands.generate_release_information_command( - omit_download=args.omit_download + omit_download=args.omit_download, check=args.check_against_downloads ) if not is_cfbs_repo(): diff --git a/cfbs/masterfiles/generate_release_information.py b/cfbs/masterfiles/generate_release_information.py index d8eff440..dcb25650 100644 --- a/cfbs/masterfiles/generate_release_information.py +++ b/cfbs/masterfiles/generate_release_information.py @@ -7,7 +7,7 @@ DOWNLOAD_PATH = "downloaded_masterfiles" -def generate_release_information(omit_download=False): +def generate_release_information(omit_download=False, check=False): if not omit_download: print("Downloading masterfiles...") @@ -22,10 +22,12 @@ def generate_release_information(omit_download=False): generate_vcf_download(DOWNLOAD_PATH, downloaded_versions) generate_vcf_git_checkout(downloaded_versions) - print("Candidate release information generated.") - print("Checking that downloadable files match git files...") + if check: + print("Candidate release information generated.") + print("Checking that downloadable files match git files...") - check_download_matches_git(downloaded_versions) + check_download_matches_git(downloaded_versions) + + print("Downloadable files match git files.") - print("Downloadable files match git files.") print("Release information generation successfully finished.")