chore: merge origin/main

This commit is contained in:
Abdessamad Derraz committed 2026-11-06 05:18:32 +01:00
commit 83076818b0
17 files changed
+5449 -4714

No files matched your search

+2 -1
View File
@@ -362,7 +362,8 @@ def _child(spec: dict) -> int:
def held(files: list[dict], _bios: Path, **_kwargs: object) -> tuple:
return [], list(files), []
def tree_landed(entry: dict, _bios: Path, state: object = None) -> dict:
def tree_landed(entry: dict, _bios: Path, state: object = None,
_progress: object = None) -> dict:
return {"present": 0, "installed": len(entry["files"]), "changed": 0,
"absent": 0, "error": "", "not_kept": []}
+14 -4
View File
@@ -2415,7 +2415,7 @@ def generate_target_manifests(targets_dir: str, output_dir: str) -> None:
print(f"Generated {count} target manifest(s) in {output_dir}")
def target_list(yml_file: Path) -> dict[str, list[str] | None]:
def target_list(yml_file: Path) -> dict[str, list[str] | dict | None]:
"""A platform's cores per hardware target, as install/targets/ publishes
them and a pack carries them: aliases included, overrides applied."""
targets_path = yml_file.parent
@@ -2443,7 +2443,7 @@ def target_list(yml_file: Path) -> dict[str, list[str] | None]:
if names:
alias_map[tname] = names
result: dict[str, list[str] | None] = {}
result: dict[str, list[str] | dict | None] = {}
for target_name, target_info in targets.items():
if not isinstance(target_name, str) or not target_name:
raise ValueError(f"{yml_file}: target names must be non-empty strings")
@@ -2468,7 +2468,15 @@ def target_list(yml_file: Path) -> dict[str, list[str] | None]:
resolved = load_target_config(
yml_file.stem, target_name, str(targets_path.parent)
)
result[target_name] = None if resolved is None else sorted(resolved)
listed = None if resolved is None else sorted(resolved)
images = target_info.get("images")
# The image names a card's board file holds (Batocera writes
# anbernic-rg35xx-plus for the h700 target): the installer reads
# the board of a card prepared on a computer through them.
result[target_name] = (
{"cores": listed, "images": images}
if images and listed is not None else listed
)
for target_name, names in alias_map.items():
if target_name not in result:
@@ -2478,7 +2486,9 @@ def target_list(yml_file: Path) -> dict[str, list[str] | None]:
raise ValueError(
f"{yml_file}: alias {alias!r} collides with a target name"
)
result[alias] = result[target_name]
# An alias names the board, not its images.
held = result[target_name]
result[alias] = held["cores"] if isinstance(held, dict) else held
return result
@@ -36,6 +36,35 @@ except ImportError:
_TARGET_FLAG_RE = re.compile(r"^(BR2_PACKAGE_BATOCERA_TARGET_\w+)=y", re.MULTILINE)
# The images a target flag builds, each a board directory whose last segment
# post-image-script.sh writes to boot/<system>.board on the card
# (batocera-43.1 board/batocera/scripts/post-image-script.sh:50,60, KNULLI
# 20260511 board/scripts/post-image-script.sh:57,66): Config.in lists them
# under BR2_TARGET_<SYSTEM>_IMAGES, one "default" per target flag.
_IMAGES_DEFAULT_RE = re.compile(
r'^\s*default\s+"([^"]*)"\s+if\s+(BR2_PACKAGE_BATOCERA_TARGET_\w+)\s*$')
def _parse_images(text: str) -> dict[str, list[str]]:
"""Each target flag's image names, in the words a card's board file uses."""
lines = text.replace("\\\n", " ").splitlines()
start = next((n for n, line in enumerate(lines)
if re.match(r"^\s*config\s+BR2_TARGET_[A-Z]+_IMAGES\s*$", line)), None)
if start is None:
return {}
images: dict[str, list[str]] = {}
for line in lines[start + 1:]:
if not line.strip():
continue
m = _IMAGES_DEFAULT_RE.match(line)
if m:
images.setdefault(m.group(2), []).extend(
path.rsplit("/", 1)[-1] for path in m.group(1).split())
elif not re.match(r"^\s*(string|default|help)\b", line):
break
return images
_IF_RE = re.compile(r"^if\s+(.*)$")
_DEFAULT_Y_RE = re.compile(r"^\s*default\s+y\s*(?:#.*)?$")
@@ -428,6 +457,9 @@ class Scraper(BaseTargetScraper):
)
if not package_to_emulators:
raise RuntimeError(f"no package->emulator mappings parsed from {es_systems_url}")
images_by_flag = _parse_images(config_in_text)
if not images_by_flag:
raise RuntimeError(f"no target image list parsed from {config_in_url}")
targets: dict[str, dict] = {}
for board_name in sorted(boards):
@@ -456,6 +488,9 @@ class Scraper(BaseTargetScraper):
"architecture": arch,
"cores": sorted(emulators),
}
images = sorted(set(images_by_flag.get(primary_flag, [])))
if images and images != [target_key]:
targets[target_key]["images"] = images
print(
f" {len(emulators)} emulators ({len(selected_packages)} packages selected)",
file=sys.stderr,