fix: drop bundled files from provenance needs

profile_needs read every profile entry, so --missing named 43 files the emulator installs itself among 50 needs and buried the six xm7 ROMs. A bundled entry is skipped unless a platform package leaves it out (not_bundled_on). The report now lists 7 needs.
This commit is contained in:
Abdessamad Derraz committed 2026-11-05 19:30:57 +01:00
1 parent a05b1da9a0
commit 137f971dae
2 files changed
+21 -1

No files matched your search

+6 -1
View File
@@ -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)}
+15
View File
@@ -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