diff --git a/scripts/packs/crossref.py b/scripts/packs/crossref.py index d8c131bda..b90ad34dc 100644 --- a/scripts/packs/crossref.py +++ b/scripts/packs/crossref.py @@ -46,6 +46,7 @@ from resolve.validation import ( case_folded_slots, declaration_settles, inner_rom_check, + installed_everywhere, installed_with_emulator, outside_gap_scope, read_from_save_dir, @@ -915,7 +916,8 @@ class _ProfileComparison: "name": fname, "path": effective_path, "required": f.get("required", False), - "bundled": installed_with_emulator(f, platform), + "bundled": (installed_with_emulator(f, platform) if platform + else installed_everywhere(f)), "note": f.get("note", ""), "source_ref": f.get("source_ref", ""), "in_platform": False, diff --git a/scripts/resolve/validation.py b/scripts/resolve/validation.py index dfcfdc2ba..9cd442835 100644 --- a/scripts/resolve/validation.py +++ b/scripts/resolve/validation.py @@ -764,6 +764,15 @@ def installed_with_emulator(entry: dict, platform: str = "") -> bool: return bool(entry.get("bundled")) and platform not in (entry.get("not_bundled_on") or []) +def installed_everywhere(entry: dict) -> bool: + """Whether the emulator brings the entry on every setup, for a view that names none. + + An entry a platform package leaves out (`not_bundled_on`) is a file that + setup's users still need: touchHLE panics without its fonts on ROCKNIX. + """ + return bool(entry.get("bundled")) and not entry.get("not_bundled_on") + + def unread_on(entry: dict, platform: str) -> bool: """Whether this platform's launcher points the emulator at other files. diff --git a/scripts/sitegen/install.py b/scripts/sitegen/install.py index 354e1f9f8..12ed00406 100644 --- a/scripts/sitegen/install.py +++ b/scripts/sitegen/install.py @@ -18,7 +18,7 @@ from model.registry import list_release_pack_platforms from model.profiles import reads_own_files from resolve.layout import runs_standalone, standalone_layout_path from resolve.standalone import standalone_set -from resolve.validation import installed_with_emulator +from resolve.validation import installed_everywhere, installed_with_emulator from sitegen import markup from core.paths import REPO_ROOT from installer_build.module import installer_module @@ -79,14 +79,14 @@ def _platform_display_in(platforms_dir: str, name: str) -> str: def comes_with_app(f: dict) -> bool: """The emulator installs the file in the build the entry describes, on every setup. - The rule verify and the pack read (``installed_with_emulator``), for a - page that names no setup. An entry a platform package leaves out + The rule the gap report and the wanted list read (``installed_everywhere``), + for a page that names no setup. An entry a platform package leaves out (``not_bundled_on``: Batocera's hcl installs the binary alone) is a file that setup's readers get, and the manifests serve it there. An entry narrowed by ``mode`` is that build's alone: the other build reads its own entry, or nothing. """ - return installed_with_emulator(f) and not f.get("not_bundled_on") + return installed_everywhere(f) def install_commands(args: str = "", indent: str = "", diff --git a/scripts/sitegen/wanted.py b/scripts/sitegen/wanted.py index 96e832611..c447d8582 100644 --- a/scripts/sitegen/wanted.py +++ b/scripts/sitegen/wanted.py @@ -28,7 +28,7 @@ from model.profiles import unique_emulator_profiles from packs.crossref import first_hash from core.hashing import cut_md5_owner, declared_hash_lists, parse_hash_list from resolve.review import LARGE_FILE_ISSUE_URL, Placement, placement -from resolve.validation import deliverable, filter_files_by_mode, installed_with_emulator +from resolve.validation import deliverable, filter_files_by_mode, installed_everywhere from sitegen.config import UPLOAD_ROOT ALGORITHMS = ("sha1", "sha256", "md5", "crc32") @@ -231,7 +231,7 @@ def wanted_declarations(profiles: dict, coverages: dict, gap_report: dict) -> li for row, unsourceable in rows: for entry in gap_entries(profile, str(row.get("name", "")), str(row.get("identity") or ""), unsourceable): - if entry.get("category") == GAME_DATA or installed_with_emulator(entry): + if entry.get("category") == GAME_DATA or installed_everywhere(entry): continue system = entry.get("system") or (systems[0] if len(systems) == 1 else "") found.append({ diff --git a/tests/test_audit_regressions.py b/tests/test_audit_regressions.py index 44edcca55..3a4509c01 100644 --- a/tests/test_audit_regressions.py +++ b/tests/test_audit_regressions.py @@ -5570,6 +5570,23 @@ class BundledFilesAreNotToSource(unittest.TestCase): self.assertFalse(installed_with_emulator(machines, "retroarch")) self.assertTrue(installed_with_emulator(hcl)) + def test_a_view_naming_no_setup_keeps_what_one_package_leaves_out(self): + """touchHLE panics without its fonts on ROCKNIX: the emulator page, + the global gap report and the wanted list all still ask for them.""" + from packs.crossref import cross_reference + from resolve.validation import installed_everywhere + from sitegen.install import comes_with_app + + font = {"name": "LiberationMono-Regular.ttf", "bundled": True, + "not_bundled_on": ["rocknix"]} + self.assertFalse(installed_everywhere(font)) + self.assertFalse(comes_with_app(font)) + self.assertTrue(installed_everywhere({"name": "a.bin", "bundled": True})) + profiles = {"touchhle": {"emulator": "touchHLE", "type": "standalone", + "systems": ["apple-ios"], "files": [font]}} + report = cross_reference(profiles, {}, {"files": {}, "indexes": {}}) + self.assertFalse(report["touchhle"]["gap_details"][0]["bundled"]) + def test_every_platform_named_is_registered(self): from model.registry import list_registered_platforms from model.profiles import load_emulator_profiles diff --git a/tests/test_site_wanted.py b/tests/test_site_wanted.py index c96a4a462..265ab305f 100644 --- a/tests/test_site_wanted.py +++ b/tests/test_site_wanted.py @@ -656,7 +656,7 @@ class ThePublishedList(unittest.TestCase): """Each emulator a row names declares that file as firmware it does not install itself: pak0.pk3, game data for every profile, is gone.""" from model.profiles import load_emulator_profiles - from resolve.validation import installed_with_emulator + from resolve.validation import installed_everywhere profiles = load_emulator_profiles(str(REPO_ROOT / "emulators")) self.assertNotIn("pak0.pk3", [e["n"] for e in self.data["entries"]]) @@ -669,7 +669,7 @@ class ThePublishedList(unittest.TestCase): if isinstance(f, dict) and f.get("name") == entry["n"]] with self.subTest(entry=entry["n"], emulator=key): self.assertTrue([f for f in declared if f.get("category") != "game_data" - and not installed_with_emulator(f)]) + and not installed_everywhere(f)]) def test_every_link_lands_on_its_details(self): """Each name's link is a built page, and a card anchor is on it."""