refactor: installer pins keyed by bootstrap file

installer_build.pins read the site's served names from model.guides,
which loads the guides YAML at import. Since the launcher builders read
the pin through it, the installer doc build pulled pyyaml in, and the
Python 3.8 installer job has none.
This commit is contained in:
Abdessamad Derraz committed 2026-11-19 02:57:02 +01:00
1 parent 9ac3145c5e
commit 753d39ffe3
4 files changed
+6 -9

No files matched your search

+3 -4
View File
@@ -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"
+1 -2
View File
@@ -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)
+1 -2
View File
@@ -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
+1 -1
View File
@@ -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()