mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-22 17:47:48 -06:00
docs: name the modules that replaced common.py
The wiki, the platforms README and two comments named common.py, and the installer's region table named scripts/region.py. tools.md lists core/, model/ and resolve/ where it listed common.py, and the testing guide names test_layers. install.py is rebuilt from installer/ and its pins rewritten.
This commit is contained in:
1 parent
ba94437558
commit
b688f41a5a
13 files changed
+35
-32
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 = "0c27d4025521677f3fe1d3435f794921d4d4187e50585553d5f5d5a6e21ed935"
|
||||
$defaultInstallSha256 = "86fed4f666cfb7398dbc57b285c2f493c6abb30da394a639d765162001cd0eae"
|
||||
# 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
|
||||
|
||||
+1
-1
@@ -314,7 +314,7 @@ _NO_FOLDER = {
|
||||
|
||||
# --- installer/regions.py ----------------------------------------------------
|
||||
|
||||
# The region vocabulary of scripts/region.py, which this file cannot import.
|
||||
# The region vocabulary of scripts/model/region.py, which this file cannot import.
|
||||
# A test holds the two copies equal.
|
||||
WORLD_REGION = "world"
|
||||
REGION_TREE: dict[str, frozenset] = {
|
||||
|
||||
+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="0c27d4025521677f3fe1d3435f794921d4d4187e50585553d5f5d5a6e21ed935"
|
||||
DEFAULT_INSTALL_SHA256="86fed4f666cfb7398dbc57b285c2f493c6abb30da394a639d765162001cd0eae"
|
||||
# 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": 1445936,
|
||||
"sha256": "0c27d4025521677f3fe1d3435f794921d4d4187e50585553d5f5d5a6e21ed935",
|
||||
"size": 1445942,
|
||||
"sha256": "86fed4f666cfb7398dbc57b285c2f493c6abb30da394a639d765162001cd0eae",
|
||||
"executable": false
|
||||
},
|
||||
{
|
||||
@@ -71,8 +71,8 @@
|
||||
"muos": {
|
||||
"archive": {
|
||||
"dest": "ARCHIVE/RetroBIOS.muxapp",
|
||||
"size": 1499561,
|
||||
"sha256": "b38ba84bc3b64a30a30755e505676c4a6ec59b3162be4beafa421d34673d2a77"
|
||||
"size": 1499567,
|
||||
"sha256": "6fa5f8676ac5b1d4f7d9f4d9d0afc37a23651d7ce6f8e3427e752c9481079a4b"
|
||||
},
|
||||
"members": [
|
||||
{
|
||||
@@ -92,8 +92,8 @@
|
||||
{
|
||||
"name": "RetroBIOS/install.py",
|
||||
"repo_path": "install.py",
|
||||
"size": 1445936,
|
||||
"sha256": "0c27d4025521677f3fe1d3435f794921d4d4187e50585553d5f5d5a6e21ed935",
|
||||
"size": 1445942,
|
||||
"sha256": "86fed4f666cfb7398dbc57b285c2f493c6abb30da394a639d765162001cd0eae",
|
||||
"executable": false
|
||||
},
|
||||
{
|
||||
@@ -166,8 +166,8 @@
|
||||
{
|
||||
"dest": ".config/modules/retrobios/install.py",
|
||||
"repo_path": "install.py",
|
||||
"size": 1445936,
|
||||
"sha256": "0c27d4025521677f3fe1d3435f794921d4d4187e50585553d5f5d5a6e21ed935",
|
||||
"size": 1445942,
|
||||
"sha256": "86fed4f666cfb7398dbc57b285c2f493c6abb30da394a639d765162001cd0eae",
|
||||
"executable": false
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Region names, their aliases and the tree that ranks them."""
|
||||
from __future__ import annotations
|
||||
|
||||
# The region vocabulary of scripts/region.py, which this file cannot import.
|
||||
# The region vocabulary of scripts/model/region.py, which this file cannot import.
|
||||
# A test holds the two copies equal.
|
||||
WORLD_REGION = "world"
|
||||
REGION_TREE: dict[str, frozenset] = {
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ Batocera, or Recalbox. Only `base_destination` varies (`system/` vs `bios/`).
|
||||
|
||||
Shared groups define files with correct destinations **once**. Platforms
|
||||
reference them via `includes: [group_name]` in their system definitions.
|
||||
`load_platform_config()` in `common.py` resolves includes at load time,
|
||||
`load_platform_config()` in `scripts/model/platforms.py` resolves includes at load time,
|
||||
deduplicating by filename.
|
||||
|
||||
When to use shared groups: whenever 2+ platforms share files that a core
|
||||
|
||||
@@ -15,7 +15,7 @@ from pathlib import Path
|
||||
|
||||
# Scrapers run both as `python -m scripts.scraper.x` and as plain scripts, and
|
||||
# they share helpers with the rest of scripts/. Putting that directory on the
|
||||
# path once here is what lets every submodule say `from common import ...`
|
||||
# path once here is what lets every submodule say `from core.cli import ...`
|
||||
# instead of carrying its own bootstrap.
|
||||
if (_SCRIPTS_DIR := str(Path(__file__).resolve().parent.parent)) not in sys.path:
|
||||
sys.path.insert(0, _SCRIPTS_DIR)
|
||||
|
||||
@@ -190,7 +190,7 @@ writes the packages it builds, read from the `rp_module_id` of each
|
||||
scriptmodule, and any manual change is overwritten on the next scrape.
|
||||
|
||||
The `cores` field determines which emulator profiles are resolved for this
|
||||
platform (`resolve_platform_cores` in `common.py`). Alias profiles are never
|
||||
platform (`resolve_platform_cores` in `scripts/resolve/cores.py`). Alias profiles are never
|
||||
resolved. Three strategies exist:
|
||||
|
||||
- **Explicit list**: `cores: [beetle_psx, dolphin, ...]` - match by profile key name
|
||||
@@ -720,7 +720,7 @@ and `target_source` to the platform's registry entry.
|
||||
Hardware-specific overrides go in `platforms/targets/_overrides.yml`, which no
|
||||
scraper writes. Each target can list `aliases` (Batocera's `bcm2711` also
|
||||
answers to `rpi4`), `add_cores` and `remove_cores`, and `_default` applies to
|
||||
every target of the platform. `apply_target_overrides()` in `common.py` applies
|
||||
every target of the platform. `apply_target_overrides()` in `scripts/model/targets.py` applies
|
||||
them, for the packs and for the published target lists alike.
|
||||
|
||||
### Single-target platforms
|
||||
|
||||
@@ -223,7 +223,7 @@ is `manufacturer-console` in lowercase with hyphens (e.g. `sony-playstation`,
|
||||
When a native slug has no mapping, print a warning to stderr. This surfaces new
|
||||
systems added upstream that need to be mapped.
|
||||
|
||||
System ID consistency matters for cross-platform operations. The same console must use the same ID across all scrapers and platforms. Before inventing a new ID, check existing profiles and platform YAMLs for precedent. The canonical format is `manufacturer-console` in lowercase with hyphens (e.g., `sony-playstation`, `sega-mega-drive`). The `SYSTEM_ALIASES` dict in `common.py` maps common variations to canonical IDs.
|
||||
System ID consistency matters for cross-platform operations. The same console must use the same ID across all scrapers and platforms. Before inventing a new ID, check existing profiles and platform YAMLs for precedent. The canonical format is `manufacturer-console` in lowercase with hyphens (e.g., `sony-playstation`, `sega-mega-drive`). The `SYSTEM_ALIASES` dict in `scripts/model/systems.py` maps common variations to canonical IDs.
|
||||
|
||||
### Hash normalization
|
||||
|
||||
@@ -299,7 +299,7 @@ pipeline to work correctly.
|
||||
- **remove_cores**: names the scraper reads as cores that emulate nothing
|
||||
- **_default**: an entry applied to every target of the platform
|
||||
|
||||
`apply_target_overrides()` in `common.py` applies them, read by
|
||||
`apply_target_overrides()` in `scripts/model/targets.py` applies them, read by
|
||||
`load_target_config()` and by the target manifests. The scraper itself does not
|
||||
handle overrides.
|
||||
|
||||
|
||||
@@ -400,7 +400,7 @@ resolution.
|
||||
- `safe_extract_zip()` prevents zip-slip path traversal attacks
|
||||
- a pack copies each ZIP of the collection byte for byte, so every member
|
||||
hashes to the SHA1 the install list publishes
|
||||
- `crypto_verify.py` and `sect233r1.py` verify 3DS RSA-2048 signatures and AES-128-CBC integrity
|
||||
- `core/crypto_verify.py` and `core/sect233r1.py` verify 3DS RSA-2048 signatures and AES-128-CBC integrity
|
||||
- ZIP inner ROM verification via `checkInsideZip()` replicates Batocera's behavior
|
||||
- `md5_composite()` replicates Recalbox's composite ZIP hash
|
||||
|
||||
@@ -419,7 +419,7 @@ resolution.
|
||||
|
||||
### File resolution chain
|
||||
|
||||
`resolve_local_file` in `common.py` turns a file entry into a local path, and
|
||||
`resolve_local_file` in `scripts/resolve/localfile.py` turns a file entry into a local path, and
|
||||
`verify.py` and `generate_pack.py` both call it. Every declared hash is tried
|
||||
before a path or a name, so a path never wins over a hash. The steps, in order,
|
||||
are listed under [file resolution chain](verification-modes.md#file-resolution-chain).
|
||||
|
||||
@@ -62,6 +62,7 @@ Every module in `tests/`, by the area it guards.
|
||||
| Area | Fixtures | Modules |
|
||||
|------|----------|---------|
|
||||
| Core regression suites | synthetic | `test_e2e`, `test_audit_regressions`, `test_tool_messages` |
|
||||
| Import layers | the source of `scripts/` | `test_layers` |
|
||||
| File resolution and identity | synthetic + collection | `test_adler32_resolution`, `test_agnostic_scan`, `test_agnostic_scan_mode`, `test_agnostic_scope`, `test_agnostic_substitute`, `test_archive_build`, `test_archive_choice`, `test_archive_recipes`, `test_bios_companions`, `test_bundled_identity`, `test_casefold_cache`, `test_db_aliases`, `test_declared_names`, `test_derivations`, `test_directory_entries`, `test_extra_identity`, `test_foreign_tree`, `test_foreign_tree_names`, `test_frontend_digest`, `test_game_data_homonyms`, `test_hashing`, `test_identity`, `test_maker_folder_names`, `test_md5_pack_context`, `test_name_tiebreak`, `test_nec_filing`, `test_np2_fonts`, `test_owner_resolution`, `test_path_suffix`, `test_proven_name`, `test_resolution_evidence`, `test_sega_filing`, `test_shipped_content`, `test_twin_declaration_status`, `test_twin_declarations`, `test_validated_choice`, `test_variant_choice`, `test_variant_identity`, `test_zipped_member` |
|
||||
| Verification, cross-reference and profile checks | synthetic + profiles | `test_bios_layout`, `test_cache_independent_counts`, `test_case_insensitive_platforms`, `test_checks_have_values`, `test_content_checks`, `test_content_declarations`, `test_core_file_fills_declaration`, `test_core_size_refusal`, `test_cross_reference_sources`, `test_crypto_aes`, `test_crypto_unique_data`, `test_crypto_verify`, `test_data_only_refs`, `test_entry_categories`, `test_file_consumers`, `test_fileless_audit`, `test_flycast_layout`, `test_gap_settlement`, `test_hidden_extras`, `test_launcher_aliases`, `test_launcher_evidence`, `test_launcher_gaps`, `test_launcher_layer`, `test_launcher_paths`, `test_launcher_placement`, `test_native_mode`, `test_no_case_collisions`, `test_path_conflict_status`, `test_path_null_copies`, `test_profile_checks`, `test_profile_names`, `test_profile_paths`, `test_profile_repositories`, `test_romm_hash_rule`, `test_shared_groups`, `test_standalone_links`, `test_standalone_mode`, `test_undeclared_dedup`, `test_unplaced_extras`, `test_validation_scope`, `test_verify_all_dir`, `test_verify_data_dir_notice`, `test_verify_emulator_evidence`, `test_verify_listing`, `test_verify_pack_choice`, `test_verify_release_asset` |
|
||||
| Packs and manifests | synthetic + real packs | `test_artifact_lock`, `test_atomic_artifacts`, `test_batocera_cores`, `test_core_data_trees`, `test_deterministic_zip`, `test_emulator_pack_counts`, `test_finalize_pack_names`, `test_large_file_cache`, `test_libretro_layout`, `test_manifest_entry`, `test_minui_platform`, `test_no_game_data`, `test_pack_conformance_dirs`, `test_pack_core_extras`, `test_pack_counts`, `test_pack_destinations`, `test_pack_failures`, `test_pack_file_names`, `test_pack_grouping`, `test_pack_integrity`, `test_pack_member_identity`, `test_pack_readme`, `test_platform_inheritance`, `test_platform_keys`, `test_release_packs`, `test_required_only_archives`, `test_required_only_twins`, `test_save_root`, `test_split_extras`, `test_split_names`, `test_split_pack`, `test_system_pack_extras`, `test_system_pack_parity`, `test_torrentzip`, `test_which_pack` |
|
||||
@@ -493,7 +494,7 @@ upstream `file:line` that decides it, what users will see.
|
||||
|
||||
```
|
||||
feat: add retrobat platform support
|
||||
refactor: extract shared utils to common.py
|
||||
refactor: split common.py into three packages
|
||||
```
|
||||
|
||||
`scripts/commit_rules.py` holds these rules. Git does not copy hooks with a
|
||||
|
||||
+12
-10
@@ -383,7 +383,7 @@ members included), under a `type: directory` entry or a data directory. An entry
|
||||
none of them answers is written to `exports/<platform>.json` under
|
||||
`removal_candidates`, with the cores examined for its system and a reason.
|
||||
The verdict is `undetermined` when a core the platform names has no
|
||||
profile (`common.unresolved_platform_cores`) or when the entry is a ROM set
|
||||
profile (`resolve.cores.unresolved_platform_cores`) or when the entry is a ROM set
|
||||
and a core of the system opens sets its profile does not list. BizHawk and
|
||||
MiSTer resolve no core, so nothing is examined and nothing is listed.
|
||||
|
||||
@@ -670,7 +670,7 @@ file at a given sha, and compares trees, for the forge families the
|
||||
profiles point at. It knows nothing about profile structure, so anchoring
|
||||
logic and repository access stay testable apart.
|
||||
|
||||
### validation.py
|
||||
### resolve/validation.py
|
||||
|
||||
Validation index and ground truth formatting. Used by verify.py for emulator-level checks
|
||||
(size, CRC32, MD5, SHA1, crypto). Separates reproducible hash checks from cryptographic
|
||||
@@ -1350,7 +1350,9 @@ before a release (wiki/release-process.md). Its lines stay in
|
||||
|
||||
| Script | Purpose |
|
||||
|--------|---------|
|
||||
| `common.py` | Shared library: hash computation, file resolution, platform config loading, emulator profiles, target filtering |
|
||||
| `core/` | Standard library only: hashing, ZIP reading and TorrentZip, atomic writes and output locks, `run_cli` and the input errors it prints on one line, the GitHub token, the repository root |
|
||||
| `model/` | Data loading: `database.json`, platform configs and the registry, emulator profiles, hardware targets, system ids, the region vocabulary, dump catalogues, release assets |
|
||||
| `resolve/` | From a declaration to a file: content checks, `resolve_local_file` and its stages, archive members, launcher layouts, the cores a platform runs, validation, slots, truth |
|
||||
| `retired_files.py` | The record of files that left the collection, `retired.json`, which `generate_db.py` appends to and the site's lookup reads. `--backfill` rebuilds it from the history of `database.json` since content addresses were published (`--output` names another file) |
|
||||
| `dedup.py` | Deduplicate `bios/` (`--dry-run`, `--bios-dir`): byte-identical copies are deleted and one kept. Identical MAME sets under other names stay one file, named in `_mame_clones.json`. Trees addressed by path are left alone (`NODEDUP_DIRS`), under a folder of that name at any depth: BBK, Bungie, C-Dogs SDL, Ikemen GO, mame, PinMAME, RPG Maker, ScummVM, Softdisk, TheXTech, splitwolf, Theme Hospital, c64-emu, opentyrian, tzdata |
|
||||
| `identity.py` | One content filed under two identities: groups `bios/` by content and reports a group that crosses manufacturers outside `KNOWN_SHARED` (`--strict` exits 1, pipeline step 3a) |
|
||||
@@ -1381,10 +1383,10 @@ before a release (wiki/release-process.md). Its lines stay in
|
||||
| `romset_recipes.py` | Identify which emulator version an arcade archive matches, rebuild a pinned archive from ROMs already held, record a recipe for every archive the collection holds and build any of them from the members it holds (see [Archive recipes](#archive-recipes)) |
|
||||
| `archive_build.py` | The archive recipes behind `romset_recipes.py --capture`, `--build` and `--build-all`: capture, member lookup by sha1, verified build |
|
||||
| `scraper/romset_dat_importer.py` | Fetch and import per-set recipes from MAME `-listxml` or FBNeo DATs into `recipes/`. `--fetch` alone takes the newest MAME release, and FBNeo DATs are refreshed by git blob sha. `--fetch <revision>` reads FBNeo at that tag, branch or commit |
|
||||
| `deterministic_zip.py` | The fixed date pack members carry. Its archive rebuild is no longer called by the pack, which copies each ZIP byte for byte |
|
||||
| `torrentzip.py` | Build TorrentZip archives for MAME/FBNeo ROM sets (archive bytes depend only on contents, with stock zlib), streaming one member at a time |
|
||||
| `crypto_verify.py` | 3DS RSA signature and AES crypto verification |
|
||||
| `sect233r1.py` | Pure Python ECDSA verification on sect233r1 curve (3DS OTP cert) |
|
||||
| `core/deterministic_zip.py` | The fixed date pack members carry. Its archive rebuild is no longer called by the pack, which copies each ZIP byte for byte |
|
||||
| `core/torrentzip.py` | Build TorrentZip archives for MAME/FBNeo ROM sets (archive bytes depend only on contents, with stock zlib), streaming one member at a time |
|
||||
| `core/crypto_verify.py` | 3DS RSA signature and AES crypto verification |
|
||||
| `core/sect233r1.py` | Pure Python ECDSA verification on sect233r1 curve (3DS OTP cert) |
|
||||
| `check_buildbot_system.py` | Detect stale data directories by comparing with buildbot |
|
||||
| `check_freshness.py` | One report on every upstream the repository transcribes (see above) |
|
||||
| `refresh_stale.py` | Run the refresher behind every stale row of that report (see above) |
|
||||
@@ -1597,7 +1599,7 @@ on Windows. zlib-ng does not: python.org CPython 3.14 and 3.15 on Windows
|
||||
(zlib-ng 2.2.4) reproduced 479, and zlib-ng 2.3.3 545, the two versions
|
||||
disagreeing with each other. `--capture` refuses to run under zlib-ng, and
|
||||
`--build` says so and checks every recipe by its members, never claiming an
|
||||
exact rebuild. `torrentzip.zlib_ng_version()` is the test.
|
||||
exact rebuild. `core.torrentzip.zlib_ng_version()` is the test.
|
||||
|
||||
## Large files
|
||||
|
||||
@@ -1606,7 +1608,7 @@ release. `.gitignore` is the list of them: a `bios/` path listed there is a
|
||||
release asset, whatever its size, and a committed file is served from the
|
||||
repository even past 50 MB.
|
||||
`generate_db.py` downloads them from the release when rebuilding the database,
|
||||
using `fetch_large_file()` from `largefiles.py`. `generate_pack.py` calls the
|
||||
using `fetch_large_file()` from `scripts/model/largefiles.py`. `generate_pack.py` calls the
|
||||
same function when the file is absent locally or holds another revision than
|
||||
the entry declares, and keeps the asset only when it matches a declared hash.
|
||||
The rules for asset names, uploads and checks are on the
|
||||
@@ -1773,7 +1775,7 @@ python scripts/generate_games_index.py --check # exit 1 when a publ
|
||||
| `games/arcade/<profile>.json` | `scraper/arcade_parent_importer.py` | BIOS parent and device sets of each game set, from the DAT the pin names or, for mame2000, mame2003 and mame2003-plus, from the driver code |
|
||||
|
||||
Folder names resolve to systems through `SYSTEM_ALIASES` and `_norm_system_id`
|
||||
in `common.py`, the one alias table, and core names to profiles through the
|
||||
in `scripts/model/systems.py`, the one alias table, and core names to profiles through the
|
||||
profiles' `cores:`. The fallback set of a folder, what an unrecognised game
|
||||
keeps, is computed from `install/<platform>.json` with the installer's own
|
||||
core narrowing. Every published file is listed in `install/games/index.json`
|
||||
|
||||
@@ -276,7 +276,7 @@ console-specific cryptographic keys (e.g., RSA-2048 for 3DS, AES-128-CBC for cer
|
||||
firmware). `verify.py` reports these as informational but cannot verify them without
|
||||
the keys. Size checks still apply if combined with crypto.
|
||||
|
||||
**Content tests** (`CONTENT_CHECKS` in `common.py`): `romdir` walks a PS2 ROM
|
||||
**Content tests** (`CONTENT_CHECKS` in `scripts/model/profiles.py`): `romdir` walks a PS2 ROM
|
||||
directory the way the profile's fork reads it (`scripts/core/romdir.py`), and
|
||||
`masked_sha1` hashes a file with a byte range cleared. `content_fits()` runs them,
|
||||
and the name steps of the resolver, the folder scans of the pack and manifest,
|
||||
|
||||
Reference in new issue
Block a user