fix: name uncached trees once per manifest

This commit is contained in:
Abdessamad Derraz committed 2026-11-21 21:46:27 +01:00
1 parent 11e3ebb44f
commit bbb139bbaf
4 files changed
+44 -20

No files matched your search

+9 -15
View File
@@ -2,8 +2,6 @@
from __future__ import annotations
import contextlib
import io
import os
from collections.abc import Callable, Iterator
from dataclasses import dataclass, field
@@ -26,7 +24,6 @@ from packs.datatrees import (
core_data_trees,
pack_markers,
tree_readers,
uncached_warning,
)
from packs.extras import (
collect_emulator_extras,
@@ -96,7 +93,7 @@ class InstallListOptions(TypedDict, total=False):
fold_case: bool | None
no_game_data: bool
one_per_slot: bool
uncached_out: set[str] | None
uncached_out: dict[str, str] | None
class ManifestOptions(InstallListOptions, total=False):
@@ -125,7 +122,7 @@ class _ManifestSettings:
one_per_slot: bool = False
known_slot_choices: dict | None = None
build_out: dict | None = None
uncached_out: set[str] | None = None
uncached_out: dict[str, str] | None = None
@dataclass
@@ -479,10 +476,8 @@ class _ManifestBuild:
core_trees=core_trees,
reclaim=reclaim, uncached_out=uncached,
))
for ref_key, local_path in uncached:
print(uncached_warning(ref_key, local_path))
if opts.uncached_out is not None:
opts.uncached_out.update(ref_key for ref_key, _path in uncached)
opts.uncached_out.update(uncached)
# A platform entry found in a tree the pack carries is that tree's member:
# the installer rebuilds it from the tree's archive. One found in a tree
# the pack does not carry stays omitted, held by the pack alone.
@@ -713,8 +708,8 @@ def generate_manifest(
One build: generate_install_list adds what --source truth and
--standalone read. `build_out` receives the slot choices and the
profiles this build read, which that second build takes over.
`uncached_out` receives the data directories the list carries and the
cache does not hold.
`uncached_out` maps each data directory the list carries and the cache
does not hold to its cache folder: the caller reports it.
"""
reject_unknown("generate_manifest", options, ManifestOptions.__optional_keys__)
opts = _ManifestSettings(**options)
@@ -822,11 +817,10 @@ def generate_install_list(
or settings.fold_case is not None or settings.one_per_slot):
return result
truth_options: InstallListOptions = {**options, "source": "truth"}
with contextlib.redirect_stdout(io.StringIO()):
truth = generate_manifest(
platform_name, platforms_dir, db, bios_dir, registry_path,
**truth_options, known_slot_choices=built["slot_choices"],
)
truth = generate_manifest(
platform_name, platforms_dir, db, bios_dir, registry_path,
**truth_options, known_slot_choices=built["slot_choices"],
)
_mark_truth(result, truth)
layouts = standalone_layouts(
built["profiles"], settings.emulators_dir, db, bios_dir,
+13 -1
View File
@@ -11,6 +11,7 @@ from core.artifacts import write_if_changed
from model.platforms import load_platform_config
from model.registry import load_platform_registry
from model.safeparse import require_yaml
from packs.datatrees import uncached_warning
from packs.manifest import generate_install_list
from packs.naming import pack_narrowings, platform_target
from packs.scope import platform_list_version
@@ -60,6 +61,15 @@ def _alias_manifest(
return alias_manifest
def report_uncached(uncached: dict[str, str], recorded: set[str] | None) -> None:
"""Name each data directory a list carries and the cache does not hold,
once, and record it for the run's exit code."""
for ref_key, local_path in uncached.items():
print(uncached_warning(ref_key, local_path))
if recorded is not None:
recorded.update(uncached)
def run_manifest_mode(
args: argparse.Namespace,
groups: list[tuple[list[str], str]],
@@ -82,6 +92,7 @@ def run_manifest_mode(
if skip_empty_truth(args, source, representative, emu_profiles, tc, failed):
continue
layouts: dict = {}
uncached: dict[str, str] = {}
try:
manifest = generate_install_list(
representative,
@@ -102,8 +113,9 @@ def run_manifest_mode(
required_only=required_only,
no_game_data=getattr(args, "no_game_data", False),
standalone_out=layouts,
uncached_out=getattr(args, "uncached_trees", None),
uncached_out=uncached,
)
report_uncached(uncached, getattr(args, "uncached_trees", None))
narrow_suffix = "".join(
tag.lower()
for tag, _label in pack_narrowings(
+6 -1
View File
@@ -165,6 +165,8 @@ def run_platform_packs(
# systems: the pack records them, so a pack alone (a
# handheld without Wi-Fi) can be narrowed by system.
board_list = Path(args.platforms_dir) / "targets" / f"{representative}.yml"
# The pack above named its uncached trees: these are recorded only.
unnamed: dict[str, str] = {}
systems_for[os.path.basename(zip_path)] = pack_systems(generate_manifest(
representative, args.platforms_dir, db, args.bios_dir,
registry_path, emulators_dir=args.emulators_dir,
@@ -174,8 +176,11 @@ def run_platform_packs(
offline=args.offline, required_only=required_only,
data_registry=data_registry,
no_game_data=getattr(args, "no_game_data", False),
uncached_out=getattr(args, "uncached_trees", None),
uncached_out=unnamed,
), target_list(board_list) if board_list.is_file() else None)
recorded_trees: set[str] | None = getattr(args, "uncached_trees", None)
if recorded_trees is not None:
recorded_trees.update(unnamed)
if record_counts:
write_pack_counts(record_counts, recorded)