Skip to content

Commit

Permalink
Merge pull request #211 from olehermanse/master
Browse files Browse the repository at this point in the history
cfbs generate-release-information: Moved git logic and comparison to --check option and clarified log messages
  • Loading branch information
olehermanse authored Nov 27, 2024
2 parents d9f2cd4 + 81fc3be commit 8eed11e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
4 changes: 2 additions & 2 deletions cfbs/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions cfbs/cfbs.1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions cfbs/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down Expand Up @@ -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():
Expand Down
16 changes: 9 additions & 7 deletions cfbs/masterfiles/generate_release_information.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)")

0 comments on commit 8eed11e

Please sign in to comment.