Browse Source

Adapt download.py to run as a package script

pull/11891/head
Max Gautier 3 months ago
parent
commit
a551922c84
Failed to extract signature
1 changed files with 33 additions and 29 deletions
  1. 62
      scripts/component_hash_update/src/component_hash_update/download.py

62
scripts/component_hash_update/src/component_hash_update/download.py

@ -318,32 +318,36 @@ def download_hash(only_downloads: [str]) -> None:
yaml.dump(data, 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
architecture keys already present for a given download target.
EXAMPLES:
crictl_checksums:
...
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)
def main():
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.
Note that the script will try to add the versions on all
architecture keys already present for a given download target.
EXAMPLES:
crictl_checksums:
...
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)
Loading…
Cancel
Save