diff --git a/install.ps1 b/install.ps1 index d87148530..d72d3b754 100644 --- a/install.ps1 +++ b/install.ps1 @@ -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 = "13b42cf02602fe7cfee80ce9ed25544c6e8ff1c51feb0d62e4dc07e81eeaf951" + $defaultInstallSha256 = "c11b53d8f9bcb1f054566643447631304c2d8924cd42689669d471bb66542d4a" # 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 diff --git a/install.py b/install.py index 1ca123d06..f6f8a4ee6 100644 --- a/install.py +++ b/install.py @@ -20305,8 +20305,9 @@ def _record_after_removal(removal: Removal, removed: list[dict]) -> str: return _update_record(removal.folder, removal.plat, change) -def _named_files(values: Iterable[Path], folder: Path) -> list[str] | None: - """The --file values as dests below folder, None for one outside it.""" +def _named_files(values: Iterable[Path], folder: Path) -> tuple[list[str], str]: + """The --file values as dests below folder, and why nothing is removed + when one is outside it, else "".""" files = [] for value in values: given = Path(os.path.expanduser(str(value))) @@ -20314,16 +20315,17 @@ def _named_files(values: Iterable[Path], folder: Path) -> list[str] | None: try: given = Path(os.path.abspath(given)).relative_to(folder) except ValueError: - print(f"Error: {value} is not inside {shown_path(folder)}: --file names a " - "file of the BIOS folder.", file=sys.stderr) - return None + return [], (f"Error: {value} is not inside {shown_path(folder)}: --file " + "names a file of the BIOS folder.") files.append(PurePosixPath(*given.parts).as_posix()) - return files + return files, "" def _removal_refused(plat: str, folder: Path, message: str, backup: bool) -> int: """A removal that touches nothing: the reason said and sent, exit 2.""" print(message, file=sys.stderr) + if message.startswith("Error: "): + message = message[len("Error: "):] EVENTS.emit("removal_plan", platform=plat, folder=str(folder), files=0, bytes=0, systems=[], dests=[], kept=[], gone=0, backup=backup, message=message) @@ -20401,16 +20403,16 @@ def _print_removal_plan(args: argparse.Namespace, removal: Removal, by_hand: lis print(f" {rel}") -def _removal_answer(args: argparse.Namespace) -> int | None: +def _removal_answer(args: argparse.Namespace, plat: str) -> int | None: """The exit code when the plan stops before removing, None to go on.""" if args.dry_run: print("Nothing was removed (--dry-run).") return 0 if not args.yes: if args.no_input or not sys.stdin.isatty(): - print("Error: removing files needs a yes: add --yes to remove them without " - "a question, or --dry-run to list them.", file=sys.stderr) - return 2 + raise Refusal("option", "needs_yes", plat, + "Error: removing files needs a yes: add --yes to remove them " + "without a question, or --dry-run to list them.", code=2) question = ("Move them to a backup? [y/N] " if args.backup else "Remove them for good? [y/N] ") if not _answer_yes(question): @@ -20478,9 +20480,9 @@ def run_removal(args: argparse.Namespace) -> int: manifest, every, omitted)), "emulator") if args.emulator else [] except ValueError as exc: refuse_name(plat, f"Error: {plat}: {exc}") - files = _named_files(args.file or [], folder) - if files is None: - return 2 + files, outside = _named_files(args.file or [], folder) + if outside: + return _removal_refused(plat, folder, outside, bool(args.backup)) misplaced = bool(getattr(args, "misplaced", False)) if misplaced: others, message = _misplaced_others(plat, folder, read.dropped, read.data["setups"]) @@ -20507,7 +20509,7 @@ def run_removal(args: argparse.Namespace) -> int: if not removal.remove: # The record keeps what it says until a removal is confirmed. return 2 - stop = _removal_answer(args) + stop = _removal_answer(args, plat) if stop is not None: return stop KEPT.reset() @@ -20591,9 +20593,9 @@ def run_delete_backup(args: argparse.Namespace) -> int: 0 done, 1 a file failed, 2 refused or declined.""" run = Path(os.path.abspath(os.path.expanduser(str(args.delete_backup)))) if not _is_backup_run(run): - print(f"Error: {run} is not a folder the installer kept files in.", file=sys.stderr) - print(" Name one of the dated folders --backups lists.", file=sys.stderr) - return 2 + raise Refusal("backup", "not_a_backup", "", + f"Error: {run} is not a folder the installer kept files in.", + " Name one of the dated folders --backups lists.", code=2) files = _backup_files(run) size = sum(path.stat().st_size for path in files) date = _backup_date(run) @@ -20605,9 +20607,9 @@ def run_delete_backup(args: argparse.Namespace) -> int: return 0 if not args.yes: if args.no_input or not sys.stdin.isatty(): - print("Error: deleting a backup needs a yes: add --yes to delete it without " - "a question.", file=sys.stderr) - return 2 + raise Refusal("option", "needs_yes", "", + "Error: deleting a backup needs a yes: add --yes to delete it " + "without a question.", code=2) if not _answer_yes("Delete it for good? [y/N] "): print("Nothing was deleted.") return QUIT_CODE @@ -20662,23 +20664,21 @@ def _action_setup(args: argparse.Namespace) -> tuple[str, Path]: setups = sorted((load_record(folder).data or {}).get("setups") or {}) if len(setups) == 1: return setups[0], folder - print(f"Error: name the setup of {shown_path(folder)} with --platform" - + (f": {', '.join(setups)}." if setups else "."), file=sys.stderr) - sys.exit(2) + raise Refusal("detect", "conflict" if setups else "not_found", "", + f"Error: name the setup of {shown_path(folder)} with --platform" + + (f": {', '.join(setups)}." if setups else "."), code=2) found = [(name, path) for name, path in detect_platforms(detect_os()) if not plat or name == plat] if len(found) == 1: return found[0][0], Path(os.path.abspath(found[0][1])) if not found: - print("Error: no setup found here: name its BIOS folder with --dest" - + ("." if plat else " and its setup with --platform."), file=sys.stderr) - else: - print("Error: several setups found here: name one with --platform and --dest.", - file=sys.stderr) - for name, path in found: - print(f" --platform {name} --dest {_INVOCATION.word(str(path))}", - file=sys.stderr) - sys.exit(2) + raise Refusal("detect", "not_found", plat, + "Error: no setup found here: name its BIOS folder with --dest" + + ("." if plat else " and its setup with --platform."), code=2) + raise Refusal("detect", "conflict", plat, + "Error: several setups found here: name one with --platform and --dest.", + *(f" --platform {name} --dest {_INVOCATION.word(str(path))}" + for name, path in found), code=2) # --- installer/space.py ------------------------------------------------------ diff --git a/install.sh b/install.sh index ecfa87a89..6cd12e0f4 100755 --- a/install.sh +++ b/install.sh @@ -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="13b42cf02602fe7cfee80ce9ed25544c6e8ff1c51feb0d62e4dc07e81eeaf951" +DEFAULT_INSTALL_SHA256="c11b53d8f9bcb1f054566643447631304c2d8924cd42689669d471bb66542d4a" # 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 diff --git a/install/launchers/index.json b/install/launchers/index.json index f3dcebd1d..661a84418 100644 --- a/install/launchers/index.json +++ b/install/launchers/index.json @@ -27,8 +27,8 @@ { "dest": "roms/ports/retrobios/install.py", "repo_path": "install.py", - "size": 1469751, - "sha256": "13b42cf02602fe7cfee80ce9ed25544c6e8ff1c51feb0d62e4dc07e81eeaf951", + "size": 1470129, + "sha256": "c11b53d8f9bcb1f054566643447631304c2d8924cd42689669d471bb66542d4a", "executable": false }, { @@ -71,8 +71,8 @@ "muos": { "archive": { "dest": "ARCHIVE/RetroBIOS.muxapp", - "size": 1523376, - "sha256": "6b2cc39e6a0e6df85c758c31a63c0d24e77a3a5894e95fac4f6047894306b092" + "size": 1523754, + "sha256": "f87b0a2ad83db699b7cd44b39fdbc82bb77cc1f10b2dfb306e15b6958910971a" }, "members": [ { @@ -92,8 +92,8 @@ { "name": "RetroBIOS/install.py", "repo_path": "install.py", - "size": 1469751, - "sha256": "13b42cf02602fe7cfee80ce9ed25544c6e8ff1c51feb0d62e4dc07e81eeaf951", + "size": 1470129, + "sha256": "c11b53d8f9bcb1f054566643447631304c2d8924cd42689669d471bb66542d4a", "executable": false }, { @@ -166,8 +166,8 @@ { "dest": ".config/modules/retrobios/install.py", "repo_path": "install.py", - "size": 1469751, - "sha256": "13b42cf02602fe7cfee80ce9ed25544c6e8ff1c51feb0d62e4dc07e81eeaf951", + "size": 1470129, + "sha256": "c11b53d8f9bcb1f054566643447631304c2d8924cd42689669d471bb66542d4a", "executable": false }, { diff --git a/installer/removal.py b/installer/removal.py index a48581bd7..fc4131106 100644 --- a/installer/removal.py +++ b/installer/removal.py @@ -42,6 +42,7 @@ from installer.narrowing import designated_cores from installer.network import _fetch_json from installer.paths import shown_path, spelled from installer.platforms import display_name, entry_systems, normalize_platform, refuse_name, system_title +from installer.refusal import Refusal from installer.remote import MAX_MANIFEST_BYTES, active_remote from installer.safe_replace import ( BACKUP_DIR, @@ -628,8 +629,9 @@ def _record_after_removal(removal: Removal, removed: list[dict]) -> str: return _update_record(removal.folder, removal.plat, change) -def _named_files(values: Iterable[Path], folder: Path) -> list[str] | None: - """The --file values as dests below folder, None for one outside it.""" +def _named_files(values: Iterable[Path], folder: Path) -> tuple[list[str], str]: + """The --file values as dests below folder, and why nothing is removed + when one is outside it, else "".""" files = [] for value in values: given = Path(os.path.expanduser(str(value))) @@ -637,16 +639,17 @@ def _named_files(values: Iterable[Path], folder: Path) -> list[str] | None: try: given = Path(os.path.abspath(given)).relative_to(folder) except ValueError: - print(f"Error: {value} is not inside {shown_path(folder)}: --file names a " - "file of the BIOS folder.", file=sys.stderr) - return None + return [], (f"Error: {value} is not inside {shown_path(folder)}: --file " + "names a file of the BIOS folder.") files.append(PurePosixPath(*given.parts).as_posix()) - return files + return files, "" def _removal_refused(plat: str, folder: Path, message: str, backup: bool) -> int: """A removal that touches nothing: the reason said and sent, exit 2.""" print(message, file=sys.stderr) + if message.startswith("Error: "): + message = message[len("Error: "):] EVENTS.emit("removal_plan", platform=plat, folder=str(folder), files=0, bytes=0, systems=[], dests=[], kept=[], gone=0, backup=backup, message=message) @@ -724,16 +727,16 @@ def _print_removal_plan(args: argparse.Namespace, removal: Removal, by_hand: lis print(f" {rel}") -def _removal_answer(args: argparse.Namespace) -> int | None: +def _removal_answer(args: argparse.Namespace, plat: str) -> int | None: """The exit code when the plan stops before removing, None to go on.""" if args.dry_run: print("Nothing was removed (--dry-run).") return 0 if not args.yes: if args.no_input or not sys.stdin.isatty(): - print("Error: removing files needs a yes: add --yes to remove them without " - "a question, or --dry-run to list them.", file=sys.stderr) - return 2 + raise Refusal("option", "needs_yes", plat, + "Error: removing files needs a yes: add --yes to remove them " + "without a question, or --dry-run to list them.", code=2) question = ("Move them to a backup? [y/N] " if args.backup else "Remove them for good? [y/N] ") if not _answer_yes(question): @@ -801,9 +804,9 @@ def run_removal(args: argparse.Namespace) -> int: manifest, every, omitted)), "emulator") if args.emulator else [] except ValueError as exc: refuse_name(plat, f"Error: {plat}: {exc}") - files = _named_files(args.file or [], folder) - if files is None: - return 2 + files, outside = _named_files(args.file or [], folder) + if outside: + return _removal_refused(plat, folder, outside, bool(args.backup)) misplaced = bool(getattr(args, "misplaced", False)) if misplaced: others, message = _misplaced_others(plat, folder, read.dropped, read.data["setups"]) @@ -830,7 +833,7 @@ def run_removal(args: argparse.Namespace) -> int: if not removal.remove: # The record keeps what it says until a removal is confirmed. return 2 - stop = _removal_answer(args) + stop = _removal_answer(args, plat) if stop is not None: return stop KEPT.reset() @@ -914,9 +917,9 @@ def run_delete_backup(args: argparse.Namespace) -> int: 0 done, 1 a file failed, 2 refused or declined.""" run = Path(os.path.abspath(os.path.expanduser(str(args.delete_backup)))) if not _is_backup_run(run): - print(f"Error: {run} is not a folder the installer kept files in.", file=sys.stderr) - print(" Name one of the dated folders --backups lists.", file=sys.stderr) - return 2 + raise Refusal("backup", "not_a_backup", "", + f"Error: {run} is not a folder the installer kept files in.", + " Name one of the dated folders --backups lists.", code=2) files = _backup_files(run) size = sum(path.stat().st_size for path in files) date = _backup_date(run) @@ -928,9 +931,9 @@ def run_delete_backup(args: argparse.Namespace) -> int: return 0 if not args.yes: if args.no_input or not sys.stdin.isatty(): - print("Error: deleting a backup needs a yes: add --yes to delete it without " - "a question.", file=sys.stderr) - return 2 + raise Refusal("option", "needs_yes", "", + "Error: deleting a backup needs a yes: add --yes to delete it " + "without a question.", code=2) if not _answer_yes("Delete it for good? [y/N] "): print("Nothing was deleted.") return QUIT_CODE @@ -985,20 +988,18 @@ def _action_setup(args: argparse.Namespace) -> tuple[str, Path]: setups = sorted((load_record(folder).data or {}).get("setups") or {}) if len(setups) == 1: return setups[0], folder - print(f"Error: name the setup of {shown_path(folder)} with --platform" - + (f": {', '.join(setups)}." if setups else "."), file=sys.stderr) - sys.exit(2) + raise Refusal("detect", "conflict" if setups else "not_found", "", + f"Error: name the setup of {shown_path(folder)} with --platform" + + (f": {', '.join(setups)}." if setups else "."), code=2) found = [(name, path) for name, path in detect_platforms(detect_os()) if not plat or name == plat] if len(found) == 1: return found[0][0], Path(os.path.abspath(found[0][1])) if not found: - print("Error: no setup found here: name its BIOS folder with --dest" - + ("." if plat else " and its setup with --platform."), file=sys.stderr) - else: - print("Error: several setups found here: name one with --platform and --dest.", - file=sys.stderr) - for name, path in found: - print(f" --platform {name} --dest {_INVOCATION.word(str(path))}", - file=sys.stderr) - sys.exit(2) + raise Refusal("detect", "not_found", plat, + "Error: no setup found here: name its BIOS folder with --dest" + + ("." if plat else " and its setup with --platform."), code=2) + raise Refusal("detect", "conflict", plat, + "Error: several setups found here: name one with --platform and --dest.", + *(f" --platform {name} --dest {_INVOCATION.word(str(path))}" + for name, path in found), code=2) diff --git a/tests/test_install_removal.py b/tests/test_install_removal.py index 64f9bb96c..4cb52f8ff 100644 --- a/tests/test_install_removal.py +++ b/tests/test_install_removal.py @@ -298,6 +298,25 @@ class WithoutARecord(unittest.TestCase): class Events(unittest.TestCase): + def test_a_removal_refused_says_why(self): + """--file outside the folder and a removal with no yes ended on code + 2 with the reason on stderr only: a script read end and nothing else.""" + with SharedRepository() as repo: + repo.install_both() + outside = repo.run("--remove", "--file", str(repo.root / "x.bin"), "--events") + said = repo.events(outside) + self.assertEqual(([event["event"] for event in said], outside.returncode), + (["start", "removal_plan", "end"], 2)) + self.assertEqual(said[1]["files"], 0) + self.assertIn("is not inside", said[1]["message"]) + self.assertIn("Error: ", outside.stderr) + unanswered = repo.run("--remove", "--system", "nintendo-gba", "--events") + said = repo.events(unanswered) + self.assertEqual(([event["event"] for event in said], unanswered.returncode), + (["start", "removal_plan", "error", "end"], 2)) + self.assertEqual((said[2]["stage"], said[2]["reason"]), ("option", "needs_yes")) + self.assertIn("removing files needs a yes", unanswered.stderr) + def test_every_new_kind(self): with SharedRepository() as repo: repo.install_both() diff --git a/wiki/installer.md b/wiki/installer.md index ef4ce1261..dfdb4801d 100644 --- a/wiki/installer.md +++ b/wiki/installer.md @@ -2225,7 +2225,7 @@ other schemas under `api/v1/schemas/`. | `start` | `schema`, `installer`, `mode` | First line. `schema` is 1, `installer` the identity `--version` prints, `mode` one of `install`, `check`, `dry-run`, `list` (also `--backups`), `remove` (`--remove`, `--delete-backup`), `restore`, `pack` (`--pack`, with `--dry-run` too) | | `unsearched` | `folder`, `reason`, `message` | Before `detect`, once for each folder the search for setups could not look in, this user being refused it or a read failing there (a failing card, a link that loops), or under WSL the Windows side when Windows did not answer (`folder` is then the drive mount, `/mnt`). What it would hold counts as absent, and the other places are still searched: `detect` then lists what they hold, and an empty `platforms` after an `unsearched` line means nothing was found where the installer could look. `reason` says why in words (`Permission denied`), `message` says it in a sentence | | `detect` | `os`, `os_name`, `platforms` | Once the platforms are known. `os_name` comes from `/etc/os-release`. `platforms` lists `{platform, name, bios_dir}`, and is empty when nothing supported was found | -| `error` | `stage`, `reason`, `platform`, `message` | The file list could not be read (`stage` is `manifest`): `reason` is `network`, `not_found` or `invalid`, `clock` when the server's certificate was refused and the system clock reads a date before the installer was written, `no_ca` when the machine holds no list of trusted certificates (`SSL_CERT_FILE` names one), `no_ssl` when this Python was built without its `ssl` module and cannot use HTTPS, or `offline` when `--offline` forbids the request. A `--manifest` file that cannot be read carries `reason` `unreadable`, and the standalone layout `--standalone` needs `unavailable`. A folder named with `--from` cannot be read (`stage` is `from`, `reason` `not_found`, `not_a_folder` for a file that is no ZIP, `unreadable`, or `system` for the root of the system, `/proc`, `/sys` or `/dev`). The BIOS folder sits under a folder this user cannot open (`stage` is `dest`, `reason` `unreadable`), or is a file or lies under one (`reason` `not_a_folder`), and the run ends with code 1 before anything is written. A platform, target, system, core or emulator named on the command line is unknown or cannot be used here (`stage` is `option`, `reason` `unknown`, `platform` the platform it was checked against or the name typed), refused before any download with code 2, or a `--find` hash no one file of the list holds (code 4). An option that does not apply to the run, `--romm-firmware` without RomM or `--installed-cores` for a system that ships its cores (`stage` is `option`, `reason` `not_applicable`), or a `--romm-firmware` value it cannot read (`reason` `invalid`), code 1. The list does not record what `--system`, `--core`, `--region`, `--emulator`, `--standalone`, `--source truth`, `--no-game-data`, `--installed-cores` or `--one-per-slot` reads (`stage` is `option`, `reason` `not_recorded`, code 1). `--installed-cores` finds no core (`stage` is `cores`, `reason` `none`), or its `--cores-dir` does not exist, is not a folder or cannot be read (`reason` `not_found`, `not_a_folder` or `unreadable`). The board list a run needs cannot be had (`stage` is `targets`, `reason` as for the file list, `http` for a refused answer). The `--from-pack` file is no pack, is a pack of another platform, or names no platform and none is given (`stage` is `pack`, `reason` `invalid`, `other_platform` or `no_platform`), as for a `--pack` whose name gives no platform (code 2). The BIOS folder cannot be created (`stage` is `dest`, `reason` `not_writable`): a `summary` follows with what the run installed before it. Two systems are detected on one machine and no `--dest` names the folder, or a `--dest` given alone finds several here (`stage` is `detect`, `reason` `conflict`). The platform named with `--platform` is found nowhere and no folder can be assumed for it: a card system with no card named, a portable emulator, Batocera or Recalbox named on a computer (their folder is the `bios` folder of their SHARE drive), or no usual folder on this system or one set aside behind a folder this user cannot open (`stage` is `detect`, `reason` `not_found`). So is a platform named by a file list or a pack, in a run without questions where it is found nowhere here. A `--dest` refused as the card of the system named carries the same `stage` and `reason`: another system's card, a folder inside a card, a drive with none of the files its card always has, or a folder that does not exist. The drive holding the BIOS folder cannot hold the download (`stage` is `space`, `reason` `drive_full`), right after `no_space`, before any file of the setup is written. `message` says it in words, and is the only thing that tells these cases apart | +| `error` | `stage`, `reason`, `platform`, `message` | The file list could not be read (`stage` is `manifest`): `reason` is `network`, `not_found` or `invalid`, `clock` when the server's certificate was refused and the system clock reads a date before the installer was written, `no_ca` when the machine holds no list of trusted certificates (`SSL_CERT_FILE` names one), `no_ssl` when this Python was built without its `ssl` module and cannot use HTTPS, or `offline` when `--offline` forbids the request. A `--manifest` file that cannot be read carries `reason` `unreadable`, and the standalone layout `--standalone` needs `unavailable`. A folder named with `--from` cannot be read (`stage` is `from`, `reason` `not_found`, `not_a_folder` for a file that is no ZIP, `unreadable`, or `system` for the root of the system, `/proc`, `/sys` or `/dev`). The BIOS folder sits under a folder this user cannot open (`stage` is `dest`, `reason` `unreadable`), or is a file or lies under one (`reason` `not_a_folder`), and the run ends with code 1 before anything is written. A platform, target, system, core or emulator named on the command line is unknown or cannot be used here (`stage` is `option`, `reason` `unknown`, `platform` the platform it was checked against or the name typed), refused before any download with code 2, or a `--find` hash no one file of the list holds (code 4). An option that does not apply to the run, `--romm-firmware` without RomM or `--installed-cores` for a system that ships its cores (`stage` is `option`, `reason` `not_applicable`), or a `--romm-firmware` value it cannot read (`reason` `invalid`), code 1. A `--remove` or `--delete-backup` without `--yes` where no question can be asked (`stage` is `option`, `reason` `needs_yes`, code 2). The list does not record what `--system`, `--core`, `--region`, `--emulator`, `--standalone`, `--source truth`, `--no-game-data`, `--installed-cores` or `--one-per-slot` reads (`stage` is `option`, `reason` `not_recorded`, code 1). `--installed-cores` finds no core (`stage` is `cores`, `reason` `none`), or its `--cores-dir` does not exist, is not a folder or cannot be read (`reason` `not_found`, `not_a_folder` or `unreadable`). The board list a run needs cannot be had (`stage` is `targets`, `reason` as for the file list, `http` for a refused answer). The `--from-pack` file is no pack, is a pack of another platform, or names no platform and none is given (`stage` is `pack`, `reason` `invalid`, `other_platform` or `no_platform`), as for a `--pack` whose name gives no platform (code 2). A `--delete-backup` folder is not one the installer kept files in (`stage` is `backup`, `reason` `not_a_backup`, code 2). The BIOS folder cannot be created (`stage` is `dest`, `reason` `not_writable`): a `summary` follows with what the run installed before it. Two systems are detected on one machine and no `--dest` names the folder, or a `--dest` given alone finds several here (`stage` is `detect`, `reason` `conflict`), as are `--remove` and `--backups` finding several setups and none named (`not_found` for none), with code 2. The platform named with `--platform` is found nowhere and no folder can be assumed for it: a card system with no card named, a portable emulator, Batocera or Recalbox named on a computer (their folder is the `bios` folder of their SHARE drive), or no usual folder on this system or one set aside behind a folder this user cannot open (`stage` is `detect`, `reason` `not_found`). So is a platform named by a file list or a pack, in a run without questions where it is found nowhere here. A `--dest` refused as the card of the system named carries the same `stage` and `reason`: another system's card, a folder inside a card, a drive with none of the files its card always has, or a folder that does not exist. The drive holding the BIOS folder cannot hold the download (`stage` is `space`, `reason` `drive_full`), right after `no_space`, before any file of the setup is written. `message` says it in words, and is the only thing that tells these cases apart | | `no_space` | `platform`, `folder`, `bytes_needed`, `bytes_free` | Right before the `error` of `stage` `space`: the BIOS folder, the bytes the run writes there and the bytes free on its drive. `platform` is empty for a standalone build's folder | | `scanned` | `folder`, `files`, `truncated`, `other_drives` | Each folder named with `--from`, once read and before `detect`. `files` counts the files found, `truncated` is true when the search stopped at 200,000 of them, and `other_drives` lists the folders below it on another drive, which were not entered | | `version` | `platform`, `list_version`, `installed_version`, `message` | Before `choices`, when the system here runs another version than the one the list was built for: `list_version` is the list's, `installed_version` the one the system's version file states, and `message` says it and what it means. Not written when either version is unknown. The run goes on | @@ -2253,7 +2253,7 @@ other schemas under `api/v1/schemas/`. | `summary` | `mode`, `installed`, `up_to_date`, `pending`, `failed`, `skipped`, `left_out`, `kept`, `interrupted` | The outcome. `pending` counts what a next run would still fetch, `failed` lists `{dest, reason}`, `skipped` lists `{reason, label, files, required}` for the files the collection cannot supply, `left_out` lists `{category, label, files, dests}` for what `--no-game-data` left out, and is empty without it. `kept` lists `{folder, files, bytes}`, one per backup folder, for the files in place the run moved aside before replacing them (with `--dry-run`, would move), and is empty when none. Not written for a listing | | `app` | `system`, `folder`, `ok`, `reason`, `dests`, `written`, `kept` | After `summary`, with `--add-app` or a yes to its question: the RetroBIOS app on the card of `system` whose root is `folder`. `dests` lists the app's files below that root, `written` the ones this run wrote (empty when each was in place), `kept` the backup folders as in `summary`. `ok` is false, with `reason`, when the card takes no app (before anything is written, code 2), when the install did not finish, or when a file could not be fetched, verified or written (code 1) | | `record` | `platform`, `folder`, `path`, `status`, `choice`, `date`, `files`, `message` | The [install record](#the-install-record) of `folder`, kept at `path`. `status` is `applied` before `choices` when the run took its choice, nothing on the command line having chosen, `written` before `summary` once an install placed files, `unreadable` when it cannot be read (said once, ignored), or `not_written` when it could not be saved, the install itself unharmed. `choice` is the recorded options as words, `date` when it was written (UTC), `files` how many files it holds for the platform | -| `removal_plan` | `platform`, `folder`, `files`, `bytes`, `systems`, `dests`, `kept`, `gone`, `backup`, `message` | With `--remove`, before anything is removed, and all a `--dry-run` writes: `dests` the files that go in record order, `bytes` the space they free, `systems` those losing a file, `kept` a `{dest, reason}` for each file left (`shared`, `changed`, `link`, `not_a_file`, `outside`, `not_servable`, `unreadable`, `not_recorded`), `gone` the recorded files no longer there, `backup` whether they are moved rather than deleted. With `files` 0 and a `message` when no record says what is the installer's | +| `removal_plan` | `platform`, `folder`, `files`, `bytes`, `systems`, `dests`, `kept`, `gone`, `backup`, `message` | With `--remove`, before anything is removed, and all a `--dry-run` writes: `dests` the files that go in record order, `bytes` the space they free, `systems` those losing a file, `kept` a `{dest, reason}` for each file left (`shared`, `changed`, `link`, `not_a_file`, `outside`, `not_servable`, `unreadable`, `not_recorded`), `gone` the recorded files no longer there, `backup` whether they are moved rather than deleted. With `files` 0 and a `message` when nothing is removed before a plan: no record says what is the installer's, the folder is not there, or a `--file` lies outside it | | `removed` | `platform`, `dest`, `size`, `ok`, `reason`, `moved_to` | Each file `--remove` took. `ok` is false, with `reason`, for a file that stays. `moved_to` is its place in the backup with `--backup`, empty otherwise | | `restored` | `folder`, `path`, `size`, `ok`, `reason` | Each file `--restore` put back from the backup `folder` to `path` | | `backup` | `folder`, `date`, `files`, `bytes`, `source`, `status`, `message` | A backup folder: `status` is `listed` by `--backups`, `made` by `--remove --backup`, `deleted` or `not_deleted` by `--delete-backup`. `date` is when it was made, local time. `source` is `remove` for a removal's backup and `install` for the files an install replaced |