diff --git a/scripts/installer_build/pins.py b/scripts/installer_build/pins.py index ecce09eb5..31f6daaae 100644 --- a/scripts/installer_build/pins.py +++ b/scripts/installer_build/pins.py @@ -7,7 +7,6 @@ import re from pathlib import Path from core.paths import REPO_ROOT -from model.guides import PS1_NAME, SH_NAME INSTALLER = "install.py" @@ -16,10 +15,10 @@ PINS: dict[str, re.Pattern[str]] = { "install.sh": re.compile(r'^(DEFAULT_INSTALL_SHA256=")[0-9a-f]{64}(")', re.M), "install.ps1": re.compile(r'^(\s*\$defaultInstallSha256 = ")[0-9a-f]{64}(")', re.M), } -# The value of that pin line, by the name the site serves each bootstrap under. +# The value of that pin line, by bootstrap. PIN: dict[str, re.Pattern[str]] = { - SH_NAME: re.compile(r'^DEFAULT_INSTALL_SHA256="([0-9a-f]{64})"', re.M), - PS1_NAME: re.compile(r'^\s*\$defaultInstallSha256 = "([0-9a-f]{64})"', re.M), + "install.sh": re.compile(r'^DEFAULT_INSTALL_SHA256="([0-9a-f]{64})"', re.M), + "install.ps1": re.compile(r'^\s*\$defaultInstallSha256 = "([0-9a-f]{64})"', re.M), } COMMAND = "python scripts/pin_installer.py" diff --git a/scripts/installer_build/port.py b/scripts/installer_build/port.py index 43d8ff174..8a7eca88d 100644 --- a/scripts/installer_build/port.py +++ b/scripts/installer_build/port.py @@ -7,7 +7,6 @@ from pathlib import Path from core.paths import REPO_ROOT from installer_build.pins import PIN, installer_sha256 -from model.guides import SH_NAME PORT_DIR = "retrobios" @@ -24,7 +23,7 @@ PACKS_TABLE = "packs.txt" def pinned_installer_sha256(root: Path = REPO_ROOT) -> str: """The SHA-256 install.sh accepts for install.py.""" - found = PIN[SH_NAME].search((root / "install.sh").read_text(encoding="utf-8")) + found = PIN["install.sh"].search((root / "install.sh").read_text(encoding="utf-8")) if found is None: raise ValueError("install.sh pins no installer SHA-256") return found.group(1) diff --git a/scripts/installer_build/pypi.py b/scripts/installer_build/pypi.py index 0f208e414..e001bb230 100644 --- a/scripts/installer_build/pypi.py +++ b/scripts/installer_build/pypi.py @@ -11,7 +11,6 @@ import tempfile from pathlib import Path from core.paths import REPO_ROOT -from model.guides import SH_NAME from installer_build.pins import PIN @@ -59,7 +58,7 @@ def installer_bytes() -> bytes: """install.py, refused unless it is the one install.sh pins: the package then runs the installer the one-line command runs, under the same id.""" data = (REPO_ROOT / "install.py").read_bytes() - pins = PIN[SH_NAME].findall((REPO_ROOT / "install.sh").read_text(encoding="utf-8")) + pins = PIN["install.sh"].findall((REPO_ROOT / "install.sh").read_text(encoding="utf-8")) if pins != [hashlib.sha256(data).hexdigest()]: raise ValueError("install.py is not the installer install.sh pins: recompute the pin") return data diff --git a/scripts/sitegen/bootstrap.py b/scripts/sitegen/bootstrap.py index 8e8289412..b733df63f 100644 --- a/scripts/sitegen/bootstrap.py +++ b/scripts/sitegen/bootstrap.py @@ -72,7 +72,7 @@ def served_text(name: str, root: Path, commit: str) -> str: pair served.""" source, line = SOURCES[name] text = (root / source).read_text(encoding="utf-8") - pinned = PIN[name].findall(text) + pinned = PIN[source].findall(text) if len(pinned) != 1: raise ValueError(f"{source}: {len(pinned)} installer pins, expected one") actual = hashlib.sha256((root / "install.py").read_bytes()).hexdigest()