Skip to content

Commit

Permalink
Fix dev/releases/utils_github.py
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Mar 15, 2024
1 parent fbb2634 commit 10ef076
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion dev/releases/utils_github.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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 <filename> of a file that does not end with .sha256, create or get
# the corresponding sha256 checksum file <filename>.sha256, (comparing checksums
# just to be safe, in the latter case). Then upload the files <filename> and
Expand Down

0 comments on commit 10ef076

Please sign in to comment.