mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-24 10:37:54 -06:00
fix: read a version basis at the profile_sync pin
This commit is contained in:
1 parent
198e2b2dc7
commit
bdfdb608e0
3 files changed
+44
-18
No files matched your search
@@ -44,6 +44,12 @@ 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,
|
||||
@@ -89,12 +95,11 @@ def select_views(
|
||||
repo = upstream.parse_repo(url)
|
||||
if repo is None or (repo.host, repo.slug) in seen:
|
||||
continue
|
||||
# A mirror carries the source's history, commits and branches alike:
|
||||
# its pin is source_commit. It read `source_mirror_commit`, a field
|
||||
# no profile carries, and fell back to profiled_date, which a bump
|
||||
# never moves (eden judged from f6e76860 while pinned on d16735f5).
|
||||
pin_field = "source" if field_name == "source_mirror" else field_name
|
||||
branch = declared if pin_field == "source" else None
|
||||
# A mirror read `source_mirror_commit`, a field no profile carries,
|
||||
# and fell back to profiled_date, which a bump never moves (eden
|
||||
# judged from f6e76860 while pinned on d16735f5).
|
||||
pinned_by = pin_field(field_name)
|
||||
branch = declared if pinned_by == "source" else None
|
||||
head = None
|
||||
try:
|
||||
unread: upstream.NotCachedError | None = None
|
||||
@@ -111,7 +116,7 @@ def select_views(
|
||||
if unread and not head:
|
||||
raise unread
|
||||
pin, origin = resolve_pin(
|
||||
profile, repo, cache_dir, offline, pin_field, mode, branch
|
||||
profile, repo, cache_dir, offline, pinned_by, mode, branch
|
||||
)
|
||||
if not pin or origin is None:
|
||||
continue
|
||||
|
||||
@@ -33,14 +33,11 @@ from collections.abc import Callable
|
||||
from dataclasses import dataclass
|
||||
|
||||
from core import upstream
|
||||
from profiling.repos import pin_field, resolve_pin
|
||||
|
||||
KINDS = ("file", "tag", "alias", "package", "none", "unverified")
|
||||
# Values copied from a .info or a branch name, which name no version.
|
||||
PLACEHOLDERS = frozenset({"git", "svn", "unknown", "master", "main", "latest", "dev", "head"})
|
||||
# Pin field of each repository field a basis may name. A mirror carries the
|
||||
# source's history, so source_commit pins it too.
|
||||
PIN_FIELDS = {"source": "source_commit", "source_mirror": "source_commit",
|
||||
"upstream": "upstream_commit"}
|
||||
|
||||
MATCH = "MATCH"
|
||||
DRIFT = "DRIFT"
|
||||
@@ -143,13 +140,17 @@ def _repo_and_pin(
|
||||
field = str(basis.get("repo") or "source")
|
||||
url = _by_mode(profile, field, mode) or ""
|
||||
repo = upstream.parse_repo(url)
|
||||
pin = _by_mode(profile, PIN_FIELDS.get(field, ""), mode) or ""
|
||||
where = url or field
|
||||
if repo is not None and not pin and field == "upstream" and profile.get("profiled_date"):
|
||||
# The pin of a second repository falls back on profiled_date,
|
||||
# as profile_sync resolves it.
|
||||
pin = upstream.resolve_commit_at(
|
||||
repo, str(profile["profiled_date"]), cache_dir, offline) or ""
|
||||
pin = ""
|
||||
if repo is not None:
|
||||
# The pin profile_sync compares at: the declared commit, else
|
||||
# the commit at profiled_date on the branch the source follows.
|
||||
pinned_by = pin_field(field)
|
||||
branch = str(profile.get("source_branch") or "") or None
|
||||
pin = resolve_pin(
|
||||
profile, repo, cache_dir, offline, pinned_by, mode,
|
||||
branch if pinned_by == "source" else None,
|
||||
)[0] or ""
|
||||
if repo is None:
|
||||
raise VersionUnreadable(f"{where}: not a forge repository")
|
||||
if not pin:
|
||||
|
||||
Reference in new issue
Block a user