mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-29 21:08:53 -06:00
refactor: add the truth list beside the manifest
generate_manifest is one build again, so the gap report runs once per build. generate_install_list adds the --source truth build and the standalone layouts, and --manifest writes through it. The schema check test skips without jsonschema.
This commit is contained in:
1 parent
ef67119bc7
commit
56df7ec1ec
2 files changed
+55
-25
No files matched your search
+50
-23
@@ -34,6 +34,7 @@ import shutil
|
|||||||
import tempfile
|
import tempfile
|
||||||
import zipfile
|
import zipfile
|
||||||
from pathlib import Path, PurePosixPath
|
from pathlib import Path, PurePosixPath
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
sys.path.insert(0, os.path.dirname(__file__))
|
sys.path.insert(0, os.path.dirname(__file__))
|
||||||
from alternatives import core_file_spares, settle_sets, slot_set_keys
|
from alternatives import core_file_spares, settle_sets, slot_set_keys
|
||||||
@@ -2965,7 +2966,7 @@ def _run_manifest_mode(
|
|||||||
continue
|
continue
|
||||||
layouts: dict = {}
|
layouts: dict = {}
|
||||||
try:
|
try:
|
||||||
manifest = generate_manifest(
|
manifest = generate_install_list(
|
||||||
representative,
|
representative,
|
||||||
args.platforms_dir,
|
args.platforms_dir,
|
||||||
db,
|
db,
|
||||||
@@ -4882,7 +4883,7 @@ def generate_manifest(
|
|||||||
no_game_data: bool = False,
|
no_game_data: bool = False,
|
||||||
one_per_slot: bool = False,
|
one_per_slot: bool = False,
|
||||||
known_slot_choices: dict | None = None,
|
known_slot_choices: dict | None = None,
|
||||||
standalone_out: dict | None = None,
|
build_out: dict | None = None,
|
||||||
) -> dict:
|
) -> dict:
|
||||||
"""Generate a JSON manifest for a platform (same resolution as generate_pack).
|
"""Generate a JSON manifest for a platform (same resolution as generate_pack).
|
||||||
|
|
||||||
@@ -4893,10 +4894,9 @@ def generate_manifest(
|
|||||||
A file that is a game's data, not firmware, carries ``"category":
|
A file that is a game's data, not firmware, carries ``"category":
|
||||||
"game_data"``, so the installer can leave it out as the builder does
|
"game_data"``, so the installer can leave it out as the builder does
|
||||||
under ``no_game_data``. Firmware carries no category.
|
under ``no_game_data``. Firmware carries no category.
|
||||||
`standalone_out` receives, per emulator with a standalone build, what
|
One build: generate_install_list adds what --source truth and
|
||||||
`--emulator X --standalone` packs (standalone_layouts), which the list
|
--standalone read. `build_out` receives the slot choices and the
|
||||||
itself only names (standalone_builds): written apart, it is fetched
|
profiles this build read, which that second build takes over.
|
||||||
only by a run given --standalone.
|
|
||||||
"""
|
"""
|
||||||
config = load_platform_config(platform_name, platforms_dir)
|
config = load_platform_config(platform_name, platforms_dir)
|
||||||
if fold_case is not None:
|
if fold_case is not None:
|
||||||
@@ -5433,24 +5433,51 @@ def generate_manifest(
|
|||||||
]
|
]
|
||||||
if variants:
|
if variants:
|
||||||
result["case_variants"] = variants
|
result["case_variants"] = variants
|
||||||
if source == "full" and target_cores is None and fold_case is None and not one_per_slot:
|
if build_out is not None:
|
||||||
with contextlib.redirect_stdout(io.StringIO()):
|
build_out.update(slot_choices=slot_choices, profiles=manifest_profiles)
|
||||||
truth = generate_manifest(
|
return result
|
||||||
platform_name, platforms_dir, db, bios_dir, registry_path,
|
|
||||||
emulators_dir, zip_contents, full_profiles, None, "truth",
|
|
||||||
regions, target_name, offline, required_only, data_registry,
|
def generate_install_list(
|
||||||
fold_case=None, no_game_data=no_game_data,
|
platform_name: str,
|
||||||
known_slot_choices=slot_choices,
|
platforms_dir: str,
|
||||||
)
|
db: dict,
|
||||||
_mark_truth(result, truth)
|
bios_dir: str,
|
||||||
layouts = _standalone_layouts(
|
registry_path: str,
|
||||||
manifest_profiles, emulators_dir, db, bios_dir, zip_contents, offline,
|
standalone_out: dict | None = None,
|
||||||
platforms_dir, repo_root, result,
|
**options: Any,
|
||||||
|
) -> dict:
|
||||||
|
"""The list install.py reads: the full manifest, the files and omissions
|
||||||
|
the --source truth build holds apart from it, and the emulators with a
|
||||||
|
standalone build. `standalone_out` receives, per such emulator, what
|
||||||
|
`--emulator X --standalone` packs, written apart from the list
|
||||||
|
(install/standalone/<platform>.json) and fetched only by a run given
|
||||||
|
--standalone.
|
||||||
|
|
||||||
|
A manifest narrowed by a target, a case fold or --one-per-slot is no
|
||||||
|
list install.py reads by default and gets neither.
|
||||||
|
"""
|
||||||
|
built: dict = {}
|
||||||
|
result = generate_manifest(platform_name, platforms_dir, db, bios_dir, registry_path,
|
||||||
|
build_out=built, **options)
|
||||||
|
if (options.get("source", "full") != "full" or options.get("target_cores") is not None
|
||||||
|
or options.get("fold_case") is not None or options.get("one_per_slot")):
|
||||||
|
return result
|
||||||
|
with contextlib.redirect_stdout(io.StringIO()):
|
||||||
|
truth = generate_manifest(
|
||||||
|
platform_name, platforms_dir, db, bios_dir, registry_path,
|
||||||
|
**{**options, "source": "truth"}, known_slot_choices=built["slot_choices"],
|
||||||
)
|
)
|
||||||
if layouts:
|
_mark_truth(result, truth)
|
||||||
result["standalone_builds"] = sorted(layouts)
|
layouts = _standalone_layouts(
|
||||||
if standalone_out is not None:
|
built["profiles"], options.get("emulators_dir", "emulators"), db, bios_dir,
|
||||||
standalone_out.update(layouts)
|
options.get("zip_contents") or {}, options.get("offline"), platforms_dir,
|
||||||
|
os.path.dirname(os.path.dirname(os.path.abspath(__file__))), result,
|
||||||
|
)
|
||||||
|
if layouts:
|
||||||
|
result["standalone_builds"] = sorted(layouts)
|
||||||
|
if standalone_out is not None:
|
||||||
|
standalone_out.update(layouts)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class RealListParity(unittest.TestCase):
|
|||||||
if plat not in self.manifests:
|
if plat not in self.manifests:
|
||||||
self.layouts[plat] = {}
|
self.layouts[plat] = {}
|
||||||
with contextlib.redirect_stdout(io.StringIO()):
|
with contextlib.redirect_stdout(io.StringIO()):
|
||||||
self.manifests[plat] = self.gp.generate_manifest(
|
self.manifests[plat] = self.gp.generate_install_list(
|
||||||
plat, str(REPO_ROOT / "platforms"), self.db, str(REPO_ROOT / "bios"),
|
plat, str(REPO_ROOT / "platforms"), self.db, str(REPO_ROOT / "bios"),
|
||||||
str(REPO_ROOT / "platforms" / "_registry.yml"),
|
str(REPO_ROOT / "platforms" / "_registry.yml"),
|
||||||
emulators_dir=str(REPO_ROOT / "emulators"),
|
emulators_dir=str(REPO_ROOT / "emulators"),
|
||||||
@@ -588,7 +588,10 @@ class ExpertRuns(Lists):
|
|||||||
def test_the_schema_check_reads_a_null_truth_list(self):
|
def test_the_schema_check_reads_a_null_truth_list(self):
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
import validate_schemas
|
try:
|
||||||
|
import validate_schemas
|
||||||
|
except ImportError as exc:
|
||||||
|
self.skipTest(f"validate_schemas needs jsonschema: {exc}")
|
||||||
|
|
||||||
with tempfile.TemporaryDirectory(dir=REPO_ROOT / "tmp") as root:
|
with tempfile.TemporaryDirectory(dir=REPO_ROOT / "tmp") as root:
|
||||||
(Path(root) / "install" / "standalone").mkdir(parents=True)
|
(Path(root) / "install" / "standalone").mkdir(parents=True)
|
||||||
|
|||||||
Reference in new issue
Block a user