mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-11 20:43:50 -06:00
fix: read keyed source and version in profile_sync
This commit is contained in:
1 parent
c7571a8028
commit
d9b788787c
2 files changed
+28
-5
No files matched your search
+17
-5
@@ -1097,11 +1097,19 @@ def triage_state(report: ProfileReport) -> str:
|
||||
|
||||
|
||||
def select_repo(profile: dict) -> upstream.Repo | None:
|
||||
"""Repository the profile was read from: source first, then upstream."""
|
||||
"""Repository the profile was read from: source first, then upstream.
|
||||
|
||||
A source keyed by build mode with no upstream (uzdoom) names its
|
||||
repositories only in the dict, which a plain string read never parses.
|
||||
"""
|
||||
for field in ("source", "upstream"):
|
||||
repo = upstream.parse_repo(str(profile.get(field) or ""))
|
||||
if repo is not None:
|
||||
return repo
|
||||
for _, _, url in declared_repositories(profile):
|
||||
repo = upstream.parse_repo(url)
|
||||
if repo is not None:
|
||||
return repo
|
||||
return None
|
||||
|
||||
|
||||
@@ -1496,14 +1504,18 @@ def detect_pinned_tag(
|
||||
def tag_pinned_views(
|
||||
profile: dict, views: list[RepoView], cache_dir: str, offline: bool
|
||||
) -> dict[tuple[str, str], str]:
|
||||
"""Views whose pin is the tag `core_version` names, keyed by repository."""
|
||||
"""Views whose pin is the tag `core_version` names, keyed by repository.
|
||||
|
||||
A core_version keyed by build mode names the tag of the view's own mode:
|
||||
uzdoom's standalone sits on 5.0.3 while its libretro branch moves.
|
||||
"""
|
||||
tagged: dict[tuple[str, str], str] = {}
|
||||
declared = profile.get("core_version")
|
||||
for view in views:
|
||||
if view.pin == view.head:
|
||||
continue
|
||||
for tag in version_tag_candidates(
|
||||
profile.get("core_version"), view.repo.name
|
||||
):
|
||||
version = declared.get(view.mode) if isinstance(declared, dict) else declared
|
||||
for tag in version_tag_candidates(version, view.repo.name):
|
||||
if upstream.tag_commit(view.repo, tag, cache_dir, offline) == view.pin:
|
||||
tagged[(view.repo.host, view.repo.slug)] = tag
|
||||
break
|
||||
|
||||
@@ -1254,6 +1254,17 @@ class TestSelectRepo(unittest.TestCase):
|
||||
def test_none_when_no_supported_host(self):
|
||||
self.assertIsNone(select_repo({"source": "https://www.6809.org.uk/"}))
|
||||
|
||||
def test_source_keyed_by_mode_without_upstream(self):
|
||||
repo = select_repo(
|
||||
{
|
||||
"source": {
|
||||
"standalone": "https://github.com/UZDoom/UZDoom",
|
||||
"libretro": "https://github.com/libretro/uzdoom",
|
||||
},
|
||||
}
|
||||
)
|
||||
self.assertEqual(repo.name, "UZDoom")
|
||||
|
||||
|
||||
class TestBuildReport(unittest.TestCase):
|
||||
def setUp(self):
|
||||
|
||||
Reference in new issue
Block a user