Adapt download.py to run as a package script

This commit is contained in:
Max Gautier
2025-01-11 15:47:07 +01:00
parent ba3258d7f0
commit a551922c84

View File

@@ -318,32 +318,36 @@ def download_hash(only_downloads: [str]) -> None:
yaml.dump(data, checksums_yml) yaml.dump(data, checksums_yml)
logger.info("Updated %s", CHECKSUMS_YML) logger.info("Updated %s", CHECKSUMS_YML)
parser = argparse.ArgumentParser(description=f"Add new patch versions hashes in {CHECKSUMS_YML}",
formatter_class=argparse.RawTextHelpFormatter,
epilog=f"""
This script only lookup new patch versions relative to those already existing
in the data in {CHECKSUMS_YML},
which means it won't add new major or minor versions.
In order to add one of these, edit {CHECKSUMS_YML}
by hand, adding the new versions with a patch number of 0 (or the lowest relevant patch versions)
and a hash value of 0.
; then run this script.
Note that the script will try to add the versions on all def main():
architecture keys already present for a given download target.
EXAMPLES: logging.basicConfig(stream=sys.stdout, level=logging.INFO)
parser = argparse.ArgumentParser(description=f"Add new patch versions hashes in {CHECKSUMS_YML}",
formatter_class=argparse.RawTextHelpFormatter,
epilog=f"""
This script only lookup new patch versions relative to those already existing
in the data in {CHECKSUMS_YML},
which means it won't add new major or minor versions.
In order to add one of these, edit {CHECKSUMS_YML}
by hand, adding the new versions with a patch number of 0 (or the lowest relevant patch versions)
and a hash value of 0.
; then run this script.
crictl_checksums: Note that the script will try to add the versions on all
... architecture keys already present for a given download target.
amd64:
+ 1.30.0: 0
1.29.0: d16a1ffb3938f5a19d5c8f45d363bd091ef89c0bc4d44ad16b933eede32fdcbb
1.28.0: 8dc78774f7cbeaf787994d386eec663f0a3cf24de1ea4893598096cb39ef2508"""
) EXAMPLES:
parser.add_argument('binaries', nargs='*', choices=downloads.keys(),
help='if provided, only obtain hashes for these compoments')
args = parser.parse_args() crictl_checksums:
download_hash(args.binaries) ...
amd64:
+ 1.30.0: 0
1.29.0: d16a1ffb3938f5a19d5c8f45d363bd091ef89c0bc4d44ad16b933eede32fdcbb
1.28.0: 8dc78774f7cbeaf787994d386eec663f0a3cf24de1ea4893598096cb39ef2508"""
)
parser.add_argument('binaries', nargs='*', choices=downloads.keys(),
help='if provided, only obtain hashes for these compoments')
args = parser.parse_args()
download_hash(args.binaries)