mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-20 18:59:07 -05:00
fix: name the ref when a file list is missing
This commit is contained in:
1 parent
4bfe4eef2c
commit
90d29411f4
5 files changed
+49
-5
No files matched your search
+1
-1
@@ -8,7 +8,7 @@ param(
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$defaultInstallUrl = "https://raw.githubusercontent.com/Abdess/retrobios/main/install.py"
|
||||
$defaultInstallSha256 = "bf522ef64ecbefc14202a879b6c943e44939dfda37eb416b1897070ad7cefa85"
|
||||
$defaultInstallSha256 = "d35dc1707a5f5d65fb614f45ed71f47e20e9ffcb4b28470e757cc66533c91ef2"
|
||||
$maximumInstallerBytes = 2MB
|
||||
$installerExit = 0
|
||||
$installer = if ($PSScriptRoot) { Join-Path $PSScriptRoot "install.py" } else { $null }
|
||||
|
||||
+16
@@ -1878,6 +1878,22 @@ def fetch_manifest(plat: str) -> dict:
|
||||
except ValueError as exc:
|
||||
print(f" The file list for {plat} is not valid: {exc}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
except urllib.error.HTTPError as exc:
|
||||
if exc.code == 404:
|
||||
# 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} names a tag that does not exist or "
|
||||
f"predates {plat}: unset RETROBIOS_REF, or pick a 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)
|
||||
sys.exit(1)
|
||||
print(f" Could not fetch the file list for {plat}: HTTP {exc.code}", file=sys.stderr)
|
||||
print(NETWORK_ADVICE, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
except (urllib.error.URLError, OSError) as exc:
|
||||
print(f" Could not fetch the file list for {plat} after {MAX_RETRIES} "
|
||||
f"attempts: {getattr(exc, 'reason', None) or exc}", file=sys.stderr)
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ esac
|
||||
TEMP_INSTALLER=""
|
||||
TEMP_DIRECTORY=""
|
||||
DEFAULT_INSTALL_URL="https://raw.githubusercontent.com/Abdess/retrobios/main/install.py"
|
||||
DEFAULT_INSTALL_SHA256="bf522ef64ecbefc14202a879b6c943e44939dfda37eb416b1897070ad7cefa85"
|
||||
DEFAULT_INSTALL_SHA256="d35dc1707a5f5d65fb614f45ed71f47e20e9ffcb4b28470e757cc66533c91ef2"
|
||||
MAX_INSTALLER_BYTES=2097152
|
||||
|
||||
cleanup() {
|
||||
|
||||
@@ -2841,5 +2841,30 @@ class SteamRetroArchOnMacIsPortable(unittest.TestCase):
|
||||
self.assertEqual(install._macos_retroarch_base(), support / "RetroArch")
|
||||
|
||||
|
||||
class AMissingFileListNamesTheRef(unittest.TestCase):
|
||||
"""A 404 on the manifest said three attempts were made and to check the
|
||||
connection and proxy; it was asked once, and the cause is the ref."""
|
||||
|
||||
def _run(self, ref: str) -> str:
|
||||
error = install.urllib.error.HTTPError("u", 404, "Not Found", None, None)
|
||||
with unittest.mock.patch.object(install, "RELEASE_REF", ref), \
|
||||
unittest.mock.patch.object(install, "_fetch_json", side_effect=error), \
|
||||
contextlib.redirect_stderr(io.StringIO()) as err, \
|
||||
self.assertRaises(SystemExit):
|
||||
install.fetch_manifest("retroarch")
|
||||
return err.getvalue()
|
||||
|
||||
def test_a_pinned_tag_is_named(self):
|
||||
text = self._run("v2020.01.01")
|
||||
self.assertIn("RETROBIOS_REF=v2020.01.01", text)
|
||||
self.assertNotIn("attempts", text)
|
||||
self.assertNotIn("proxy", text)
|
||||
|
||||
def test_the_default_ref_is_not_blamed_on_the_network(self):
|
||||
text = self._run(install.DEFAULT_RELEASE_REF)
|
||||
self.assertIn("No file list for retroarch", text)
|
||||
self.assertNotIn("proxy", text)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -264,13 +264,16 @@ python install.py --platform retroarch --dest ~/RetroArch/system/
|
||||
python install.py --platform batocera --dest /userdata/bios/
|
||||
```
|
||||
|
||||
Use `python install.py --help` to see all available platforms and options.
|
||||
`python install.py --list-platforms` lists the platforms the installer knows
|
||||
and the ones it detects here; `--help` lists the options.
|
||||
|
||||
**Manifest or file not found:**
|
||||
|
||||
The one-line bootstrap verifies the downloaded installer before running it, and
|
||||
the installer reads its manifests from the same revision. A 404 usually means
|
||||
the platform name is wrong; check `python install.py --list-platforms`.
|
||||
the installer reads its manifests from the same revision. A platform name is
|
||||
checked before anything is downloaded, so a "No file list" message comes from
|
||||
the revision: `RETROBIOS_REF` naming a tag that does not exist, or one older
|
||||
than the platform. Unset it, or pick a tag from the releases page.
|
||||
`RETROBIOS_REF` pins an installation to a published tag when a reproducible
|
||||
file set matters more than the newest one.
|
||||
|
||||
|
||||
Reference in new issue
Block a user