fix: an alias read settles the names tried first

This commit is contained in:
Abdessamad Derraz committed 2026-10-27 15:59:19 +01:00
1 parent 49b47355b9
commit 052986c923
3 files changed
+18

No files matched your search

+6
View File
@@ -350,12 +350,18 @@ def map_run(layout: Layout, staged: set[str], rep: dict, profile: dict) -> tuple
by_name: dict[str, list[str]] = {}
for rel in layout.files:
by_name.setdefault(rel.rsplit("/", 1)[-1].casefold(), []).append(rel)
# An entry the core found under one of its names asks for nothing more:
# BlastEm tries tmss.md, then reads bios_MD.bin, both names of one entry.
read = {item["path"] for item in opened if not item["created"]}
satisfied = {entry["name"] for entry in libretro_entries(profile) if read & set(entry_paths(entry))}
findings = []
for path in rep.get("files_probed_absent") or ():
names = declaring(profile, path)
if path in layout.files:
findings.append({"kind": "not_staged", "path": path, "declared_by": names, "paths": [path]})
continue
if names and set(names) <= satisfied:
continue
elsewhere = sorted(p for p in by_name.get(path.rsplit("/", 1)[-1].casefold(), ()) if p != path)
if elsewhere:
kind = "elsewhere"
+9
View File
@@ -144,6 +144,15 @@ class Mapping(unittest.TestCase):
{"kind": "missing_undeclared", "path": "cfg.ini", "declared_by": [], "paths": []},
{"kind": "unlisted", "path": "extra.bin", "declared_by": [], "paths": []}])
def test_a_name_tried_before_an_alias_that_is_read_is_no_finding(self) -> None:
profile = {"files": [{"name": "tmss.md", "aliases": ["bios_MD.bin"]}, {"name": "bios_CD_U.bin"}]}
lay = layout({"bios_MD.bin": 1})
rep = {"files_opened": [{"path": "bios_MD.bin", "sha1_after": "a" * 40}],
"files_probed_absent": ["tmss.md", "bios_CD_U.bin"]}
_, findings = pp.map_run(lay, {"bios_MD.bin"}, rep, profile)
self.assertEqual(findings, [{"kind": "missing_declared", "path": "bios_CD_U.bin",
"declared_by": ["bios_CD_U.bin"], "paths": []}])
def test_manifest_entries(self) -> None:
manifest = {"files": [{"dest": "a.bin"}],
"case_variants": [{"dest": "A.BIN"}, {"dest": "a.bin"}],
+3
View File
@@ -1047,6 +1047,9 @@ with the pack entry that put it there, and the findings:
| `not_staged` | the folder holds it, but the staging did not close within 6 runs |
| `unlisted` | the core opened a file of the folder that no pack member or manifest entry names |
A name the core tried before it read another name of the same profile entry
is no finding: BlastEm tries `tmss.md`, then reads `bios_MD.bin`.
The run cannot see two things the platform does: core options a frontend
sets (Batocera's configgen writes some), and the files the installer puts in
the save directory, counted in `source.save_dir_files`. The Measurements page