fix: read keyed source and version in profile_sync

This commit is contained in:
Abdessamad Derraz committed 2026-11-09 07:34:26 +01:00
1 parent c7571a8028
commit d9b788787c
2 files changed
+28 -5

No files matched your search

+17 -5
View File
@@ -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