diff --git a/dev/releases/utils_github.py b/dev/releases/utils_github.py index 5d0d162862..fb19aea970 100644 --- a/dev/releases/utils_github.py +++ b/dev/releases/utils_github.py @@ -11,7 +11,7 @@ import subprocess import github -from utils import error, notice, sha256file, verify_via_checksumfile +from utils import error, notice, sha256file CURRENT_REPO_NAME = os.environ.get("GITHUB_REPOSITORY", "gap-system/gap") @@ -59,6 +59,16 @@ def initialize_github(token=None) -> None: error("Error: the access token may be incorrect") +def verify_via_checksumfile(filename: str) -> None: + actual_checksum = sha256file(filename) + with open(filename + ".sha256", "r", encoding="utf-8") as f: + expected_checksum = f.read().strip() + if expected_checksum != actual_checksum: + error( + f"checksum for '{filename}' expected to be {expected_checksum} but got {actual_checksum}" + ) + + # Given the of a file that does not end with .sha256, create or get # the corresponding sha256 checksum file .sha256, (comparing checksums # just to be safe, in the latter case). Then upload the files and