diff --git a/scripts/provenance_report.py b/scripts/provenance_report.py index 44c7ca5ba..77d217143 100644 --- a/scripts/provenance_report.py +++ b/scripts/provenance_report.py @@ -66,7 +66,8 @@ def profile_needs(profiles: dict, db: dict) -> dict: Keyed by every hash a profile accepts, and, for an entry that declares a size and no hash, by its names casefolded. An entry with neither - cannot be told apart from any same-named dump and is left out. + cannot be told apart from any same-named dump and is left out, as is a + file the emulator installs itself (`bundled:`) on every platform. """ files = db.get("files", {}) indexes = db.get("indexes", {}) @@ -92,6 +93,10 @@ def profile_needs(profiles: dict, db: dict) -> dict: name = str(entry.get("name", "")) if not name or name.endswith("/"): 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"): + continue need = {"emulator": emulator, "name": name, "required": bool(entry.get("required"))} hashes = {(field, v) for field in HASH_FIELDS for v in _values(entry, field)} diff --git a/tests/test_provenance.py b/tests/test_provenance.py index 9f3eebea4..a1ed98574 100644 --- a/tests/test_provenance.py +++ b/tests/test_provenance.py @@ -623,6 +623,21 @@ class AMissingDumpNamesTheProfileItFills(unittest.TestCase): needs = provenance_report.profile_needs(self.PROFILES, db) self.assertNotIn("dicrom.rom", needs["by_name"]) + def test_a_file_installed_with_the_emulator_is_not_a_need(self): + """43 of 50 needs were bundled entries (samcoupe.rom, zesarux's + tk90x.rom), burying the six xm7 ROMs a maintainer has to find.""" + from scripts import provenance_report # noqa: PLC0415 + + profiles = { + "samcoupe": {"files": [{"name": "samcoupe.rom", "required": True, + "bundled": True, "sha1": "f" * 40}]}, + "hcl": {"files": [{"name": "kanji.rom", "required": True, "bundled": True, + "not_bundled_on": ["batocera"], "sha1": "9" * 40}]}, + } + needs = provenance_report.profile_needs(profiles, {"files": {}}) + self.assertNotIn(("sha1", "f" * 40), needs["by_hash"]) + self.assertIn(("sha1", "9" * 40), needs["by_hash"]) + class TheWantedPageAsksOnlyForWhatCannotBeMade(unittest.TestCase): """The site's Wanted page asked the public for 79 dumps the collection