From c826e0fc05adab7f1c3ad49ce64fbf14408b7de0 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Fri, 23 Oct 2026 16:41:58 +0200 Subject: [PATCH] fix: keep release profiles on the build they pin mame_hash_scraper --release rewrote the whole profile and dropped the pin_frozen that mame0258 and mame0278 carry: libretro/mame HEAD is a later release, so without it profile_sync compares their refs with code the Recalbox build never had. A release profile now states it, from built_by, and keeps the reason a reader wrote. --- scripts/scraper/mame_hash_scraper.py | 13 +++++++++++++ tests/test_hash_merge.py | 3 +++ 2 files changed, 16 insertions(+) diff --git a/scripts/scraper/mame_hash_scraper.py b/scripts/scraper/mame_hash_scraper.py index 7cf69841..0d2e8411 100644 --- a/scripts/scraper/mame_hash_scraper.py +++ b/scripts/scraper/mame_hash_scraper.py @@ -470,6 +470,13 @@ def release_profile( "display_name": f"Arcade (MAME {version})", "cores": cores, "built_by": built_by, + # The pin is the commit the platform builds, so the profile is judged + # against its own revision: libretro/mame HEAD is a later release. + "pin_frozen": ( + f"{', '.join(built_by)} build{'s' if len(built_by) == 1 else ''} " + f"libretro/mame at this revision for the {version} release. " + "Later commits are not part of that build." + ), "systems": list(reference.get("systems") or []), "notes": ( f"libretro/mame built at the {version} release. BIOS root sets " @@ -498,6 +505,12 @@ def _write_release(args: argparse.Namespace) -> None: args.release, bios_sets, commit, args.source_commit, args.core, reference, args.built_by, ) + # A reason a reader wrote, citing the platform's own build file, outlives + # a regeneration: the derived one says less. + if Path(args.profile).is_file(): + previous = yaml_load(Path(args.profile).read_text(encoding="utf-8")) or {} + if str(previous.get("pin_frozen") or "").strip(): + profile["pin_frozen"] = previous["pin_frozen"] text = yaml.safe_dump(profile, sort_keys=False, allow_unicode=True, width=100) # Citations are written double-quoted in every profile: left bare, each # regeneration rewrote all of them. diff --git a/tests/test_hash_merge.py b/tests/test_hash_merge.py index 1e008b39..3b28b37c 100644 --- a/tests/test_hash_merge.py +++ b/tests/test_hash_merge.py @@ -478,6 +478,9 @@ class AReleaseProfileDescribesItsOwnRelease(unittest.TestCase): ("a" * 40, "b" * 40)) self.assertEqual(profile["cores"], ["mame0278"]) self.assertEqual(profile["built_by"], ["recalbox"]) + # libretro/mame HEAD is a later release: the profile is judged + # against the revision the platform builds. + self.assertIn("recalbox builds libretro/mame", profile["pin_frozen"]) files = {f["name"]: f for f in profile["files"]} self.assertEqual(sorted(files), ["neogeo.zip", "newset.zip"]) self.assertEqual(files["neogeo.zip"]["system"], "snk-neogeo-mvs")