mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-11 12:33:53 -06:00
fix: key an emulator folder omission by its cores
Since 7f20702b4 an omission read in an emulator's own folder is one per
folder, and the folder is the core's: mame2015 and mame2016 each list
3dobios.zip. The check keyed omissions by root and dest alone and read
seven manifests as listing one place twice.
This commit is contained in:
1 parent
2f9152e77a
commit
0b36d77071
2 files changed
+25
-1
No files matched your search
@@ -714,7 +714,13 @@ def _semantic_install_checks(path: Path, manifest: dict) -> list[str]:
|
||||
destinations = [(entry.get("root"), entry.get("dest")) for entry in files]
|
||||
if len(destinations) != len(set(destinations)):
|
||||
out.append(f"{path.relative_to(ROOT)}: duplicate destinations")
|
||||
omitted_destinations = [(entry.get("root"), entry.get("dest")) for entry in omitted]
|
||||
# root: emulator is each core's own folder: mame2015 and mame2016 read
|
||||
# 3dobios.zip in two places, one omission each, named by its cores.
|
||||
omitted_destinations = [
|
||||
(entry.get("root"), entry.get("dest"),
|
||||
tuple(entry.get("cores") or ()) if entry.get("root") == "emulator" else ())
|
||||
for entry in omitted
|
||||
]
|
||||
if len(omitted_destinations) != len(set(omitted_destinations)):
|
||||
out.append(f"{path.relative_to(ROOT)}: duplicate omitted destinations")
|
||||
overlap = set(destinations) & set(omitted_destinations)
|
||||
|
||||
@@ -95,6 +95,24 @@ class SemanticManifestValidation(unittest.TestCase):
|
||||
self.assertEqual(len(errors), 1)
|
||||
self.assertIn("total_files does not equal len(files)", errors[0])
|
||||
|
||||
def test_an_emulator_folder_omission_is_keyed_by_its_cores(self):
|
||||
"""mame2015 and mame2016 read 3dobios.zip each in its own folder:
|
||||
two omissions, two places. The same core twice is one place."""
|
||||
path = REPO_ROOT / "install" / "synthetic.json"
|
||||
|
||||
def omission(core: str) -> dict:
|
||||
return {"dest": "3dobios.zip", "root": "emulator", "cores": [core]}
|
||||
|
||||
def errors(omitted: list[dict]) -> list[str]:
|
||||
manifest = {"files": [], "total_files": 0, "total_size": 0,
|
||||
"omitted_files": omitted, "total_omitted": len(omitted)}
|
||||
return [e for e in validate_schemas._semantic_install_checks(path, manifest)
|
||||
if "omitted destinations" in e]
|
||||
|
||||
self.assertEqual(errors([omission("mame2015"), omission("mame2016")]), [])
|
||||
self.assertEqual(len(errors([omission("mame2015"), omission("mame2015")])), 1)
|
||||
self.assertEqual(len(errors([{"dest": "a.bin"}, {"dest": "a.bin"}])), 1)
|
||||
|
||||
|
||||
try:
|
||||
import jsonschema
|
||||
|
||||
Reference in new issue
Block a user