From 10ef076e14d5b28a11ecb43ed7add17c23ee7451 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 15 Mar 2024 14:25:17 +0100 Subject: [PATCH] Fix dev/releases/utils_github.py --- dev/releases/utils_github.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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