diff --git a/install.ps1 b/install.ps1 index a3e755023..9e95a543e 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 = "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 diff --git a/install.py b/install.py index f7da70263..86dcfff2e 100644 --- a/install.py +++ b/install.py @@ -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): diff --git a/install.sh b/install.sh index 6919230a4..356acd388 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="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 diff --git a/install/launchers/index.json b/install/launchers/index.json index 770ba9002..2137b879d 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": 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 }, { diff --git a/installer/pack.py b/installer/pack.py index 5b5dd9cf0..381fd840c 100644 --- a/installer/pack.py +++ b/installer/pack.py @@ -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): diff --git a/scripts/packs/scope.py b/scripts/packs/scope.py index d29cc895e..26ec93146 100644 --- a/scripts/packs/scope.py +++ b/scripts/packs/scope.py @@ -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}, diff --git a/tests/test_install_pack.py b/tests/test_install_pack.py index b6995c1ac..94e735426 100644 --- a/tests/test_install_pack.py +++ b/tests/test_install_pack.py @@ -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()