From 38f81892ee79b8a739a76f6706cfa845ccf02630 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Mon, 23 Nov 2026 23:45:41 +0100 Subject: [PATCH] refactor: one installed-everywhere rule for needs --- scripts/acquire/provenance.py | 3 ++- scripts/packs/bundledonly.py | 3 ++- tests/test_audit_regressions.py | 7 +++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/acquire/provenance.py b/scripts/acquire/provenance.py index 5a905d369..09e695acf 100644 --- a/scripts/acquire/provenance.py +++ b/scripts/acquire/provenance.py @@ -13,6 +13,7 @@ from core.hashing import parse_hash_list from core.paths import REPO_ROOT from core.ziptools import is_archive_path, zip_members from resolve.content import size_fits +from resolve.validation import installed_everywhere HASH_FIELDS = ("sha1", "md5", "sha256") @@ -67,7 +68,7 @@ def profile_needs(profiles: dict, db: dict) -> dict: continue # Installed with the emulator, so not an acquisition target, # unless a platform package leaves it out. - if entry.get("bundled") and not entry.get("not_bundled_on"): + if installed_everywhere(entry): continue need = {"emulator": emulator, "name": name, "required": bool(entry.get("required"))} diff --git a/scripts/packs/bundledonly.py b/scripts/packs/bundledonly.py index ed0b800c6..5678ed0b9 100644 --- a/scripts/packs/bundledonly.py +++ b/scripts/packs/bundledonly.py @@ -10,6 +10,7 @@ from model.platforms import load_platform_config from model.registry import list_registered_platforms from packs.consumers import FileConsumers from resolve.directories import expand_directory_entries +from resolve.validation import installed_everywhere def _entries(profile: dict, db: dict) -> list[dict]: @@ -52,7 +53,7 @@ def bundled_only(db: dict, profiles: dict, platforms_dir: str, install_dir: Path # A platform whose package leaves the file out (not_bundled_on: # AmberELEC's amiberry 7.1.1 has no AROS ROMs) brings it from # the collection. - if entry.get("bundled") and not entry.get("not_bundled_on"): + if installed_everywhere(entry): bundled.setdefault(sha1, set()).add(emulator) else: needed.add(sha1) diff --git a/tests/test_audit_regressions.py b/tests/test_audit_regressions.py index 79d5db99f..ea00efbdf 100644 --- a/tests/test_audit_regressions.py +++ b/tests/test_audit_regressions.py @@ -5629,6 +5629,7 @@ class BundledFilesAreNotToSource(unittest.TestCase): 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 acquire.provenance import profile_needs from packs.crossref import cross_reference from resolve.validation import installed_everywhere from sitegen.install import comes_with_app @@ -5642,6 +5643,12 @@ class BundledFilesAreNotToSource(unittest.TestCase): "systems": ["apple-ios"], "files": [font]}} report = cross_reference(profiles, {}, {"files": {}, "indexes": {}}) self.assertFalse(report["touchhle"]["gap_details"][0]["bundled"]) + sized = {**font, "size": 312132} + needs = profile_needs({"touchhle": {"files": [sized]}}, {"files": {}, "indexes": {}}) + self.assertIn("liberationmono-regular.ttf", needs["by_name"]) + everywhere = {**sized, "not_bundled_on": []} + needs = profile_needs({"touchhle": {"files": [everywhere]}}, {"files": {}, "indexes": {}}) + self.assertEqual(needs["by_name"], {}) def test_every_platform_named_is_registered(self): from model.registry import list_registered_platforms