mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-24 10:37:54 -06:00
fix: record no narrowing axis for an older list
A list with cores and neither systems nor regions is from an older release, and recorded_axes reads none from it. A pack built here or by generate_pack wrote cores and regions in its manifest. The installer pack now asks recorded_axes, and the builder follows the same rule.
This commit is contained in:
1 parent
7284a90a20
commit
b338d94fa0
7 files changed
+53
-33
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 = "29e7e1ca306f44a6caa9596c200ff5950f34772ef55004ace56375e06f890be1"
|
||||
$defaultInstallSha256 = "658d9a948508e21fa5bdc8f5cfa4feb15d81bb58cf715f0fb355333d1f412c30"
|
||||
# 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
|
||||
|
||||
+2
-8
@@ -18768,14 +18768,8 @@ def pack_install_list(manifest: dict, files: list[dict], omitted: list[dict],
|
||||
def pack_manifest(plat: str, install_list: dict, rows: list[dict],
|
||||
targets: dict | None) -> bytes:
|
||||
"""manifest.json of a pack made here, as --from-pack reads it."""
|
||||
entries = [*install_list.get("files", []), *install_list.get("omitted_files", [])]
|
||||
records = {"systems"} if any("systems" in entry for entry in entries) else set()
|
||||
if any(copy.get("cores") for entry in install_list.get("files", [])
|
||||
for copy in [entry, *entry.get("alternatives", []),
|
||||
*entry.get("slot_choices", [])]):
|
||||
records.add("cores")
|
||||
if records or any("regions" in entry for entry in entries):
|
||||
records.add("regions")
|
||||
records = recorded_axes(install_list.get("files", []),
|
||||
install_list.get("omitted_files", []))
|
||||
data: dict = {"platform": plat, "files": rows}
|
||||
for key in ("system_titles", "system_names"):
|
||||
if install_list.get(key):
|
||||
|
||||
+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="29e7e1ca306f44a6caa9596c200ff5950f34772ef55004ace56375e06f890be1"
|
||||
DEFAULT_INSTALL_SHA256="658d9a948508e21fa5bdc8f5cfa4feb15d81bb58cf715f0fb355333d1f412c30"
|
||||
# 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": 1449464,
|
||||
"sha256": "29e7e1ca306f44a6caa9596c200ff5950f34772ef55004ace56375e06f890be1",
|
||||
"size": 1449101,
|
||||
"sha256": "658d9a948508e21fa5bdc8f5cfa4feb15d81bb58cf715f0fb355333d1f412c30",
|
||||
"executable": false
|
||||
},
|
||||
{
|
||||
@@ -71,8 +71,8 @@
|
||||
"muos": {
|
||||
"archive": {
|
||||
"dest": "ARCHIVE/RetroBIOS.muxapp",
|
||||
"size": 1503089,
|
||||
"sha256": "de8119491627296614cf8b6eefb45f1773a94b5be834743e772a8466bc5bcdba"
|
||||
"size": 1502726,
|
||||
"sha256": "2465c1d4f53c2935dc33de6eb966be2dab3dcff5f438850855bb98b828ef889b"
|
||||
},
|
||||
"members": [
|
||||
{
|
||||
@@ -92,8 +92,8 @@
|
||||
{
|
||||
"name": "RetroBIOS/install.py",
|
||||
"repo_path": "install.py",
|
||||
"size": 1449464,
|
||||
"sha256": "29e7e1ca306f44a6caa9596c200ff5950f34772ef55004ace56375e06f890be1",
|
||||
"size": 1449101,
|
||||
"sha256": "658d9a948508e21fa5bdc8f5cfa4feb15d81bb58cf715f0fb355333d1f412c30",
|
||||
"executable": false
|
||||
},
|
||||
{
|
||||
@@ -166,8 +166,8 @@
|
||||
{
|
||||
"dest": ".config/modules/retrobios/install.py",
|
||||
"repo_path": "install.py",
|
||||
"size": 1449464,
|
||||
"sha256": "29e7e1ca306f44a6caa9596c200ff5950f34772ef55004ace56375e06f890be1",
|
||||
"size": 1449101,
|
||||
"sha256": "658d9a948508e21fa5bdc8f5cfa4feb15d81bb58cf715f0fb355333d1f412c30",
|
||||
"executable": false
|
||||
},
|
||||
{
|
||||
|
||||
+3
-8
@@ -19,6 +19,7 @@ from pathlib import Path, PurePosixPath
|
||||
from typing import TYPE_CHECKING, NamedTuple
|
||||
|
||||
from installer.arguments import PACK_NAME_END
|
||||
from installer.choices import recorded_axes
|
||||
from installer.console import OUTPUT, detail
|
||||
from installer.datadirs import install_data_directory
|
||||
from installer.download import download_files
|
||||
@@ -280,14 +281,8 @@ def pack_install_list(manifest: dict, files: list[dict], omitted: list[dict],
|
||||
def pack_manifest(plat: str, install_list: dict, rows: list[dict],
|
||||
targets: dict | None) -> bytes:
|
||||
"""manifest.json of a pack made here, as --from-pack reads it."""
|
||||
entries = [*install_list.get("files", []), *install_list.get("omitted_files", [])]
|
||||
records = {"systems"} if any("systems" in entry for entry in entries) else set()
|
||||
if any(copy.get("cores") for entry in install_list.get("files", [])
|
||||
for copy in [entry, *entry.get("alternatives", []),
|
||||
*entry.get("slot_choices", [])]):
|
||||
records.add("cores")
|
||||
if records or any("regions" in entry for entry in entries):
|
||||
records.add("regions")
|
||||
records = recorded_axes(install_list.get("files", []),
|
||||
install_list.get("omitted_files", []))
|
||||
data: dict = {"platform": plat, "files": rows}
|
||||
for key in ("system_titles", "system_names"):
|
||||
if install_list.get(key):
|
||||
|
||||
+11
-7
@@ -68,13 +68,17 @@ def pack_systems(install_manifest: dict, targets: dict | None = None) -> dict:
|
||||
# the pack alone it names that list as the way to --core and --region
|
||||
# only when the list records them. It named install/misterfpga.json for
|
||||
# --core, a list that records no core.
|
||||
records = {"systems"} if any("systems" in entry for entry in entries) else set()
|
||||
if any(copy.get("cores") for entry in files
|
||||
for copy in [entry, *entry.get("alternatives", []),
|
||||
*entry.get("slot_choices", [])]):
|
||||
records.add("cores")
|
||||
if records or any("regions" in entry for entry in entries):
|
||||
records.add("regions")
|
||||
# A list with neither systems nor regions is from an older release:
|
||||
# its cores are read by nothing that narrows.
|
||||
records: set[str] = set()
|
||||
if any("systems" in entry or "regions" in entry for entry in entries):
|
||||
records = {"regions"}
|
||||
if any("systems" in entry for entry in entries):
|
||||
records.add("systems")
|
||||
if any(copy.get("cores") for entry in files
|
||||
for copy in [entry, *entry.get("alternatives", []),
|
||||
*entry.get("slot_choices", [])]):
|
||||
records.add("cores")
|
||||
systems = {
|
||||
"files": {entry["dest"]: list(entry.get("systems") or [])
|
||||
for entry in files if "systems" in entry},
|
||||
|
||||
@@ -637,5 +637,32 @@ class PartSizes(unittest.TestCase):
|
||||
install.parse_part_size(text)
|
||||
|
||||
|
||||
|
||||
class AListRecordsWhatItNarrowsBy(unittest.TestCase):
|
||||
"""A pack built here, a pack built by generate_pack and the list itself
|
||||
agree on what --system, --core and --region narrow. A list with cores
|
||||
and neither systems nor regions, from an older release, records none:
|
||||
the packs said cores and regions."""
|
||||
|
||||
SHAPES = (
|
||||
[{"dest": "a.bin", "cores": ["mgba"]}],
|
||||
[{"dest": "a.bin", "cores": ["mgba"], "regions": ["usa"]}],
|
||||
[{"dest": "a.bin", "cores": None, "systems": ["nintendo-gba"]}],
|
||||
[{"dest": "a.bin", "cores": None, "systems": [],
|
||||
"slot_choices": [{"sha1": "0" * 40, "cores": ["mgba"]}]}],
|
||||
)
|
||||
|
||||
def test_each_shape(self):
|
||||
from packs.scope import pack_systems
|
||||
|
||||
for files in self.SHAPES:
|
||||
listing = {"files": files, "omitted_files": []}
|
||||
with self.subTest(files=files):
|
||||
axes = sorted(install.recorded_axes(files))
|
||||
built = json.loads(install.pack_manifest("retroarch", listing, [], None))
|
||||
self.assertEqual(built["list_records"], axes)
|
||||
self.assertEqual(pack_systems(listing)["list_records"], axes)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user