mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-17 17:03:27 -05:00
fix: give a shared core slot to the pinned claim
hypseus-singe asks for gamecontrollerdb.txt by name alone and, first in profile order, took the BIOS root of Batocera, RetroBat and RetroPie with C-Dogs' small table while Solarus pins its own by sha1. A destination two cores claim now goes to the one naming its content.
This commit is contained in:
1 parent
6810e8df9a
commit
51f3249a7d
2 files changed
+36
No files matched your search
@@ -611,6 +611,11 @@ def _collect_emulator_extras(
|
||||
config, emulators_dir, db, emu_profiles, target_cores=target_cores,
|
||||
include_all=include_all, declared_names=yaml_names,
|
||||
)
|
||||
# A destination two cores claim goes to the one that names its content:
|
||||
# hypseus-singe asks for gamecontrollerdb.txt by name alone and took the
|
||||
# BIOS root before Solarus, which pins its own by sha1. Profile order
|
||||
# still decides between claims of the same kind.
|
||||
undeclared = sorted(undeclared, key=lambda u: not _names_content(u))
|
||||
extras = []
|
||||
seen_dests: set[str] = set(seen)
|
||||
# Destination -> the extra that took it, to record later claimants on.
|
||||
@@ -762,6 +767,11 @@ def _collect_emulator_extras(
|
||||
|
||||
return extras
|
||||
|
||||
def _names_content(entry: dict) -> bool:
|
||||
"""Whether a report entry declares the bytes it wants, not only a name."""
|
||||
return any(entry.get(field) for field in ("sha1", "md5", "sha256", "crc32"))
|
||||
|
||||
|
||||
def _report_extra(u: dict, name: str, dest: str) -> dict:
|
||||
"""The extra a cross-reference entry asks for at its destination."""
|
||||
extra = {
|
||||
|
||||
@@ -2364,6 +2364,32 @@ class AnotherEmulatorsTreeProvesNothing(unittest.TestCase):
|
||||
self.assertFalse([d for d, p in overrides.items() if "/armsx2/" in p])
|
||||
|
||||
|
||||
class APinnedCoreFileTakesTheSlotFirst(unittest.TestCase):
|
||||
"""hypseus-singe asks for gamecontrollerdb.txt by name and took the BIOS
|
||||
root of Batocera, RetroBat and RetroPie with C-Dogs' 26 KB table, where
|
||||
Solarus pins its own by sha1."""
|
||||
|
||||
def test_the_content_naming_claim_is_placed_first(self):
|
||||
from unittest import mock
|
||||
|
||||
from scripts import packextras
|
||||
|
||||
undeclared = [
|
||||
{"profile": "hypseus", "emulator": "hypseus", "name": "db.txt",
|
||||
"path": "db.txt", "in_repo": True, "systems": ["a"]},
|
||||
{"profile": "solarus", "emulator": "solarus", "name": "db.txt",
|
||||
"path": "db.txt", "in_repo": True, "systems": ["b"], "sha1": "a" * 40},
|
||||
]
|
||||
config = {"systems": {}, "base_destination": "bios"}
|
||||
with mock.patch("verify.find_undeclared_files", return_value=undeclared), \
|
||||
mock.patch.object(packextras, "resolve_platform_cores", create=True,
|
||||
return_value=set()):
|
||||
extras = packextras._collect_emulator_extras(
|
||||
config, "emulators", {"files": {}, "indexes": {}}, set(), "bios", {}
|
||||
)
|
||||
self.assertEqual([e["source_profile"] for e in extras][:1], ["solarus"])
|
||||
|
||||
|
||||
class TheDatabaseCacheIsWrittenWhole(unittest.TestCase):
|
||||
"""A crash while serializing left a truncated db_cache.json behind, and
|
||||
the next run rehashed the whole collection from scratch."""
|
||||
|
||||
Reference in new issue
Block a user