diff --git a/scripts/generate_site.py b/scripts/generate_site.py index aaae2d7ad..fe43620af 100644 --- a/scripts/generate_site.py +++ b/scripts/generate_site.py @@ -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 | {'
'.join(builds)} |") announced = profile.get("version_source") if isinstance(announced, dict) and announced.get("url"): url = str(announced["url"]) diff --git a/tests/test_audit_regressions.py b/tests/test_audit_regressions.py index 577b0cfff..5263d0c54 100644 --- a/tests/test_audit_regressions.py +++ b/tests/test_audit_regressions.py @@ -5207,6 +5207,25 @@ class CollectionCardsCarryFullHashes(unittest.TestCase): self.assertIn(f'
{value}
', 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."""