From d9b788787cd1f21ee425cc21ce9c6becfebea2df Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Mon, 9 Nov 2026 07:34:26 +0100 Subject: [PATCH] fix: read keyed source and version in profile_sync --- scripts/profile_sync.py | 22 +++++++++++++++++----- tests/test_profile_sync.py | 11 +++++++++++ 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/scripts/profile_sync.py b/scripts/profile_sync.py index b72787608..abe7b5bf8 100644 --- a/scripts/profile_sync.py +++ b/scripts/profile_sync.py @@ -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 diff --git a/tests/test_profile_sync.py b/tests/test_profile_sync.py index 6711b143e..67b48ca29 100644 --- a/tests/test_profile_sync.py +++ b/tests/test_profile_sync.py @@ -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):