fix: read the lakka release from lakka.yml

The target scraper asked for the latest Lakka release while lakka.yml
named its version by hand, kept in step by a test alone. The scraper now
reads that field, and check_freshness reports a newer Lakka release.
This commit is contained in:
Abdessamad Derraz committed 2026-11-22 02:26:44 +01:00
1 parent 852415a0e4
commit 35b5458a2d
9 files changed
+113 -7

No files matched your search

+2 -1
View File
@@ -55,7 +55,7 @@ from freshness.platforms import check_emulatorjs, check_platforms
from freshness.profiles import check_profiles, check_source_paths
from freshness.report import exit_code, render, unknown_areas_message
from freshness.romfolders import check_romfolders
from freshness.targets import check_targets
from freshness.targets import check_lakka_release, check_targets
from model.profiles import load_emulator_profiles
@@ -138,6 +138,7 @@ def main() -> int:
)
if "targets" in areas:
findings.extend(check_targets(platforms_dir, workdir, profiles, args.jobs, args.offline))
findings.append(check_lakka_release(platforms_dir, args.cache_dir, args.offline))
if "romfolders" in areas:
findings.extend(check_romfolders(platforms_dir, args.cache_dir, args.offline))
if "coreinfo" in areas:
+30
View File
@@ -8,6 +8,7 @@ from concurrent.futures import ThreadPoolExecutor
from datetime import datetime, timezone
from pathlib import Path
from core import upstream
from model.profiles import upstream_profile_index
from model.sources import source_yaml_file
from model.targets import apply_target_overrides, platform_overrides, read_target_overrides
@@ -17,6 +18,8 @@ from freshness.findings import (
from freshness.platformdiff import diff_targets
from freshness.rescrape import scrape_into_copy
from freshness.scrapers import target_scrapers
from scraper.targets import BaseTargetScraper
from scraper.targets.lakka_targets_scraper import PLATFORM_NAME as LAKKA, REPO as LAKKA_REPO
def profile_name_index(profiles: dict[str, dict]) -> dict[str, set[str]]:
@@ -133,6 +136,33 @@ def check_targets(
return findings
def check_lakka_release(platforms_dir: Path, cache_dir: str, offline: bool) -> Finding:
"""The Lakka release platforms/lakka.yml pins against the newest one.
The target scraper reads the release lakka.yml names, so a rescrape
never moves it: only this row says Lakka published a newer one.
"""
subject = f"{LAKKA} release"
try:
local = BaseTargetScraper.pinned_version(LAKKA, str(platforms_dir))
except (OSError, RuntimeError) as exc:
return Finding("targets", subject, ERROR, detail=str(exc))
if offline:
return Finding("targets", subject, SKIPPED, local=local, detail="offline")
repo = upstream.parse_repo(f"https://github.com/{LAKKA_REPO}")
try:
release = upstream.latest_release(repo, cache_dir) if repo else None
except upstream.UpstreamError as exc:
return Finding("targets", subject, UNKNOWN, local=local, detail=str(exc))
if release is None:
return Finding("targets", subject, UNKNOWN, local=local, detail="no release listed")
if release.tag == local:
return Finding("targets", subject, OK, local=local, remote=release.tag,
detail="newest release")
return Finding("targets", subject, STALE, local=local, remote=release.tag,
detail=f"edit version: in platforms/{LAKKA}.yml, then rescrape the targets")
def _declared_cores(platform: str, platforms_dir: Path) -> list[str]:
"""The cores and standalone emulators a platform's own file names."""
from model.platforms import load_platform_config
+17
View File
@@ -12,6 +12,7 @@ from abc import ABC, abstractmethod
from pathlib import Path
from model.safeparse import require_yaml
from model.sources import source_yaml_file
from model.sourcerevision import platform_revision
# Every target scraper reads the network through the platform scrapers'
@@ -47,6 +48,22 @@ class BaseTargetScraper(ABC):
)
return platform_revision(directory / f"{platform}.yml")
@staticmethod
def pinned_version(platform: str, platforms_dir: str | None = None) -> str:
"""The release tag platforms/<platform>.yml names in its own `version:`.
A platform that inherits its BIOS list (Lakka) has no source of its
own to pin: its file names the release by hand, and moving to a new
release is an edit of that field.
"""
directory = Path(platforms_dir) if platforms_dir else (
Path(__file__).resolve().parents[3] / "platforms"
)
version = str((source_yaml_file(directory / f"{platform}.yml") or {}).get("version") or "")
if not version:
raise RuntimeError(f"platforms/{platform}.yml names no version")
return version
def write_output(self, data: dict, output_path: str) -> None:
"""Write target data to YAML file."""
from core.artifacts import write_text_atomic
@@ -1,6 +1,6 @@
"""Scraper for Lakka per-device core availability.
Sources (libretro/Lakka-LibreELEC, at the latest Lakka release tag):
Sources (libretro/Lakka-LibreELEC, at the release platforms/lakka.yml names):
- packages/lakka/libretro_cores/package.mk -- LIBRETRO_CORES, then the
EXCLUDE_LIBRETRO_CORES each PROJECT/DEVICE and OPENGLES_SUPPORT add
- projects/<PROJECT>/options and projects/<PROJECT>/devices/<DEVICE>/options
@@ -16,9 +16,8 @@ import re
import sys
from datetime import datetime, timezone
from . import BaseTargetScraper, target_cli
from ..base_scraper import fetch_github_latest_version, fetch_text, github_tree
from ..base_scraper import fetch_text, github_tree
PLATFORM_NAME = "lakka"
@@ -220,7 +219,7 @@ class Scraper(BaseTargetScraper):
return found
def fetch_targets(self) -> dict:
self.tag = fetch_github_latest_version(REPO)
self.tag = self.pinned_version(PLATFORM_NAME)
cores_mk = self._raw(CORES_MK)
targets: dict[str, dict] = {}
for project, device in self._devices():