From ed49b26c1227f38404eec4e6622810a74805a252 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Fri, 9 Oct 2026 23:18:36 +0200 Subject: [PATCH] fix: a declared alias settles the entry --- scripts/verify.py | 7 +++++-- tests/test_shared_groups.py | 31 +++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/scripts/verify.py b/scripts/verify.py index 93c8fcec..7ca2f235 100644 --- a/scripts/verify.py +++ b/scripts/verify.py @@ -399,8 +399,11 @@ def _candidate_verdict( if outside_gap_scope(file_entry, is_standalone): return "skip" if not include_all: - archive = file_entry.get("archive") - if fname in declared_names or (archive and archive in declared_names): + # A platform declaring any name the core answers to has met the + # requirement: quasi88 reads n88sub.rom or disk.rom, and System.dat + # names disk.rom. Without the aliases the pack carried the ROM twice. + answers = {fname, file_entry.get("archive") or "", *file_entry.get("aliases", [])} + if answers & declared_names: return "settled" return "keep" diff --git a/tests/test_shared_groups.py b/tests/test_shared_groups.py index 6592700c..7951c5d1 100644 --- a/tests/test_shared_groups.py +++ b/tests/test_shared_groups.py @@ -61,5 +61,36 @@ class SharedGroupsAddOnly(unittest.TestCase): repeated.append(f"{platform}:{fe['name']} = {other}") self.assertEqual(repeated, []) +class ADeclaredAliasSettlesTheRequirement(unittest.TestCase): + """quasi88 reads n88sub.rom or disk.rom; System.dat names disk.rom. The + gap pass compared the entry's name alone and the pack carried the same + 2 KB ROM a second time as quasi88/n88sub.rom.""" + + def test_a_platform_naming_an_alias_has_met_the_entry(self): + import os # noqa: PLC0415 + import tempfile # noqa: PLC0415 + + from common import _emulator_profiles_cache # noqa: PLC0415 + from verify import find_undeclared_files # noqa: PLC0415 + + with tempfile.TemporaryDirectory() as tmp: + Path(tmp, "emulators").mkdir() + Path(tmp, "emulators", "quasi88.yml").write_text( + "emulator: QUASI88\ntype: libretro\nsystems: [nec-pc-88]\ncores: [quasi88]\n" + "files:\n - name: n88sub.rom\n aliases: [N88SUB.ROM, disk.rom]\n" + " required: true\n" + ) + _emulator_profiles_cache.clear() + self.addCleanup(_emulator_profiles_cache.clear) + config = {"platform": "P", "verification_mode": "existence", "cores": "all_libretro", + "systems": {"nec-pc-88": {"files": [{"name": "disk.rom", "destination": "quasi88/disk.rom"}]}}} + db = {"files": {}, "indexes": {"by_name": {}, "by_md5": {}, "by_crc32": {}, "by_path_suffix": {}}} + previous = os.getcwd() + os.chdir(tmp) + self.addCleanup(os.chdir, previous) + undeclared = find_undeclared_files(config, "emulators", db, data_names=set()) + self.assertEqual([u["name"] for u in undeclared], []) + + if __name__ == "__main__": unittest.main()