From 2a049dc9c9e3d3c994503b6d9d5f764f6ba46c82 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Sat, 10 Oct 2026 09:49:56 +0200 Subject: [PATCH] fix: let a shared path only keep a system --- scripts/common.py | 12 ++++++++---- tests/test_target_systems.py | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/scripts/common.py b/scripts/common.py index ef0f5914..2541dbc3 100644 --- a/scripts/common.py +++ b/scripts/common.py @@ -1684,12 +1684,16 @@ def filter_systems_by_target( (), ) } - all_cores = norm_system_cores.get(norm_key, set()) | file_cores + all_cores = norm_system_cores.get(norm_key, set()) plat_cores_here = norm_plat_system_cores.get(norm_key, set()) - if platform_cores is not None: - plat_cores_here = plat_cores_here | (file_cores & set(platform_cores)) - if not all_cores and not plat_cores_here: + if file_cores & expanded_target: + # An on-target core reads the system's files. The evidence only + # keeps: a path shared with an off-target core says nothing of the + # other files, and Batocera's bbc runs on MAME, which no profile + # ties to bbcb.zip, while CLK reads two of its ROMs. + filtered[sys_id] = sys_data + elif not all_cores and not plat_cores_here: # No profile maps to this system -keep it filtered[sys_id] = sys_data elif all_cores & expanded_target: diff --git a/tests/test_target_systems.py b/tests/test_target_systems.py index 82343448..fb6ebcb9 100644 --- a/tests/test_target_systems.py +++ b/tests/test_target_systems.py @@ -56,6 +56,25 @@ class TargetSystems(unittest.TestCase): def test_without_that_evidence_the_off_target_core_drops_it(self): self.assertEqual(self.kept(systems("Enterprise/exos10.bin")), []) + def test_a_path_an_off_target_core_reads_excludes_nothing(self): + """Batocera's bbc runs on MAME, which no profile ties to bbcb.zip; CLK + reads two of its ROMs. With CLK off the target the system stayed + unknown before and must stay kept.""" + declared = {"bbc": {"files": [ + {"name": "os12.rom", "destination": "BBCMicro/os12.rom"}, + {"name": "bbcb.zip", "destination": "bbcb.zip"}, + ]}} + profiles = dict(PROFILES) + profiles["clk"] = dict(PROFILES["clk"], files=[ + {"name": "os12.rom", "path": "BBCMicro/os12.rom"}]) + self.assertEqual( + sorted(filter_systems_by_target( + declared, profiles, {"ep128emu_core"}, + platform_cores={"ep128emu_core", "clk"}, + )), + ["bbc"], + ) + def test_a_bare_name_is_no_evidence(self): declared = {"enterprise-64-128": {"files": [{"name": "bios.bin"}]}} self.assertEqual(