feat: link the build file that holds a revision

pin_build, in 36 profiles, names the platform repository, revision, file
and variable that hold a pin_frozen revision, and the site read none of
it: the Revision held row printed the file as plain text. A Build file
row links each one at the revision it was read at.
This commit is contained in:
Abdessamad Derraz committed 2026-11-06 08:20:46 +01:00
1 parent d1535d0787
commit c7a30856b0
2 files changed
+39

No files matched your search

+20
View File
@@ -8196,6 +8196,23 @@ def _exact_size(size: int) -> str:
return _fmt_size(size) if size < 1024 else f"{_fmt_size(size)} ({size:,} bytes)"
def _build_file_links(pin_build: list[dict]) -> list[str]:
"""Each platform build file that holds the revision, linked at the
revision it was read at. The prose of pin_frozen named the file as
plain text, while pin_build carries all a pinned link needs."""
from sitesources import _browse_repo, _source_permalink # noqa: PLC0415
links = []
for build in pin_build:
repo = _browse_repo(str(build["repo"]))
path = str(build["path"])
text = f"{_escape_tags(_platform_display(str(build['platform'])))} {_code(path)}"
if repo is not None:
text = f"[{text}]({_source_permalink(repo, str(build['revision']), path, None, None)})"
links.append(f"{text} at {_code(str(build['revision']))} sets {_code(str(build['variable']))}")
return links
def _build_rows(profile: dict) -> list[str]:
"""Meta card rows for who ships the build, how its files are found, why
its revision is held and where its releases are announced."""
@@ -8216,6 +8233,9 @@ def _build_rows(profile: dict) -> list[str]:
if frozen:
held = _escape_tags(' '.join(str(frozen).split())).replace('|', r'\|')
rows.append(f"| {label} | {held} |")
builds = _build_file_links(profile.get("pin_build") or [])
if builds:
rows.append(f"| Build file | {'<br>'.join(builds)} |")
announced = profile.get("version_source")
if isinstance(announced, dict) and announced.get("url"):
url = str(announced["url"])
+19
View File
@@ -5207,6 +5207,25 @@ class CollectionCardsCarryFullHashes(unittest.TestCase):
self.assertIn(f'<dd class="rb-hash">{value}</dd>', text)
class AHeldRevisionLinksItsBuildFile(unittest.TestCase):
"""advanced_drastic's page printed the KNULLI build file that holds its
revision as plain text, while pin_build carries the repository, the tag
and the path a pinned link needs. 36 profiles carry one."""
def test_the_build_file_row(self):
from scripts.generate_site import _build_rows
rows = _build_rows({"pin_frozen": "KNULLI builds this revision.", "pin_build": [{
"platform": "knulli", "repo": "https://github.com/knulli-cfw/knulli-linux",
"revision": "20260511", "path": "package/emulators/advanced_drastic/advanced_drastic.mk",
"variable": "ADVANCED_DRASTIC_VERSION", "value": "eaf41ab9"}]})
self.assertIn(
"| Build file | [KNULLI `package/emulators/advanced_drastic/advanced_drastic.mk`]"
"(https://github.com/knulli-cfw/knulli-linux/blob/20260511/package/emulators/"
"advanced_drastic/advanced_drastic.mk) at `20260511` sets `ADVANCED_DRASTIC_VERSION` |",
rows)
class AVariantCardSaysWhatToSaveItAs(unittest.TestCase):
"""The Download button of a .variants/ card saved advision.zip.1c086064,
the storage name, and nothing said RetroBat looks for advision.zip."""