mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-10 13:33:24 -05:00
fix: dedup core extras on their real destination
This commit is contained in:
1 parent
cd2919400a
commit
16be9476cb
2 files changed
+53
-10
No files matched your search
+10
-10
@@ -464,9 +464,15 @@ def find_undeclared_files(
|
|||||||
profile.get("files", []), db, is_standalone
|
profile.get("files", []), db, is_standalone
|
||||||
):
|
):
|
||||||
fname = f.get("name", "")
|
fname = f.get("name", "")
|
||||||
effective_path = (
|
# One destination rule for the dedup key and for the entry: a
|
||||||
f.get("standalone_path") if is_standalone else f.get("path")
|
# standalone build without standalone_path falls back on path.
|
||||||
) or fname
|
# The key used to skip that fallback, so clk's Acorn/basic.rom and
|
||||||
|
# Electron/basic.rom both keyed as "basic.rom" under Batocera's
|
||||||
|
# standalone clk and the second was dropped.
|
||||||
|
if is_standalone:
|
||||||
|
dest = f.get("standalone_path") or f.get("path") or fname
|
||||||
|
else:
|
||||||
|
dest = f.get("path") or fname
|
||||||
raw_regions = f.get("region") or []
|
raw_regions = f.get("region") or []
|
||||||
region_key = tuple(
|
region_key = tuple(
|
||||||
str(value) for value in (
|
str(value) for value in (
|
||||||
@@ -478,7 +484,7 @@ def find_undeclared_files(
|
|||||||
seen_key = (
|
seen_key = (
|
||||||
fname,
|
fname,
|
||||||
f.get("archive"),
|
f.get("archive"),
|
||||||
effective_path,
|
dest,
|
||||||
f.get("system"),
|
f.get("system"),
|
||||||
f.get("variant_group"),
|
f.get("variant_group"),
|
||||||
region_key,
|
region_key,
|
||||||
@@ -539,12 +545,6 @@ def find_undeclared_files(
|
|||||||
entry["required"] = True
|
entry["required"] = True
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Determine destination path based on mode
|
|
||||||
if is_standalone:
|
|
||||||
dest = f.get("standalone_path") or f.get("path") or fname
|
|
||||||
else:
|
|
||||||
dest = f.get("path") or fname
|
|
||||||
|
|
||||||
# Resolution: storage flag, then name, then path basename
|
# Resolution: storage flag, then name, then path basename
|
||||||
storage = f.get("storage", "")
|
storage = f.get("storage", "")
|
||||||
if storage in ("release", "large_file"):
|
if storage in ("release", "large_file"):
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
"""Same-named core files at two paths stay two files in standalone mode.
|
||||||
|
|
||||||
|
find_undeclared_files keyed its dedup on standalone_path alone when the
|
||||||
|
platform runs the core standalone, while the destination it then writes
|
||||||
|
falls back on path. Batocera runs clk standalone, clk declares basic.rom
|
||||||
|
under Acorn/ and Electron/ without a standalone_path, and the second was
|
||||||
|
dropped from the pack.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import unittest
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||||
|
sys.path.insert(0, str(REPO_ROOT / "scripts"))
|
||||||
|
|
||||||
|
|
||||||
|
class StandaloneFallsBackOnPath(unittest.TestCase):
|
||||||
|
def test_both_paths_survive(self):
|
||||||
|
from verify import find_undeclared_files
|
||||||
|
|
||||||
|
profile = {
|
||||||
|
"emulator": "Clock Signal",
|
||||||
|
"type": "standalone + libretro",
|
||||||
|
"systems": ["acorn-electron"],
|
||||||
|
"files": [
|
||||||
|
{"name": "basic.rom", "path": "Acorn/basic.rom", "required": True},
|
||||||
|
{"name": "basic.rom", "path": "Electron/basic.rom", "required": True},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
config = {"cores": ["clk"], "standalone_cores": ["clk"], "systems": {}}
|
||||||
|
db = {"files": {}, "indexes": {}}
|
||||||
|
found = find_undeclared_files(config, "emulators", db, emu_profiles={"clk": profile})
|
||||||
|
self.assertEqual(
|
||||||
|
sorted(f["path"] for f in found if f["name"] == "basic.rom"),
|
||||||
|
["Acorn/basic.rom", "Electron/basic.rom"],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
unittest.main()
|
||||||
Reference in new issue
Block a user