fix: send every refusal as an error event

--romm-firmware, --pack without a platform, an option the list does not
record, a board list the run cannot go on without, a full drive and the
--dest a named platform needs printed and exited on their own: --events
got end and no error. Each now raises Refusal where it is decided, and
refuse_name, --find and the space check stop formatting their own copy.
This commit is contained in:
Abdessamad Derraz committed 2026-11-21 21:42:20 +01:00
1 parent 571c4bbfd9
commit 665e2ebb52
13 files changed
+418 -470

No files matched your search

+2 -10
View File
@@ -2,13 +2,12 @@
from __future__ import annotations
import re
import sys
from pathlib import Path, PurePosixPath
from typing import NoReturn
from installer.embedded import _EMBEDDED_RULES, _NO_FOLDER
from installer.events import EVENTS
from installer.manifest import OTHER_SYSTEMS
from installer.refusal import Refusal
# The platforms that publish a core list per board, install/targets/ in the
# repository: a test holds the two equal. Offline, a platform outside it
@@ -197,14 +196,7 @@ def refuse_name(platform: str, *lines: str) -> NoReturn:
2, as for an option argparse refuses: 1 also means --check found files
to fetch, and a script reading it reran the install on a typo forever.
"""
message = " ".join(line.strip() for line in lines)
if message.startswith("Error: "):
message = message[len("Error: "):]
EVENTS.emit("error", stage="option", reason="unknown", platform=platform,
message=message)
for line in lines:
print(line, file=sys.stderr)
sys.exit(2)
raise Refusal("option", "unknown", platform, *lines, code=2)
# Frontends and systems that keep no BIOS folder of their own: each