mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-22 17:47:48 -06:00
fix: close the expert option review findings
Change offers Standalone version of it only without a region, core or system choice, and a later such choice turns it off in one line. --find refuses --pack, --add-app, --standalone-copies, --romm-firmware and --from. Every --find --json match carries every key, null where absent, and a hash with no one file ends on code 4. A slot claim that is no object, and a truth-only omission, are checked at the boundary. truth_files: null reads as no list. Each name a group gives a file is looked up apart (slot also), and --installed-cores ranks a slot by the cores found.
This commit is contained in:
1 parent
62abea3ed4
commit
180aca1c63
12 files changed
+494
-114
No files matched your search
+1
-1
@@ -16,7 +16,7 @@
|
||||
# and Invoke-WebRequest throws on a cut transfer before the hash is read:
|
||||
# the site's build rewrites this line there (scripts/sitebootstrap.py).
|
||||
$mismatchAdvice = "The download was most likely cut short: try again. Within minutes of an update of this project the two files can come from caches of different ages. Waiting five minutes settles that."
|
||||
$defaultInstallSha256 = "c09a21f98f3080536ac599e954560730ad198e1a69742065179d8d5fa86ff650"
|
||||
$defaultInstallSha256 = "2c15df40ad3331a3137d02febc34714fc681119869bfe7a2331764e9cd88376b"
|
||||
# The pin above refuses any changed byte: this cap only stops a body that
|
||||
# cannot be the installer (a sign-in portal's page) before it is hashed.
|
||||
$maximumInstallerBytes = 8MB
|
||||
|
||||
+121
-57
@@ -4155,17 +4155,34 @@ def _check_expert_fields(entry: dict, dest: str) -> None:
|
||||
slot = entry.get("slot")
|
||||
if slot is None:
|
||||
return
|
||||
if not isinstance(slot, dict) or set(slot) != {"groups", "keys"}:
|
||||
if not isinstance(slot, dict) or not {"groups", "keys"} <= set(slot) <= {
|
||||
"groups", "keys", "also"}:
|
||||
raise ValueError(f"invalid slot for {dest}")
|
||||
_check_tags(slot, "groups", dest)
|
||||
keys = slot["keys"]
|
||||
if not isinstance(keys, list) or not keys or len(keys) > MAX_SELECTION_TAGS:
|
||||
also = slot.get("also", [])
|
||||
if not isinstance(also, list) or len(also) > MAX_SELECTION_TAGS:
|
||||
raise ValueError(f"invalid slot for {dest}")
|
||||
for chain in [slot, *also]:
|
||||
if not isinstance(chain, dict) or not {"groups", "keys"} <= set(chain) or (
|
||||
chain is not slot and set(chain) != {"groups", "keys"}):
|
||||
raise ValueError(f"invalid slot for {dest}")
|
||||
_check_slot_chain(chain, dest)
|
||||
|
||||
|
||||
def _check_slot_chain(chain: dict, dest: str) -> None:
|
||||
"""One name's groups and the claims at each key its lookup tries."""
|
||||
if not isinstance(chain.get("groups"), list):
|
||||
raise ValueError(f"invalid slot groups for {dest}")
|
||||
_check_tags(chain, "groups", dest)
|
||||
keys = chain["keys"]
|
||||
if not isinstance(keys, list) or len(keys) > MAX_SELECTION_TAGS:
|
||||
raise ValueError(f"invalid slot keys for {dest}")
|
||||
for claims in keys:
|
||||
if not isinstance(claims, dict) or not claims or len(claims) > MAX_SELECTION_TAGS:
|
||||
raise ValueError(f"invalid slot claims for {dest}")
|
||||
for name, claim in claims.items():
|
||||
ranks = claim.get("ranks") if isinstance(claim, dict) else None
|
||||
if not isinstance(claim, dict):
|
||||
raise ValueError(f"invalid slot claim for {dest}")
|
||||
ranks = claim.get("ranks")
|
||||
if (not isinstance(name, str) or not 0 < len(name) <= 256
|
||||
or not set(claim) <= {"ranks", "regions", "sets"}
|
||||
or not isinstance(ranks, list) or not ranks
|
||||
@@ -4178,6 +4195,29 @@ def _check_expert_fields(entry: dict, dest: str) -> None:
|
||||
_check_tags(claim, "sets", dest)
|
||||
|
||||
|
||||
def _check_omitted_entry(entry: dict, dest: str) -> None:
|
||||
"""An omission's fields, its cores' claims and its expert fields, the
|
||||
same for omitted_files and truth_omitted."""
|
||||
_check_omission(entry, dest)
|
||||
_check_root(entry, dest, omitted=True)
|
||||
claims = entry.get("alternatives", [])
|
||||
if not isinstance(claims, list) or len(claims) > MAX_SELECTION_TAGS:
|
||||
raise ValueError(f"invalid omitted alternatives for {dest}")
|
||||
for claim in claims:
|
||||
claim_cores = claim.get("cores") if isinstance(claim, dict) else None
|
||||
if (
|
||||
not isinstance(claim, dict)
|
||||
or set(claim) != {"cores"}
|
||||
or not isinstance(claim_cores, list)
|
||||
or not claim_cores
|
||||
or not all(isinstance(core, str) for core in claim_cores)
|
||||
):
|
||||
raise ValueError(f"invalid omitted alternative for {dest}")
|
||||
for field in (*SELECTION_FIELDS, "declared_in"):
|
||||
_check_tags(entry, field, dest)
|
||||
_check_expert_fields(entry, dest)
|
||||
|
||||
|
||||
def _check_truth_lists(data: dict, seen_destinations: set[str]) -> int:
|
||||
"""truth_files and truth_omitted, what --source truth adds to the list:
|
||||
each a valid entry, and the truth list it makes holds each destination
|
||||
@@ -4205,8 +4245,7 @@ def _check_truth_lists(data: dict, seen_destinations: set[str]) -> int:
|
||||
if not isinstance(entry, dict):
|
||||
raise ValueError(f"truth_omitted[{index}] must be an object")
|
||||
dest = str(_safe_relative_path(entry.get("dest"), f"truth_omitted[{index}].dest"))
|
||||
_check_omission(entry, dest)
|
||||
_check_root(entry, dest, omitted=True)
|
||||
_check_omitted_entry(entry, dest)
|
||||
return largest
|
||||
|
||||
|
||||
@@ -4381,24 +4420,7 @@ def _validate_manifest(data: object, plat: str) -> dict:
|
||||
if key in seen_destinations or key in seen_omitted:
|
||||
raise ValueError(f"duplicate or conflicting omitted destination: {dest}")
|
||||
seen_omitted.add(key)
|
||||
_check_omission(entry, dest)
|
||||
_check_root(entry, dest, omitted=True)
|
||||
claims = entry.get("alternatives", [])
|
||||
if not isinstance(claims, list) or len(claims) > MAX_SELECTION_TAGS:
|
||||
raise ValueError(f"invalid omitted alternatives for {dest}")
|
||||
for claim in claims:
|
||||
claim_cores = claim.get("cores") if isinstance(claim, dict) else None
|
||||
if (
|
||||
not isinstance(claim, dict)
|
||||
or set(claim) != {"cores"}
|
||||
or not isinstance(claim_cores, list)
|
||||
or not claim_cores
|
||||
or not all(isinstance(core, str) for core in claim_cores)
|
||||
):
|
||||
raise ValueError(f"invalid omitted alternative for {dest}")
|
||||
for field in (*SELECTION_FIELDS, "declared_in"):
|
||||
_check_tags(entry, field, dest)
|
||||
_check_expert_fields(entry, dest)
|
||||
_check_omitted_entry(entry, dest)
|
||||
if data.get("slot_fields", True) is not True:
|
||||
raise ValueError("invalid slot_fields")
|
||||
largest_total += _check_truth_lists(data, seen_destinations)
|
||||
@@ -5376,19 +5398,21 @@ def slot_drops(entries: list[dict], held: set[str],
|
||||
key = _entry_key(entry)
|
||||
if not isinstance(slot, dict) or key not in held:
|
||||
continue
|
||||
merged = None
|
||||
for claims in slot.get("keys", []):
|
||||
here = {name: claim for name, claim in claims.items()
|
||||
if reach is None or name in reach}
|
||||
if here:
|
||||
merged = _merged_slot(here)
|
||||
break
|
||||
if merged is None:
|
||||
keep.add(key)
|
||||
continue
|
||||
rank, regions, sets = merged
|
||||
for group in slot.get("groups", []):
|
||||
bucketed.setdefault((group, regions), []).append((key, rank, sets))
|
||||
# One lookup per name the groups list the file under (`also`).
|
||||
for chain in [slot, *slot.get("also", [])]:
|
||||
merged = None
|
||||
for claims in chain.get("keys", []):
|
||||
here = {name: claim for name, claim in claims.items()
|
||||
if reach is None or name in reach}
|
||||
if here:
|
||||
merged = _merged_slot(here)
|
||||
break
|
||||
if merged is None:
|
||||
keep.add(key)
|
||||
continue
|
||||
rank, regions, sets = merged
|
||||
for group in chain.get("groups", []):
|
||||
bucketed.setdefault((group, regions), []).append((key, rank, sets))
|
||||
drop: set[str] = set()
|
||||
for found in bucketed.values():
|
||||
for candidates in _linked_by_set(found):
|
||||
@@ -5459,7 +5483,7 @@ def standalone_entries(manifest: dict, layouts: dict, profile: str) -> list[dict
|
||||
return None
|
||||
copies = {
|
||||
copy["sha1"]: copy
|
||||
for entry in [*manifest.get("files", []), *manifest.get("truth_files", [])]
|
||||
for entry in [*manifest.get("files", []), *(manifest.get("truth_files") or [])]
|
||||
for copy in [entry, *entry.get("alternatives", []), *entry.get("slot_choices", [])]
|
||||
if copy.get("sha1") and (copy.get("repo_path") or copy.get("release_asset"))
|
||||
}
|
||||
@@ -17205,6 +17229,15 @@ def _check_expert(parser: argparse.ArgumentParser, args: argparse.Namespace) ->
|
||||
for given, reason in refusals:
|
||||
if given:
|
||||
parser.error(reason)
|
||||
if args.find:
|
||||
# Each would be skipped by a run that installs one file or prints it.
|
||||
for flag, given in (("--pack", getattr(args, "pack", None) is not None),
|
||||
("--add-app", args.add_app),
|
||||
("--standalone-copies", args.standalone_copies),
|
||||
("--romm-firmware", args.romm_firmware is not None),
|
||||
("--from", bool(getattr(args, "from")))):
|
||||
if given:
|
||||
parser.error(f"--find picks one file by its hash, which {flag} does not apply to")
|
||||
if args.find is not None:
|
||||
value = args.find.strip()
|
||||
if len(value) not in FIND_KINDS or not re.fullmatch(r"[0-9a-fA-F]+", value):
|
||||
@@ -17213,7 +17246,8 @@ def _check_expert(parser: argparse.ArgumentParser, args: argparse.Namespace) ->
|
||||
|
||||
|
||||
FIND_SCHEMA = 1
|
||||
# What a match of --find --json carries, in this order.
|
||||
# What a match of --find --json carries, every key in this order, null
|
||||
# where the list records none.
|
||||
FIND_FIELDS = ("dest", "root", "sha1", "sha256", "md5", "crc32", "size", "systems", "cores")
|
||||
|
||||
|
||||
@@ -17234,22 +17268,28 @@ def _found_files(args: argparse.Namespace, plat: str,
|
||||
if args.json:
|
||||
record = {"schema": FIND_SCHEMA, "platform": plat, "hash": value, "kind": kind,
|
||||
"result": result,
|
||||
"matches": [{field: match.get(field) for field in FIND_FIELDS
|
||||
if field in match or field in ("root", "cores")}
|
||||
"matches": [{field: match.get(field) for field in FIND_FIELDS}
|
||||
for match in matches]}
|
||||
print(json.dumps(record), file=args.json_out, flush=True)
|
||||
if result != "found":
|
||||
args.find_failed = True
|
||||
return [], []
|
||||
if result == "unrecorded":
|
||||
refuse_name(plat, f"Error: the {plat} file list records no {kind}: --find reads "
|
||||
"sha1 and sha256 in every list.")
|
||||
if result == "unknown":
|
||||
refuse_name(plat, f"Error: no file of the {plat} list has the {kind} {value}.")
|
||||
if result == "ambiguous":
|
||||
refuse_name(plat, f"Error: {len(contents)} files of the {plat} list have the "
|
||||
f"{kind} {value}: give their sha1 instead.",
|
||||
*(f" {match['dest']} {match.get('sha1', '')}" for match in matches))
|
||||
lines = {
|
||||
"unrecorded": [f"Error: the {plat} file list records no {kind}: --find reads "
|
||||
"sha1 and sha256 in every list."],
|
||||
"unknown": [f"Error: no file of the {plat} list has the {kind} {value}."],
|
||||
"ambiguous": [f"Error: {len(contents)} files of the {plat} list have the "
|
||||
f"{kind} {value}: give their sha1 instead.",
|
||||
*(f" {match['dest']} {match.get('sha1', '')}" for match in matches)],
|
||||
}.get(result)
|
||||
if lines is not None:
|
||||
EVENTS.emit("error", stage="option", reason="unknown", platform=plat,
|
||||
message=lines[0][len("Error: "):])
|
||||
for line in lines:
|
||||
print(line, file=sys.stderr)
|
||||
# 4: the hash was read and the list holds no one file for it, neither
|
||||
# a failure (1) nor an option refused (2).
|
||||
sys.exit(4)
|
||||
for match in matches:
|
||||
print(f" {value} is {match['dest']}")
|
||||
return matches, []
|
||||
@@ -19355,7 +19395,7 @@ def _install(args: argparse.Namespace, real_stdout: TextIO) -> None:
|
||||
files = manifest.get("files", [])
|
||||
omitted_files = manifest.get("omitted_files", [])
|
||||
if args.source == "truth":
|
||||
if "truth_files" not in manifest:
|
||||
if manifest.get("truth_files") is None:
|
||||
print(f"Error: the {plat_name} file list does not say what the emulator "
|
||||
"profiles prove is read, which --source truth needs.", file=sys.stderr)
|
||||
print(_older_list_advice(plat_name), file=sys.stderr)
|
||||
@@ -19512,6 +19552,9 @@ def _install(args: argparse.Namespace, real_stdout: TextIO) -> None:
|
||||
manifest, found_cores, files, omitted_files, info_dests
|
||||
)
|
||||
detail(f" Narrowed {before} to {len(files)} files to the installed cores")
|
||||
# A slot is ranked by the cores installed, as a pack built for them.
|
||||
found_reach = designated_cores(manifest, found_cores)
|
||||
slot_reach = found_reach if slot_reach is None else slot_reach & found_reach
|
||||
|
||||
if args.list_emulators:
|
||||
_print_emulators(plat_name, manifest, *(
|
||||
@@ -20294,7 +20337,7 @@ def _install(args: argparse.Namespace, real_stdout: TextIO) -> None:
|
||||
sys.stdout = real_stdout
|
||||
if args.find and getattr(args, "json", False):
|
||||
# The matches are the answer: nothing was installed.
|
||||
sys.exit(2 if getattr(args, "find_failed", False) else 0)
|
||||
sys.exit(4 if getattr(args, "find_failed", False) else 0)
|
||||
if not listing:
|
||||
EVENTS.emit(
|
||||
"summary", mode=_event_mode(args), installed=total_downloaded,
|
||||
@@ -22790,16 +22833,22 @@ def _option_rows(state: TuiState) -> list[TuiRow]:
|
||||
|
||||
|
||||
def _tui_standalone_offered(state: TuiState) -> bool:
|
||||
"""Whether Change offers --standalone: emulators are chosen, and the
|
||||
list records a standalone build for each of them."""
|
||||
"""Whether Change offers --standalone: emulators are chosen, the list
|
||||
records a standalone build for each of them, and no region, core or
|
||||
system choice narrows the run, which the option refuses beside it."""
|
||||
manifest = state.manifest or {}
|
||||
layouts = manifest.get("standalone_builds") or []
|
||||
if not state.emulators or not layouts:
|
||||
if not state.emulators or not layouts or not _tui_standalone_fits(state):
|
||||
return False
|
||||
names = emulator_names(manifest, *tui_run_files(state))
|
||||
return all(names.get(name) in layouts for name in state.emulators)
|
||||
|
||||
|
||||
def _tui_standalone_fits(state: TuiState) -> bool:
|
||||
"""No region, core or system choice: --standalone takes none."""
|
||||
return not (state.regions or tui_core_flags(state) or _tui_system_flags(state))
|
||||
|
||||
|
||||
def _tui_slot_offered(state: TuiState, flags: list[tuple[str, str | None]]) -> bool:
|
||||
"""Whether Change offers --one-per-slot: the list records its slots and
|
||||
the choice is the whole list, as the pack builder decides slots over it
|
||||
@@ -24758,7 +24807,22 @@ def _pager_last(state: TuiState, items: list) -> int:
|
||||
|
||||
|
||||
def tui_update(state: TuiState, key: TuiKey) -> list[tuple]:
|
||||
"""What a key does on the current screen, and the work it starts."""
|
||||
"""What a key does on the current screen, and the work it starts. A
|
||||
choice that --standalone cannot sit beside turns it off, said once."""
|
||||
effects = _tui_key(state, key)
|
||||
if state.standalone and state.emulators and not _tui_standalone_fits(state):
|
||||
state.standalone = False
|
||||
state.status = TUI_STANDALONE_OFF
|
||||
return effects
|
||||
|
||||
|
||||
# Said when a choice of regions, cores or systems turns Standalone off.
|
||||
TUI_STANDALONE_OFF = ("Standalone version off: the build is installed whole, which "
|
||||
"regions, cores and systems do not narrow.")
|
||||
|
||||
|
||||
def _tui_key(state: TuiState, key: TuiKey) -> list[tuple]:
|
||||
"""tui_update for one key."""
|
||||
if key.name == "mouse":
|
||||
return tui_mouse(state, key) # type: ignore[arg-type]
|
||||
# A key moves the focus its own way: the next tap focuses again.
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ DEFAULT_INSTALL_URL="https://raw.githubusercontent.com/Abdess/retrobios/main/ins
|
||||
# curl or wget stop on a cut transfer before the hash is read: the site's
|
||||
# build rewrites this line there (scripts/sitebootstrap.py).
|
||||
MISMATCH_ADVICE="The download was most likely cut short: try again. Within minutes of an update of this project the two files can come from caches of different ages. Waiting five minutes settles that."
|
||||
DEFAULT_INSTALL_SHA256="c09a21f98f3080536ac599e954560730ad198e1a69742065179d8d5fa86ff650"
|
||||
DEFAULT_INSTALL_SHA256="2c15df40ad3331a3137d02febc34714fc681119869bfe7a2331764e9cd88376b"
|
||||
# The pin above refuses any changed byte: this cap only stops a body that
|
||||
# cannot be the installer (a sign-in portal's page) before it is hashed.
|
||||
MAX_INSTALLER_BYTES=8388608
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
{
|
||||
"dest": "roms/ports/retrobios/install.py",
|
||||
"repo_path": "install.py",
|
||||
"size": 1379952,
|
||||
"sha256": "c09a21f98f3080536ac599e954560730ad198e1a69742065179d8d5fa86ff650",
|
||||
"size": 1383078,
|
||||
"sha256": "2c15df40ad3331a3137d02febc34714fc681119869bfe7a2331764e9cd88376b",
|
||||
"executable": false
|
||||
},
|
||||
{
|
||||
@@ -71,8 +71,8 @@
|
||||
"muos": {
|
||||
"archive": {
|
||||
"dest": "ARCHIVE/RetroBIOS.muxapp",
|
||||
"size": 1433577,
|
||||
"sha256": "153c13d4901e1899a935f04b164c7b96a1af08d0aafac93378a18aa62923c20d"
|
||||
"size": 1436703,
|
||||
"sha256": "5efdb911b78ccc0e4972c2d9cef8f28935009141125c3a5dc76b7fd8a02d01a8"
|
||||
},
|
||||
"members": [
|
||||
{
|
||||
@@ -92,8 +92,8 @@
|
||||
{
|
||||
"name": "RetroBIOS/install.py",
|
||||
"repo_path": "install.py",
|
||||
"size": 1379952,
|
||||
"sha256": "c09a21f98f3080536ac599e954560730ad198e1a69742065179d8d5fa86ff650",
|
||||
"size": 1383078,
|
||||
"sha256": "2c15df40ad3331a3137d02febc34714fc681119869bfe7a2331764e9cd88376b",
|
||||
"executable": false
|
||||
},
|
||||
{
|
||||
@@ -166,8 +166,8 @@
|
||||
{
|
||||
"dest": ".config/modules/retrobios/install.py",
|
||||
"repo_path": "install.py",
|
||||
"size": 1379952,
|
||||
"sha256": "c09a21f98f3080536ac599e954560730ad198e1a69742065179d8d5fa86ff650",
|
||||
"size": 1383078,
|
||||
"sha256": "2c15df40ad3331a3137d02febc34714fc681119869bfe7a2331764e9cd88376b",
|
||||
"executable": false
|
||||
},
|
||||
{
|
||||
|
||||
@@ -691,8 +691,8 @@
|
||||
}
|
||||
},
|
||||
"$defs": {
|
||||
"slot": {
|
||||
"description": "What --one-per-slot reads: the groups the file competes in, once per time a group lists it, then the keys the slot lookup tries, each with what every emulator declares there.",
|
||||
"slot_chain": {
|
||||
"description": "The groups listing the file under one more name, and that name's keys.",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
@@ -710,7 +710,70 @@
|
||||
},
|
||||
"keys": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"minProperties": 1,
|
||||
"additionalProperties": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"ranks"
|
||||
],
|
||||
"properties": {
|
||||
"ranks": {
|
||||
"description": "The priority: of each entry of the emulator at this key, null for one without, lower first.",
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": {
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"regions": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"sets": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"slot": {
|
||||
"description": "What --one-per-slot reads: the groups the file competes in, once per time a group lists it, then the keys the slot lookup tries for the name those groups give it, each with what every emulator declares there. A group naming the file otherwise has its own groups and keys in also.",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"groups",
|
||||
"keys"
|
||||
],
|
||||
"properties": {
|
||||
"also": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/$defs/slot_chain"
|
||||
}
|
||||
},
|
||||
"groups": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"minItems": 1
|
||||
},
|
||||
"keys": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"minProperties": 1,
|
||||
|
||||
@@ -592,7 +592,71 @@
|
||||
]
|
||||
},
|
||||
"slot": {
|
||||
"description": "What --one-per-slot reads: the groups the file competes in, once per time a group lists it, then the keys the slot lookup tries, each with what every emulator declares there.",
|
||||
"description": "What --one-per-slot reads: the groups the file competes in, once per time a group lists it, then the keys the slot lookup tries for the name those groups give it, each with what every emulator declares there. A group naming the file otherwise has its own groups and keys in also.",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"groups",
|
||||
"keys"
|
||||
],
|
||||
"properties": {
|
||||
"also": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/$defs/slot_chain"
|
||||
}
|
||||
},
|
||||
"groups": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"minItems": 1
|
||||
},
|
||||
"keys": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"minProperties": 1,
|
||||
"additionalProperties": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"ranks"
|
||||
],
|
||||
"properties": {
|
||||
"ranks": {
|
||||
"description": "The priority: of each entry of the emulator at this key, null for one without, lower first.",
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": {
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"regions": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"sets": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"slot_chain": {
|
||||
"description": "The groups listing the file under one more name, and that name's keys.",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
@@ -610,7 +674,6 @@
|
||||
},
|
||||
"keys": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"minProperties": 1,
|
||||
|
||||
+32
-30
@@ -141,44 +141,40 @@ def _slot_fields(
|
||||
"""Per destination, the groups it competes in for a slot and the claims
|
||||
at each key slot.lookup_slot would try.
|
||||
|
||||
Only a group where some emulator ranks a member can drop a file, so
|
||||
only its members are written, each with all its groups. A key whose
|
||||
claims equal the previous one's answers the same and is left out. A
|
||||
destination no emulator claims is never dropped, and carries nothing.
|
||||
The builder looks each member up by its own name, so a destination a
|
||||
platform declares under one name and a core under another is looked up
|
||||
twice: the first name's groups and keys head the field, each other
|
||||
name's go in `also`. A name no emulator claims has no keys, which keeps
|
||||
the destination as the builder keeps it. Only a group where some
|
||||
emulator ranks a member can drop a file, so only its members are
|
||||
written, each with all its groups. A key whose claims equal the
|
||||
previous one's answers the same and is left out.
|
||||
"""
|
||||
names: dict[str, list[str]] = {}
|
||||
for members in region_groups.values():
|
||||
for dest, name in members:
|
||||
if name not in names.setdefault(dest, []):
|
||||
names[dest].append(name)
|
||||
keyed: dict[str, list[str]] = {}
|
||||
for dest, found in names.items():
|
||||
keys: list[str] = []
|
||||
for name in found:
|
||||
keys += [k for k in slot_mod.slot_lookup_keys(dest, name)
|
||||
if k in claims and k not in keys]
|
||||
if keys:
|
||||
keyed[dest] = keys
|
||||
|
||||
def ranked(dest: str) -> bool:
|
||||
return any(rank is not None for key in keyed.get(dest, ())
|
||||
for claim in claims[key].values() for rank in claim["ranks"])
|
||||
|
||||
# Each time a group lists the destination: two cores filing one file in
|
||||
# a group make two candidates of one rank, which no order separates.
|
||||
groups: dict[str, list[str]] = {}
|
||||
chains: dict[str, dict[str, list[str]]] = {}
|
||||
for group_id, members in region_groups.items():
|
||||
for dest, _name in members:
|
||||
groups.setdefault(dest, []).append(group_id)
|
||||
for dest, name in members:
|
||||
chains.setdefault(dest, {}).setdefault(name, []).append(group_id)
|
||||
|
||||
def keys_of(dest: str, name: str) -> list[str]:
|
||||
return [k for k in slot_mod.slot_lookup_keys(dest, name) if k in claims]
|
||||
|
||||
def ranked(dest: str) -> bool:
|
||||
return any(rank is not None for name in chains.get(dest, {})
|
||||
for key in keys_of(dest, name)
|
||||
for claim in claims[key].values() for rank in claim["ranks"])
|
||||
|
||||
# Every group of such a destination: one where it stays keeps it.
|
||||
written: set[str] = set()
|
||||
for members in region_groups.values():
|
||||
if any(ranked(member) for member, _name in members):
|
||||
written.update(member for member, _name in members if member in keyed)
|
||||
fields: dict[str, dict] = {}
|
||||
for dest in sorted(written):
|
||||
written.update(member for member, name in members
|
||||
if any(keys_of(member, other) for other in chains[member]))
|
||||
|
||||
def chain(dest: str, name: str, group_ids: list[str]) -> dict:
|
||||
kept: list[dict] = []
|
||||
for key in keyed[dest]:
|
||||
for key in keys_of(dest, name):
|
||||
by_emulator = {
|
||||
emulator: {
|
||||
"ranks": claim["ranks"],
|
||||
@@ -190,5 +186,11 @@ def _slot_fields(
|
||||
}
|
||||
if not kept or kept[-1] != by_emulator:
|
||||
kept.append(by_emulator)
|
||||
fields[dest] = {"groups": sorted(groups[dest]), "keys": kept}
|
||||
return {"groups": sorted(group_ids), "keys": kept}
|
||||
|
||||
fields: dict[str, dict] = {}
|
||||
for dest in sorted(written):
|
||||
first, *others = [chain(dest, name, group_ids)
|
||||
for name, group_ids in chains[dest].items()]
|
||||
fields[dest] = {**first, **({"also": others} if others else {})}
|
||||
return fields
|
||||
@@ -773,7 +773,7 @@ def _semantic_standalone_checks(path: Path, layouts: object) -> list[str]:
|
||||
out.append(f"{where}: its builds differ from standalone_builds in {listed.name}")
|
||||
held = {
|
||||
copy.get("sha1")
|
||||
for entry in [*manifest.get("files", []), *manifest.get("truth_files", [])]
|
||||
for entry in [*manifest.get("files", []), *(manifest.get("truth_files") or [])]
|
||||
for copy in [entry, *entry.get("alternatives", []), *entry.get("slot_choices", [])]
|
||||
}
|
||||
missing = sorted({
|
||||
|
||||
@@ -4587,6 +4587,12 @@ class EveryToolRefusesAFlagItWouldDrop(unittest.TestCase):
|
||||
["--find", "0" * 40, "--check"],
|
||||
["--find", "0" * 40, "--list-systems"],
|
||||
["--find", "0" * 40, "--json", "--events"],
|
||||
["--find", "0" * 40, "--json", "--pack", "tmp/"],
|
||||
["--find", "0" * 40, "--json", "--add-app"],
|
||||
["--find", "0" * 40, "--json", "--standalone-copies"],
|
||||
["--find", "0" * 40, "--json", "--romm-firmware", "{platform}/bios"],
|
||||
["--find", "0" * 40, "--json", "--from", "tmp"],
|
||||
["--find", "0" * 40, "--pack", "tmp/"],
|
||||
["--find", "not-a-hash"],
|
||||
["--find", "0" * 12],
|
||||
],
|
||||
|
||||
@@ -7194,7 +7194,7 @@ class TheInstallerPageIsWrittenFromTheCode(unittest.TestCase):
|
||||
self.scratch.read_text(encoding="utf-8"))
|
||||
|
||||
def test_the_exit_codes_are_the_ones_install_py_exits_with(self):
|
||||
self.assertEqual(self.generator.exit_codes(), [0, 1, 2, 3, 130, 141])
|
||||
self.assertEqual(self.generator.exit_codes(), [0, 1, 2, 3, 4, 130, 141])
|
||||
|
||||
def test_a_missing_marker_stops_it(self):
|
||||
page = self.scratch.read_text(encoding="utf-8")
|
||||
|
||||
@@ -145,6 +145,22 @@ class RealListParity(unittest.TestCase):
|
||||
self.assert_same(plat, files, self.packed(
|
||||
plat, one_per_slot=True, target_cores=set(cores), target_name=target))
|
||||
|
||||
def test_one_per_slot_with_installed_cores(self):
|
||||
"""--installed-cores ranks a slot by the cores found, as a pack built
|
||||
for exactly those cores (generate_pack target_cores) ranks it: the
|
||||
run passes the found cores as its reach (slot_reach)."""
|
||||
from common import load_target_config
|
||||
|
||||
for plat, target in (("retroarch", "switch"), ("retroarch", "playstation-psp")):
|
||||
with self.subTest(platform=plat, cores=target):
|
||||
found = sorted(load_target_config(plat, target, str(REPO_ROOT / "platforms")))
|
||||
full = self.manifest(plat)
|
||||
files, omitted = install.narrow_to_cores(full, found)
|
||||
files, _omitted = install.one_per_slot(
|
||||
files, omitted, install.designated_cores(full, found))
|
||||
self.assert_same(plat, files, self.packed(
|
||||
plat, one_per_slot=True, target_cores=set(found)))
|
||||
|
||||
def test_source_truth(self):
|
||||
for plat in self.platforms:
|
||||
with self.subTest(platform=plat):
|
||||
@@ -277,6 +293,41 @@ class TheSlotRuleIsTheBuilders(unittest.TestCase):
|
||||
for name in entries]
|
||||
self.assertEqual(self.drops(listed, reach), expected)
|
||||
|
||||
@unittest.skipIf(sys.version_info < (3, 9), "slot.py needs Python 3.9 or newer")
|
||||
def test_a_destination_two_groups_name_apart(self):
|
||||
"""One destination a platform declares under one name and a core
|
||||
under another: each group looks its own name up, as the builder
|
||||
does (slot.lookup_slot per member), whatever cores the board runs."""
|
||||
import random
|
||||
|
||||
import manifestselect
|
||||
import slot as slot_mod
|
||||
|
||||
rng = random.Random(11)
|
||||
for _round in range(400):
|
||||
profiles: dict = {}
|
||||
groups: dict[str, list[tuple[str, str]]] = {"sysa": [], "sysb": []}
|
||||
dests = [f"sub/f{index}.bin" for index in range(rng.randint(2, 5))]
|
||||
for index, dest in enumerate(dests):
|
||||
names = {"sysa": f"a{index}.bin",
|
||||
"sysb": rng.choice([f"a{index}.bin", f"b{index}.bin"])}
|
||||
for group, name in names.items():
|
||||
groups[group].append((dest, name))
|
||||
for name in set(names.values()):
|
||||
for emulator in rng.sample(["ds", "pcsx"], rng.randint(1, 2)):
|
||||
profiles.setdefault(emulator, {"files": []})["files"].append(
|
||||
{"name": name, "priority": rng.choice([None, 1, 2, 3])})
|
||||
reach = set(rng.sample(sorted(profiles), rng.randint(1, len(profiles))))
|
||||
index_ = slot_mod.build_slot_index({k: v for k, v in profiles.items()
|
||||
if k in reach})
|
||||
expected, _undecided = slot_mod.resolve_slot_drops(groups, index_, set(dests))
|
||||
fields = manifestselect._slot_fields(groups, slot_mod.slot_claims(profiles))
|
||||
listed = [_copy(dest, dest.encode(), **({"slot": fields[dest]}
|
||||
if dest in fields else {}))
|
||||
for dest in dests]
|
||||
with self.subTest(round=_round):
|
||||
self.assertEqual(self.drops(listed, reach), expected)
|
||||
|
||||
|
||||
class Lists(unittest.TestCase):
|
||||
"""A list written for the runs below, in tmp/."""
|
||||
@@ -342,7 +393,7 @@ class FindByHash(Lists):
|
||||
|
||||
def found(self, value: str) -> dict:
|
||||
proc = self.run_install(LIST, "--find", value, "--json")
|
||||
self.assertIn(proc.returncode, (0, 2), proc.stderr)
|
||||
self.assertIn(proc.returncode, (0, 4), proc.stderr)
|
||||
return json.loads(proc.stdout)
|
||||
|
||||
def test_each_kind(self):
|
||||
@@ -362,18 +413,52 @@ class FindByHash(Lists):
|
||||
self.assertEqual(list(said), ["schema", "platform", "hash", "kind", "result",
|
||||
"matches"])
|
||||
self.assertEqual(said["schema"], 1)
|
||||
self.assertEqual(list(said["matches"][0]), ["dest", "root", "sha1", "sha256", "md5",
|
||||
"size", "systems", "cores"])
|
||||
# Every key in every match, null where the list records none: the
|
||||
# copy at scph5501.bin has an md5 and no crc32.
|
||||
for match in said["matches"]:
|
||||
self.assertEqual(list(match), ["dest", "root", "sha1", "sha256", "md5", "crc32",
|
||||
"size", "systems", "cores"])
|
||||
self.assertIsNone(match["crc32"])
|
||||
self.assertIsNone(match["root"])
|
||||
crc = self.found(LIST["files"][4]["sha1"])["matches"][0]
|
||||
self.assertEqual((crc["md5"], crc["crc32"], crc["systems"]), (None, "aaaaaaaa", None))
|
||||
|
||||
def test_a_hash_with_no_one_file_has_its_own_code(self):
|
||||
"""unknown, ambiguous and unrecorded end on 4, never on the 2 of an
|
||||
option refused, so a script can tell a typo from a missing file."""
|
||||
bare = copy.deepcopy(LIST)
|
||||
for entry in bare["files"]:
|
||||
entry.pop("md5", None)
|
||||
for manifest, value in ((LIST, "0" * 40), (LIST, "aaaaaaaa"), (bare, "1" * 32)):
|
||||
for json_too in ((), ("--json",)):
|
||||
with self.subTest(value=value, json=bool(json_too)):
|
||||
proc = self.run_install(manifest, "--find", value, "--dry-run"
|
||||
if not json_too else "--json")
|
||||
self.assertEqual(proc.returncode, 4, proc.stdout + proc.stderr)
|
||||
typo = self.run_install(LIST, "--find", "0" * 39)
|
||||
self.assertEqual(typo.returncode, 2)
|
||||
|
||||
def test_the_options_a_find_skips_are_refused(self):
|
||||
sha1 = LIST["files"][0]["sha1"]
|
||||
for extra in (["--pack", str(self.root / "out") + "/"], ["--add-app"],
|
||||
["--standalone-copies"], ["--romm-firmware", "{platform}/bios"],
|
||||
["--from", str(self.root)]):
|
||||
for json_too in ((), ("--json",)):
|
||||
with self.subTest(extra=extra, json=bool(json_too)):
|
||||
proc = self.run_install(LIST, "--find", sha1, *json_too, *extra)
|
||||
self.assertEqual(proc.returncode, 2, proc.stdout + proc.stderr)
|
||||
self.assertIn(f"which {extra[0]} does not apply to", proc.stderr)
|
||||
self.assertEqual(proc.stdout.strip(), "")
|
||||
|
||||
def test_unknown_ambiguous_and_unrecorded(self):
|
||||
unknown = self.run_install(LIST, "--find", "0" * 40, "--json")
|
||||
self.assertEqual(unknown.returncode, 2)
|
||||
self.assertEqual(unknown.returncode, 4)
|
||||
self.assertEqual(json.loads(unknown.stdout)["result"], "unknown")
|
||||
for value, words in (("0" * 40, "no file of the retroarch list has the sha1"),
|
||||
("aaaaaaaa", "2 files of the retroarch list have the crc32")):
|
||||
with self.subTest(value=value):
|
||||
proc = self.run_install(LIST, "--find", value, "--dry-run")
|
||||
self.assertEqual(proc.returncode, 2, proc.stdout + proc.stderr)
|
||||
self.assertEqual(proc.returncode, 4, proc.stdout + proc.stderr)
|
||||
self.assertIn(words, proc.stderr)
|
||||
bare = copy.deepcopy(LIST)
|
||||
for entry in bare["files"]:
|
||||
@@ -407,6 +492,22 @@ class ExpertRuns(Lists):
|
||||
said = self.plan(LIST, "--emulator", "duckstation", "--standalone")
|
||||
self.assertIn("ds/scph5501.bin", said)
|
||||
|
||||
def test_installed_cores_rank_a_slot_by_themselves(self):
|
||||
"""With pcsx_rearmed ranking scph1001 first and DuckStation last, the
|
||||
whole list cannot decide the slot. Only DuckStation installed, its
|
||||
order decides, as a pack built for it alone does."""
|
||||
ranked = copy.deepcopy(LIST)
|
||||
ranked["files"][0]["slot"] = _slot(_claims(duckstation=10, pcsx_rearmed=1))
|
||||
ranked["files"][1]["slot"] = _slot(_claims(duckstation=5, pcsx_rearmed=2))
|
||||
cores = self.root / "cores"
|
||||
cores.mkdir()
|
||||
(cores / "duckstation_libretro.so").write_bytes(b"")
|
||||
whole = self.plan(ranked, "--one-per-slot")
|
||||
self.assertIn("scph1001.bin", whole)
|
||||
installed = self.plan(ranked, "--one-per-slot", "--cores-dir", str(cores))
|
||||
self.assertNotIn("scph1001.bin", installed)
|
||||
self.assertIn("scph5501.bin", installed)
|
||||
|
||||
def test_a_list_without_the_fields_is_refused(self):
|
||||
older = copy.deepcopy(LIST)
|
||||
for field in ("slot_fields", "truth_files", "truth_omitted", "standalone_builds"):
|
||||
@@ -436,6 +537,26 @@ class ExpertRuns(Lists):
|
||||
with self.assertRaises(ValueError):
|
||||
install._validate_manifest(bad, "retroarch")
|
||||
install._validate_manifest(copy.deepcopy(LIST), "retroarch")
|
||||
# A claim that is no object says the list is not valid, never TypeError.
|
||||
for claim in (None, 3, True, ["ranks"]):
|
||||
with self.subTest(claim=claim):
|
||||
bad = copy.deepcopy(LIST)
|
||||
bad["files"][0]["slot"] = {"groups": ["s"], "keys": [{"ds": claim}]}
|
||||
with self.assertRaises(ValueError):
|
||||
install._validate_manifest(bad, "retroarch")
|
||||
# A truth-only omission is checked as any omission.
|
||||
omission = {"dest": "gone.bin", "name": "gone.bin", "system": "s", "required": True,
|
||||
"reason": "not_found", "cores": None}
|
||||
for field, value in (("alternatives", [{"cores": "ds"}]), ("slot", {"groups": []}),
|
||||
("truth", True), ("systems", "s")):
|
||||
with self.subTest(truth_omitted=field):
|
||||
bad = copy.deepcopy(LIST)
|
||||
bad["truth_omitted"] = [{**omission, field: value}]
|
||||
with self.assertRaises(ValueError):
|
||||
install._validate_manifest(bad, "retroarch")
|
||||
good = copy.deepcopy(LIST)
|
||||
good["truth_omitted"] = [omission]
|
||||
install._validate_manifest(good, "retroarch")
|
||||
for broken in ([["../x.bin", LAYOUTS["standalone_layouts"]["duckstation"][0][1]]],
|
||||
[["ds/x.bin", "0" * 40]]):
|
||||
with self.subTest(layout=broken):
|
||||
@@ -447,6 +568,38 @@ class ExpertRuns(Lists):
|
||||
install._check_standalone_layouts({**LAYOUTS, "standalone_layouts": {}},
|
||||
LIST, "retroarch")
|
||||
|
||||
def test_a_null_truth_list_reads_as_none(self):
|
||||
"""truth_files: null is no list: --standalone takes its copies from
|
||||
the files alone, the schema check too, and --source truth refuses
|
||||
the list as one that records nothing of it."""
|
||||
nulled = {**copy.deepcopy(LIST), "truth_files": None}
|
||||
del nulled["truth_omitted"]
|
||||
install._validate_manifest(copy.deepcopy(nulled), "retroarch")
|
||||
entries = install.standalone_entries(nulled, LAYOUTS["standalone_layouts"],
|
||||
"duckstation")
|
||||
self.assertEqual([entry["dest"] for entry in entries], ["ds/scph5501.bin"])
|
||||
said = self.plan(nulled, "--emulator", "duckstation", "--standalone")
|
||||
self.assertIn("ds/scph5501.bin", said)
|
||||
proc = self.run_install(nulled, "--dry-run", "--source", "truth")
|
||||
self.assertEqual(proc.returncode, 1, proc.stdout + proc.stderr)
|
||||
self.assertIn("which --source truth needs", proc.stderr)
|
||||
|
||||
@unittest.skipIf(sys.version_info < (3, 9), "validate_schemas.py needs Python 3.9 or newer")
|
||||
def test_the_schema_check_reads_a_null_truth_list(self):
|
||||
from unittest import mock
|
||||
|
||||
import validate_schemas
|
||||
|
||||
with tempfile.TemporaryDirectory(dir=REPO_ROOT / "tmp") as root:
|
||||
(Path(root) / "install" / "standalone").mkdir(parents=True)
|
||||
(Path(root) / "install" / "retroarch.json").write_text(
|
||||
json.dumps({**LIST, "truth_files": None}), encoding="utf-8")
|
||||
path = Path(root) / "install" / "standalone" / "retroarch.json"
|
||||
path.write_text(json.dumps(LAYOUTS), encoding="utf-8")
|
||||
with mock.patch.object(validate_schemas, "ROOT", Path(root)):
|
||||
self.assertEqual(validate_schemas._semantic_standalone_checks(path, LAYOUTS),
|
||||
[])
|
||||
|
||||
def test_a_layout_file_missing_or_unreachable_refuses_on_one_line(self):
|
||||
"""Only --standalone reads the file: a list without it beside still
|
||||
installs everything else, and --standalone stops on one line."""
|
||||
@@ -530,6 +683,31 @@ class ChangeRows(unittest.TestCase):
|
||||
self.assertNotIn("standalone", self.actions(state))
|
||||
self.assertNotIn(("--standalone", None), install.tui_flags(state))
|
||||
|
||||
def test_standalone_only_beside_no_other_narrowing(self):
|
||||
"""The CLI refuses --standalone beside --region, --core and
|
||||
--system: the row is not offered with one, and a choice made after
|
||||
it turns it off, said in one line."""
|
||||
for choice in ("regions", "cores", "systems"):
|
||||
with self.subTest(choice=choice):
|
||||
state = self.state(LIST)
|
||||
state.emulators = ["duckstation"]
|
||||
state.standalone = True
|
||||
self.assertIn(("--standalone", None), install.tui_flags(state))
|
||||
if choice == "regions":
|
||||
state.regions = ["japan"]
|
||||
elif choice == "cores":
|
||||
state.cores = ["duckstation"]
|
||||
else:
|
||||
state.cli_systems = ["sony-playstation"]
|
||||
self.assertNotIn("standalone", self.actions(state))
|
||||
self.assertNotIn(("--standalone", None), install.tui_flags(state))
|
||||
install.tui_update(state, install.TuiKey("down"))
|
||||
self.assertFalse(state.standalone)
|
||||
self.assertEqual(state.status, install.TUI_STANDALONE_OFF)
|
||||
argv = install.tui_argv(state, "install", "python", "install.py")
|
||||
args = install.build_parser().parse_args(argv[2:])
|
||||
self.assertFalse(args.standalone)
|
||||
|
||||
def test_no_row_on_a_list_without_the_fields(self):
|
||||
older = {key: value for key, value in LIST.items()
|
||||
if key not in ("slot_fields", "standalone_builds")}
|
||||
|
||||
+9
-5
@@ -1297,15 +1297,18 @@ sha1), on the real list of every registered platform.
|
||||
{"schema": 1, "platform": "retroarch", "hash": "<the hash, lower case>",
|
||||
"kind": "sha1", "result": "found",
|
||||
"matches": [{"dest": "scph5501.bin", "root": null, "sha1": "...",
|
||||
"sha256": "...", "size": 524288,
|
||||
"sha256": "...", "md5": null, "crc32": null, "size": 524288,
|
||||
"systems": ["sony-playstation"], "cores": null}]}
|
||||
```
|
||||
|
||||
`kind` is `sha1`, `sha256`, `md5` or `crc32`, read from the length.
|
||||
`result` is `found` (one content), `ambiguous` (two contents share the
|
||||
hash), `unknown`, or `unrecorded` when the list records no hash of that
|
||||
kind. A match carries `md5` or `crc32` too where the list does. New keys
|
||||
may come, existing ones keep their meaning.
|
||||
kind. Every match carries every key above, `null` where the list records
|
||||
none. New keys may come, existing ones keep their meaning. The published
|
||||
lists carry no md5 and no crc32 yet, so those two kinds answer `unrecorded`
|
||||
until they do. A `result` other than `found` ends on code 4, with or without
|
||||
`--json`.
|
||||
|
||||
A list published before these options lacks what they read, and the run
|
||||
stops on it with code 1 rather than install the whole list. None of them is
|
||||
@@ -1337,8 +1340,8 @@ option takes the recorded choice whole.
|
||||
| <span id="option-one-per-slot"></span>`--one-per-slot` | Keep one BIOS per console and region, the one the emulators' own search order (`priority:`, lower first) ranks first, as `generate_pack.py --one-per-slot` does. A slot with an unranked candidate, or a candidate two cores rank apart, keeps all of them. Decided over the whole list, by the board's cores on a board: refused with `--system`, `--emulator`, `--for-games`, `--declared-only` and the listings. See [One level further](#one-level-further) |
|
||||
| <span id="option-standalone"></span>`--standalone` | With `--emulator`: that emulator's standalone build, at the paths it reads, beside the platform's own BIOS of its systems, as `generate_pack.py --emulator NAME --standalone` packs it. The layouts come from `install/standalone/<platform>.json`, fetched only for this option. An emulator without a standalone build is refused, and so are `--region`, `--one-per-slot`, `--core` and `--system` beside it |
|
||||
| <span id="option-source"></span>`--source SOURCE` | `truth`: only what the emulator profiles prove a core reads, as `generate_pack.py --source truth` packs it. `full`, the default, is the platform's list and what its cores read. `truth` takes no other choice, opens no full screen, and is refused on a list published before it |
|
||||
| <span id="option-find"></span>`--find HASH` | Install the one BIOS of the list with this content: a sha1 or sha256 always, an md5 or crc32 where the list records it. A content at several destinations is installed at each. A hash two contents share is named and refused, as is one the list lacks. Takes no other choice |
|
||||
| <span id="option-json"></span>`--json` | With `--find`: print the matches as one JSON object per platform and install nothing. The shape is in [One level further](#one-level-further). Exit code 0 when found, 2 otherwise |
|
||||
| <span id="option-find"></span>`--find HASH` | Install the one BIOS of the list with this content: a sha1 or sha256 always, an md5 or crc32 where the list records it. A content at several destinations is installed at each. A hash two contents share is named and refused, as is one the list lacks, code 4. The published lists carry no md5 and no crc32 yet: those kinds answer that the list records none. Takes no other choice, and refuses `--pack`, `--add-app`, `--standalone-copies`, `--romm-firmware` and `--from` |
|
||||
| <span id="option-json"></span>`--json` | With `--find`: print the matches as one JSON object per platform and install nothing. The shape is in [One level further](#one-level-further). Exit code 0 when found, 4 otherwise |
|
||||
| <span id="option-list-systems"></span>`--list-systems` | Print a platform's systems with the files and size each holds, the files other systems share too counted apart. `--system`, `--core`, `--region`, `--target` and `--installed-cores` narrow it, as they narrow an install. A run prints one list: two listing options are refused |
|
||||
| <span id="option-list-cores"></span>`--list-cores` | Print the cores whose extra files a platform installs. The options that narrow `--list-systems` narrow it too |
|
||||
| <span id="option-list-emulators"></span>`--list-emulators` | Print every name `--emulator` accepts, each buildbot name beside the emulator it stands for. `--target` and `--installed-cores` narrow it, and `--system`, `--core`, `--region` and `--emulator` are refused |
|
||||
@@ -2163,6 +2166,7 @@ fields, the installer refuses to narrow rather than install everything.
|
||||
| `1` | a failure: the one-liner could not download or verify `install.py`, or found no Python 3.8 with its ssl, unicodedata and zlib modules (nothing was run), an unusable base URL, `--installed-cores` with no core found, a manifest that fails validation, a fetch that never succeeded, no platform to install for in a non-interactive run, some files failed or were left out by `--offline` while others installed, a `--from-pack` pack that cannot be read, lacks a part or is for another platform, a `--from` folder that does not exist or cannot be read, a BIOS folder that is a file or lies under one, a `--dest` that is not the card of the system named (another system's card, a folder inside one, a drive with none of its files where its card always has them, or a folder that does not exist), `--restore` could not put a file back, `--remove` or `--delete-backup` could not delete a file or update the install record, `--pack` could not get a file or write the pack (nothing is left behind), or `--add-app` could not put every file of the app on the card |
|
||||
| `2` | nothing was installed: every file the run tried failed (a BIOS folder that cannot be written, for one), or `--offline` left every file out, the drive has too little free space for the download (checked before any folder is created), or the question about a folder that does not exist, named with `--dest` or typed at the folder question, was answered no. Also an option the installer refused before any download: an unknown option, `--jobs` outside 1 to 32, `--target` with `--every-board`, `--target` with `--from-pack` or `--offline` (or `RETROBIOS_INSTALL_OFFLINE` set) when no core list per board is at hand (the pack carries none and none is beside `--manifest` as `targets/<platform>.json`), or for a platform that publishes none, which is said to have no hardware targets, `--list-targets` with `--offline` and neither, `--add-app` with `--check`, `--dry-run`, a listing, `--from-pack` or `--offline`. The message then starts with `install.py: error:`. Also an unknown platform, target, system, core or emulator, said in an `Error:` or `Unknown platform` line and an `error` event whose `stage` is `option`. Also `--add-app` for a folder on no card that takes the app, said in an `Error:` line and an `app` event before anything is written. With `--restore` or `--delete-backup`, a folder that is not a dated folder inside `retrobios-backup`. With `--pack`, no pack tried: a choice that keeps no file, a file larger than a part of `--split`, too little room, or `--pack` with an option that reads the BIOS folder of this machine. With `--remove`, nothing removed: no install record of the setup, nothing it can remove, no `--yes` without a terminal, or no at its question, and the same for `--delete-backup`. Also a quit chosen before the install, as `gh` ends a cancelled prompt: `q` at a question, `q` or **Quit** on the full screen, which then keeps `RetroBIOS: quit. Nothing was installed.`, and the full screen closed with no button pressed (`RETROBIOS_IDLE_EXIT`). No code but `0` closes a Windows Terminal tab started on the installer itself, so such a tab stays open on a quit |
|
||||
| `3` | `--check` ran and found files to fetch or wrong copies, nothing having failed. A failure takes `1` as before: a manifest refused, a `--from` folder that does not exist. Until November 2026 this case also ended on `1`, so a script that reads any code but `0` as "not ready" needs no change |
|
||||
| `4` | `--find` read the hash and the list holds no one file for it: none has it (`unknown`), two contents share it (`ambiguous`), or the list records no hash of that kind (`unrecorded`). With `--json` the `result` key says which, and nothing is installed |
|
||||
| `130` | stopped with Ctrl+C, or with Ctrl+C or Ctrl+D at a question, the terminal keeping `RetroBIOS: stopped. Nothing was installed.` before an install. Run the same command again to carry on |
|
||||
| `141` | the output was piped to a reader that closed early (`--list-platforms \| head`) |
|
||||
|
||||
|
||||
Reference in new issue
Block a user