mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-25 02:57:52 -06:00
fix: read profile repositories from one model rule
The site permalinks read only source and upstream, so a profile whose forge is gone (yuzu answers 451) linked nothing although profile_sync judged it through its source_mirror. declared_repositories, pin_field and the declared pin now live in model.profilerepos, read by both.
This commit is contained in:
1 parent
0fdca4145a
commit
bce9abedc7
11 files changed
+94
-70
No files matched your search
@@ -16,7 +16,7 @@ import yaml
|
||||
from core import upstream
|
||||
from core.hashing import parse_hash_list
|
||||
from model.sourceref import RefPart, prose_runs, ref_prose_text, ref_role, source_ref_values
|
||||
from profiling.repos import declared_repositories
|
||||
from model.profilerepos import declared_repositories
|
||||
|
||||
|
||||
HASH_FIELDS = ("sha1", "md5", "crc32", "sha256", "known_hash_adler32")
|
||||
|
||||
@@ -16,7 +16,7 @@ from model.sourceref import RefPart
|
||||
from profiling.anchoring import anchor_block
|
||||
from profiling.citations import Citation, citation_key, collect_citations, is_external_citation
|
||||
from profiling.proseedit import apply_prose_edits, run_after_moves
|
||||
from profiling.repos import declared_repositories
|
||||
from model.profilerepos import declared_repositories
|
||||
from profiling.yamledit import apply_edit
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ from profiling.anchoring import PartResult, REBASE_STATUSES, REVIEW_STATUSES
|
||||
from profiling.citations import Citation, citation_key, collect_citations
|
||||
from profiling.proseedit import apply_prose_edits, run_after_moves, set_scalar
|
||||
from profiling.reports import EntryReport, ProfileReport, original_part, rendered_part
|
||||
from profiling.repos import declared_repositories
|
||||
from model.profilerepos import declared_repositories
|
||||
from profiling.yamledit import YamlWriteError, apply_edit, find_field_line, replace_field_line
|
||||
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ from collections.abc import Iterable
|
||||
from dataclasses import dataclass, replace
|
||||
|
||||
from core import upstream
|
||||
from model.profilerepos import declared_pin, declared_repositories, pin_field
|
||||
|
||||
|
||||
PIN = "pin"
|
||||
@@ -44,12 +45,6 @@ def select_repo(profile: dict) -> upstream.Repo | None:
|
||||
return None
|
||||
|
||||
|
||||
def pin_field(field: str) -> str:
|
||||
"""The `<field>_commit` that pins a repository field. A mirror carries
|
||||
the source's history, commits and branches alike: source_commit pins it."""
|
||||
return "source" if field == "source_mirror" else field
|
||||
|
||||
|
||||
def resolve_pin(
|
||||
profile: dict, repo: upstream.Repo, cache_dir: str, offline: bool,
|
||||
field: str = "source", mode: str = "", branch: str | None = None,
|
||||
@@ -61,14 +56,9 @@ def resolve_pin(
|
||||
A profile whose builds live in different repositories keys its pin by
|
||||
build mode, the way `ymir` keys `source` and `core_version`.
|
||||
"""
|
||||
pinned = profile.get(f"{field}_commit")
|
||||
if isinstance(pinned, dict):
|
||||
pinned = pinned.get(mode)
|
||||
origin = f"{field}_commit[{mode}]"
|
||||
else:
|
||||
origin = f"{field}_commit"
|
||||
pinned, origin = declared_pin(profile, field, mode)
|
||||
if pinned:
|
||||
return str(pinned), origin
|
||||
return pinned, origin
|
||||
date = str(profile.get("profiled_date") or "")
|
||||
if not date:
|
||||
return None, None
|
||||
@@ -231,27 +221,6 @@ def _follow_fork_base(
|
||||
return followed
|
||||
|
||||
|
||||
def declared_repositories(profile: dict) -> list[tuple[str, str, str]]:
|
||||
"""Every repository URL the profile declares, source before upstream.
|
||||
|
||||
`source` and `upstream` are usually plain strings. `ymir` keys them by
|
||||
build mode instead, because its standalone and libretro builds live in
|
||||
different repositories.
|
||||
|
||||
`source_mirror` comes last and is the only thing that keeps a profile
|
||||
checkable once its forge is gone: yuzu and suyu answer 451, citron's
|
||||
host stopped resolving. Being last, it never decides attribution while
|
||||
a declared repository still answers.
|
||||
"""
|
||||
urls: list[tuple[str, str, str]] = []
|
||||
for field_name in ("source", "upstream", "source_mirror"):
|
||||
value = profile.get(field_name)
|
||||
if isinstance(value, dict):
|
||||
urls.extend((field_name, str(k), str(v)) for k, v in value.items() if v)
|
||||
elif value:
|
||||
urls.append((field_name, "", str(value)))
|
||||
return urls
|
||||
|
||||
|
||||
def branch_in_url(url: str) -> str | None:
|
||||
"""Branch named by a forge URL pointing inside a repository.
|
||||
|
||||
@@ -39,12 +39,12 @@ from profiling.citations import (
|
||||
symlink_target,
|
||||
)
|
||||
from profiling.reports import EntryReport, ProfileReport
|
||||
from model.profilerepos import declared_repositories
|
||||
from profiling.repos import (
|
||||
PIN,
|
||||
RepoView,
|
||||
reads_own_revision,
|
||||
build_revision,
|
||||
declared_repositories,
|
||||
detect_pinned_tag,
|
||||
moved_repositories,
|
||||
resolve_through_gitlinks,
|
||||
|
||||
@@ -33,7 +33,8 @@ from collections.abc import Callable
|
||||
from dataclasses import dataclass
|
||||
|
||||
from core import upstream
|
||||
from profiling.repos import pin_field, resolve_pin
|
||||
from model.profilerepos import pin_field
|
||||
from profiling.repos import resolve_pin
|
||||
|
||||
KINDS = ("file", "tag", "alias", "package", "none", "unverified")
|
||||
# Values copied from a .info or a branch name, which name no version.
|
||||
|
||||
Reference in new issue
Block a user