fix: match release packs by exact name

release_record rebuilt nothing from the name builder: a substring match
took RetroArch_v1.22.2_AndroidArm64V8A_BIOS_Pack.zip for the RetroArch
pack. The record now refuses any pack that is not a registered platform's
full pack and stores the platforms each pack serves, which the readers
use instead of the pack name.
This commit is contained in:
Abdessamad Derraz committed 2026-10-21 09:51:55 +02:00
1 parent 0242dc77ee
commit 43337c6719
7 files changed
+176 -47

No files matched your search

+18 -8
View File
@@ -14,6 +14,7 @@ Usage:
from __future__ import annotations
import argparse
import re
import sys
from pathlib import Path
@@ -37,18 +38,27 @@ def _display(pack: str) -> str:
def _extract_folders(record: dict, platforms_dir: str) -> dict[str, str]:
"""Pack name to the folder the registry says it extracts into."""
registry = load_platform_registry(platforms_dir)
folders: dict[str, str] = {}
for key, entry in sorted(load_platform_registry(platforms_dir).items()):
if not entry.get("extract_to"):
continue
needle = release_record._match_key(key)
for name in sorted(record.get("packs", {})):
# The name a pack starts with: RetroArch_Lakka is RetroArch's.
if needle and release_record._match_key(name).startswith(needle):
folders.setdefault(name, entry["extract_to"])
for name, pack in sorted(record.get("packs", {}).items()):
# A shared pack extracts where the platform it is named after does:
# RetroArch_Lakka is RetroArch's.
key = _match_key(name)
for platform in sorted(
pack.get("platforms", ()), key=lambda p: key.find(_match_key(p)) % (len(key) + 1)
):
folder = registry.get(platform, {}).get("extract_to")
if folder:
folders[name] = folder
break
return folders
def _match_key(value: str) -> str:
"""Letters and digits only: the platform is `misterfpga`, the pack MiSTer_FPGA."""
return re.sub(r"[^a-z0-9]", "", value.lower())
def _links(tag: str, assets: list[str]) -> str:
base = f"https://github.com/{REPO}/releases/download/{tag}"
if len(assets) == 1: