fix: say why no list is found on the screen too

With RETROBIOS_REF on a tag that has no list, line mode named the
variable and the way out. The screen said only that there is no list at
this address, and gave no advice with the default revision either. Both
now read the same advice.
This commit is contained in:
Abdessamad Derraz committed 2026-11-21 06:04:39 +01:00
1 parent 68378b4423
commit 8d2f71b026
7 files changed
+51 -25

No files matched your search

+1 -1
View File
@@ -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 = "f1d12cfa6ab895adc88f3af123aef70f38a22d2dc1ed4832f4662b990fe1b8d9"
$defaultInstallSha256 = "8e7ea94c5c9ded4ba5033ab33ab2f633df8632e8221dcc14de9b8ffe7d29065a"
# 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
+14 -7
View File
@@ -7710,6 +7710,15 @@ def _manifest_invalid(plat: str, url: str, exc: ValueError) -> NoReturn:
sys.exit(1)
def missing_list_advice(plat: str, again: str) -> str:
"""What to do when the revision asked for has no file list for plat:
the name was checked before any request, so the revision is the cause."""
if RELEASE_REF != DEFAULT_RELEASE_REF:
return (f"RETROBIOS_REF={RELEASE_REF} has no list for {plat}: unset it, or pick a "
"newer tag from https://github.com/Abdess/retrobios/releases.")
return f"The repository may be moving its files: {again} in a few minutes."
def _manifest_http_error(plat: str, url: str, exc: urllib.error.HTTPError) -> NoReturn:
"""Stop on a file list the server answered with an HTTP error."""
EVENTS.emit(
@@ -7725,13 +7734,8 @@ def _manifest_http_error(plat: str, url: str, exc: urllib.error.HTTPError) -> No
# Asked once, a 4xx being final. The name was checked before any
# request, so the revision is what has no such list.
print(f" No file list for {plat} at {RELEASE_REF}.", file=sys.stderr)
if RELEASE_REF != DEFAULT_RELEASE_REF:
print(f" RETROBIOS_REF={RELEASE_REF} has no list for {plat}: unset it, or "
"pick a newer tag from https://github.com/Abdess/retrobios/releases.",
file=sys.stderr)
else:
print(" The repository may be moving its files: run the same command "
"again in a few minutes.", file=sys.stderr)
print(f" {missing_list_advice(plat, 'run the same command again')}",
file=sys.stderr)
sys.exit(1)
print(f" Could not fetch the file list for {plat}: HTTP {exc.code}", file=sys.stderr)
for line in _address_lines(url):
@@ -25358,6 +25362,9 @@ def _tui_fetch(plat: str, inbox: queue.Queue, log: io.StringIO) -> None:
title = "No file list"
lines = [f"There is no file list for {display_name(plat)} at this address."
if exc.code == 404 else f"The server answered HTTP {exc.code}."]
if exc.code == 404 and not os.environ.get("RETROBIOS_BASE_URL"):
# Line mode named RETROBIOS_REF as the cause, the screen nothing.
lines.append(missing_list_advice(plat, "choose Try again"))
except (urllib.error.URLError, OSError) as exc:
code, words = network_words(exc)
if code == "offline":
+1 -1
View File
@@ -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="f1d12cfa6ab895adc88f3af123aef70f38a22d2dc1ed4832f4662b990fe1b8d9"
DEFAULT_INSTALL_SHA256="8e7ea94c5c9ded4ba5033ab33ab2f633df8632e8221dcc14de9b8ffe7d29065a"
# 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
+8 -8
View File
@@ -27,8 +27,8 @@
{
"dest": "roms/ports/retrobios/install.py",
"repo_path": "install.py",
"size": 1448230,
"sha256": "f1d12cfa6ab895adc88f3af123aef70f38a22d2dc1ed4832f4662b990fe1b8d9",
"size": 1448645,
"sha256": "8e7ea94c5c9ded4ba5033ab33ab2f633df8632e8221dcc14de9b8ffe7d29065a",
"executable": false
},
{
@@ -71,8 +71,8 @@
"muos": {
"archive": {
"dest": "ARCHIVE/RetroBIOS.muxapp",
"size": 1501855,
"sha256": "45ca767858ca5be807703201046bbca6125f535e8fd46ef4bff672c198e27080"
"size": 1502270,
"sha256": "0246007dae205b51c288a17a6a0ecae978097d57bdeb9cda46a25123018cff2f"
},
"members": [
{
@@ -92,8 +92,8 @@
{
"name": "RetroBIOS/install.py",
"repo_path": "install.py",
"size": 1448230,
"sha256": "f1d12cfa6ab895adc88f3af123aef70f38a22d2dc1ed4832f4662b990fe1b8d9",
"size": 1448645,
"sha256": "8e7ea94c5c9ded4ba5033ab33ab2f633df8632e8221dcc14de9b8ffe7d29065a",
"executable": false
},
{
@@ -166,8 +166,8 @@
{
"dest": ".config/modules/retrobios/install.py",
"repo_path": "install.py",
"size": 1448230,
"sha256": "f1d12cfa6ab895adc88f3af123aef70f38a22d2dc1ed4832f4662b990fe1b8d9",
"size": 1448645,
"sha256": "8e7ea94c5c9ded4ba5033ab33ab2f633df8632e8221dcc14de9b8ffe7d29065a",
"executable": false
},
{
+11 -7
View File
@@ -352,6 +352,15 @@ def _manifest_invalid(plat: str, url: str, exc: ValueError) -> NoReturn:
sys.exit(1)
def missing_list_advice(plat: str, again: str) -> str:
"""What to do when the revision asked for has no file list for plat:
the name was checked before any request, so the revision is the cause."""
if RELEASE_REF != DEFAULT_RELEASE_REF:
return (f"RETROBIOS_REF={RELEASE_REF} has no list for {plat}: unset it, or pick a "
"newer tag from https://github.com/Abdess/retrobios/releases.")
return f"The repository may be moving its files: {again} in a few minutes."
def _manifest_http_error(plat: str, url: str, exc: urllib.error.HTTPError) -> NoReturn:
"""Stop on a file list the server answered with an HTTP error."""
EVENTS.emit(
@@ -367,13 +376,8 @@ def _manifest_http_error(plat: str, url: str, exc: urllib.error.HTTPError) -> No
# Asked once, a 4xx being final. The name was checked before any
# request, so the revision is what has no such list.
print(f" No file list for {plat} at {RELEASE_REF}.", file=sys.stderr)
if RELEASE_REF != DEFAULT_RELEASE_REF:
print(f" RETROBIOS_REF={RELEASE_REF} has no list for {plat}: unset it, or "
"pick a newer tag from https://github.com/Abdess/retrobios/releases.",
file=sys.stderr)
else:
print(" The repository may be moving its files: run the same command "
"again in a few minutes.", file=sys.stderr)
print(f" {missing_list_advice(plat, 'run the same command again')}",
file=sys.stderr)
sys.exit(1)
print(f" Could not fetch the file list for {plat}: HTTP {exc.code}", file=sys.stderr)
for line in _address_lines(url):
+4 -1
View File
@@ -19,7 +19,7 @@ from installer.events import _event_exit_code
from installer.games import games_probe
from installer.handheld_app import put_app
from installer.manifest import _validate_manifest
from installer.network import _fetch_json, fetch_manifest, fetch_targets, network_words
from installer.network import _fetch_json, fetch_manifest, fetch_targets, missing_list_advice, network_words
from installer.offline import LOCAL, offline_named, offline_undo
from installer.platforms import display_name
from installer.remote import MANIFEST_URL, MAX_MANIFEST_BYTES
@@ -157,6 +157,9 @@ def _tui_fetch(plat: str, inbox: queue.Queue, log: io.StringIO) -> None:
title = "No file list"
lines = [f"There is no file list for {display_name(plat)} at this address."
if exc.code == 404 else f"The server answered HTTP {exc.code}."]
if exc.code == 404 and not os.environ.get("RETROBIOS_BASE_URL"):
# Line mode named RETROBIOS_REF as the cause, the screen nothing.
lines.append(missing_list_advice(plat, "choose Try again"))
except (urllib.error.URLError, OSError) as exc:
code, words = network_words(exc)
if code == "offline":
+12
View File
@@ -2246,6 +2246,18 @@ class TicksBarAndPaths(unittest.TestCase):
self.assertEqual([row.action for row in install.tui_rows(state)],
["retry", "elsewhere", "quit"])
def test_a_missing_list_names_the_revision_asked_for(self):
# Line mode named RETROBIOS_REF, the screen said only "at this address".
inbox = __import__("queue").Queue()
missing = install.urllib.error.HTTPError("u", 404, "Not Found", {}, None)
with mock.patch.object(install, "_fetch_json", side_effect=missing), \
mock.patch.object(install, "RELEASE_REF", "v2020.01.01"), \
mock.patch.dict(os.environ, {"RETROBIOS_BASE_URL": ""}):
install._tui_fetch("batocera", inbox, io.StringIO())
_kind, _plat, title, lines, _code = inbox.get_nowait()
self.assertEqual(title, "No file list")
self.assertIn("RETROBIOS_REF=v2020.01.01 has no list for batocera", lines[1])
def test_the_clock_says_so(self):
import ssl