Commit Graph
28 Commits
Author SHA1 Message Date
Abdessamad Derraz eef13547e1 refactor: share one derived-view cache 2026-11-21 05:59:51 +01:00
Abdessamad Derraz 35f335d001 refactor: read target overrides through one reader 2026-11-21 05:59:51 +01:00
Abdessamad Derraz 812f2609db fix: read every source yaml as utf-8 2026-11-21 05:59:51 +01:00
Abdessamad Derraz d4aae50601 fix: read the guides file with the source loader 2026-11-21 05:59:51 +01:00
Abdessamad Derraz 97af05db9a refactor: name release packs from the record
model.releaserecord now holds match_key, pack_label and pack_owner,
which the release notes and download.py each kept a copy of, and
recorded_pack, the pack release.json says serves a platform.

download.py reads release.json when it records the release it
downloads from. Otherwise it matches pack names and takes the shortest
match, so retroarch gets RetroArch_v1.22.2 rather than the
AndroidArm64V8A target pack listed before it.
2026-11-20 20:03:26 +01:00
Abdessamad Derraz 4dc4dc0429 refactor: restore large files with one copy
model.largefiles.restore_verified replaces generate_db _restore and
release restore _copy_verified: a scratch copy beside the target,
hashed, then renamed into place with a plain mode.

generate_db now refuses to put back a cached asset whose copy does not
hash to its database entry. The entry is still kept, as for an asset
the cache cannot supply. The restore script copies once instead of
through a second scratch.
2026-11-20 20:03:26 +01:00
Abdessamad Derraz 48eb208786 refactor: one list of the names a core goes by
model.profiles.profile_names(key, profile) gives a profile's key then
the names its cores: lists, and core_key moves there from contentlayout
with core_key_index, upstream_profile_index keyed by it. The inline
{key, *cores} sets and scans in resolve and packs read profile_names;
the two roms folder matchers read core_key_index. The parameter of
select_emulator_profiles is renamed requested.

Matching stays exact everywhere it was exact. Folding case and -/_
everywhere would merge distinct profiles: dosbox_pure (Batocera,
AmberELEC, EmuELEC) would also name dosbox-pure-unleashed, and
pcsx_rearmed would also name pcsx_rearmed_standalone (RetroPie's
pcsx-rearmed). Only roms folder rows (retrobat BSNES, Snes9x, mGBA,
emudeck vice-x64sc...) depend on the fold, and those already fold.
The alias lookup of select_emulator_profiles now compares string core
names, as every other reader does. No output change.
2026-11-20 20:03:26 +01:00
Abdessamad Derraz 0095b23512 refactor: read a declaration's slot one way
model.declarations.declared_slot(entry, prefix) is the declared
destination less the platform's BIOS root, empty when the entry names no
path. platform_declarations, platform_declared_contents,
declared_destinations, system_core_reach, find_collisions and
platform_claims read it in place of destination-or-name. The core extras
of the builder and the manifest read declared_destination, and the
builder's case twin list asks Placed.block.

Behavior: the 134 EmuDeck system:md5 entries (destination: '') claim no
slot. They were filed under their name, sony-playstation:<md5>, a path
nothing else names: slots and collisions drop those claims, and
case_folded_slots skips an empty slot. Their names and contents still
count as declared, in the root folder as before.
2026-11-20 20:03:26 +01:00
Abdessamad Derraz 8bc1fcb5db refactor: index the database by path once
model.database.record_at and sha1_at read one cached path index with
normpath keys. They replace records_by_path of resolve.packfiles, the
manifest's own sha1 index, the per-call indexes of regionaudit,
emulatorcheck and hidden_extras, and the linear scan of held_record.
resolve_sha1 drops its by_path argument. A path spelled with ./ or a
doubled slash now finds its record everywhere; the database writes none,
so the output is the same.
2026-11-20 20:03:26 +01:00
Abdessamad Derraz 1c978f3083 refactor: fold destinations with one rule
comparable_destination moves to core.paths. Placed, placement_block,
the shared group merge of model.platforms and LauncherPlace.fold read it
in place of their own lower(). It also trims surrounding blanks and
slashes and folds with casefold: no destination, collection path or
launcher name differs under those rules today, so the output is the
same.
2026-11-20 20:03:26 +01:00
Abdessamad Derraz 899f591575 refactor: name the profile kinds in model.profiles
lists_files(profile) answers whether a profile declares files, false
for a launcher or an alias, and is_emulator(profile) whether it counts as
an emulator, false for an alias or a test core. Eighteen inline checks in
model, resolve and packs read them; each keeps the set it tested.
model.systems keeps its own check: it sits below model.profiles. No
behavior change.
2026-11-20 20:03:26 +01:00
Abdessamad Derraz f61c2cb7d4 refactor: one network layer for the scrapers
Each network job had several copies. One is kept per job and
every caller uses it.

- Source revision: model.sourcerevision (source_revision, required_revision,
  platform_revision) replaces BaseTargetScraper's pattern list, the
  exporter's _REVISION, the four launcher_revision copies and RetroBat's
  own YAML reader. It reads the union of the shapes: GitHub raw, blob and
  tree with or without a path after the revision, GitLab raw, blob, tree
  and archive, codeload tar.gz and zip. The target scrapers now answer
  for RetroDECK, NextUI, MinUI and MyMinUI, whose tree URLs end at the
  commit, and the exporter reads GitLab blob and tree and codeload zip.
  EmuDeck and RetroBat still require a 40-hex commit, and each launcher
  reader requires its own repository in the URL.
- Latest release: fetch_github_latest_version, type-checked, is the only
  lookup. mame_hash_scraper, romset_dat_importer and the Lakka target
  scraper call it. romset_dat_importer's NoReleaseError is gone: a
  release without a tag raises RuntimeError.
- Tree listing: github_tree and tree_entries refuse a truncated or
  unreadable listing. The libretro and core-info scrapers share
  core_info_files and fetch_info_file, with libretro's refusal of an empty
  listing. The core-info listing and the RetroDECK, ROCKNIX launcher and
  libretro listings were not checked for truncation before.
- GET: fetch_bytes is the one request path. fetch_text, fetch_present
  (None on 404 only), github_json and download are built on it, so every
  read retries 429 and 5xx, caps the body and raises FetchError, a
  ConnectionError carrying the HTTP status. The target scrapers' own
  fetch_text raised RuntimeError: they now raise FetchError, and an
  optional Batocera board include is skipped on 404 only, not on any
  failure. The exporter's originals, MiSTer, RetroPie, redump and the
  buildbot index go through it too.
- Headers: core.upstream.forge_headers is the one builder. The token goes
  to api.github.com and raw.githubusercontent.com, the host compared
  whole, as Bearer. A URL that only names api.github.com in its query
  got the scrapers' token before, and profile_sync sent its token to
  github.com, whose release downloads redirect to asset storage with the
  header. Scraper reads of raw files now carry the token.
- Submodule commit: submodule_commit checks that the path is a
  submodule. Batocera's target scraper accepted any contents answer with
  a sha, a directory's tree sha included.
- Download: download streams through a scratch file renamed into place,
  retries like fetch_bytes, can keep an existing file and returns the
  Content-Disposition. It replaces the _download of romset_dat_importer
  and game_dat_importer.
2026-11-20 20:02:15 +01:00
Abdessamad Derraz cf03dcb2ef refactor: share CLI options and default paths
core.paths holds the default database, platforms, emulators and bios paths, core.cli declares the options built on them (add_repo_inputs) and the --emulator/--system modes verify and generate_pack share. model.targets.target_scope answers --target for a command line, model.profiles.no_profile_for_systems the system with no emulator. tests/sources.declared_options reads the options a script declares through either form.
2026-11-20 18:28:46 +01:00
Abdessamad Derraz 348d5b51c3 refactor: read hashes and the registry one way
Hash fields go through core.hashing.parse_hash_list, which also splits comma-joined list items: the truth model compared a comma-joined sha256 list as one value. _registry.yml goes through load_platform_registry (required= where an absent file must stop the run), database.json through load_database, file and member digests through file_digest and stream_hashes. download.py and check_release read SHA256SUMS.txt with one parser: a sha256sum -b line matched nothing in download.py and the pack went unchecked.
2026-11-20 18:28:40 +01:00
Abdessamad Derraz 3853ca2f1c refactor: public names for cross-module reads 2026-11-18 22:59:51 +01:00
Abdessamad Derraz 238f70c7a7 refactor: one copy of each duplicated helper 2026-11-18 22:16:55 +01:00
Abdessamad Derraz c4fdf12874 refactor: release, installer_build, devtools pkgs
The release tools, the installer build tools and the repository's
commit and PR checks keep their commands and move their code into
three packages. The release record readers move to model.releaserecord,
romfolders to model, the buildbot check to scraper. The site reads the
handheld launchers and the bootstrap pin from installer_build.
2026-11-18 20:44:12 +01:00
Abdessamad Derraz fdb7b6f912 refactor: host lock and measurement records go low 2026-11-18 20:37:33 +01:00
Abdessamad Derraz cbfa26f315 refactor: one manufacturer slug in the collection 2026-11-18 19:31:28 +01:00
Abdessamad Derraz 01ade3970c docs: name the new homes of moved site code 2026-11-18 19:31:28 +01:00
Abdessamad Derraz 29f5c48a2c refactor: system names and guides below packs 2026-11-18 19:31:27 +01:00
Abdessamad Derraz 0b532366d0 refactor: move pack library code into packs/ 2026-11-18 13:47:31 +01:00
Abdessamad Derraz 8738179f42 refactor: move the region audit library down 2026-11-18 13:38:44 +01:00
Abdessamad Derraz e1f2f8685d refactor: move upstream, sourceref, version_basis
upstream reads forges with the standard library alone and scrapers,
packs and the site read it: it goes to core. sourceref is the grammar
of a profile field, which the site parses without the comparison
tool: it goes to model. version_basis is read by profile_sync alone
and opens the profiling package.
2026-11-18 12:39:09 +01:00
Abdessamad Derraz bcb99cf761 refactor: break the launchers and layout cycle
resolve.layout imported resolve.launchers inside functions, and
launchers imported the outer roots back from layout inside functions:
the cycle common.py and launchers.py had. The outer roots and
outer_layout read only the platform config, so they move to
model.declarations beside declared_root, and launchers imports them at
the top.
2026-11-18 11:39:59 +01:00
Abdessamad Derraz c764d9abf1 refactor: split the leaf modules libraries use
model.region holds the region vocabulary, resolve.regions the selection
that needs the cores a platform runs. The libraries behind identity.py,
retired_files.py and torrentzip.py move to resolve.identity,
model.retired and core.torrentzip, with their long docstrings; the
commands stay where they are run from. The source_ref parts that cite a
config or feature file move from scraper.shell_launchers to
resolve.launcherrefs, so resolve no longer imports the scraper package.
2026-11-18 11:39:47 +01:00
Abdessamad Derraz 83cfa6fd0f refactor: split common.py into three packages
core: cli (run_cli, input errors, name hints), github (token), paths.
model: sources, database, composition, registry, platforms,
declarations, targets, systems, profiles, cliargs. resolve: content,
ownership, datadirs, archives, localfile, directories, layout,
contentlayout, standalone, grouping, cores.

Definitions move verbatim; common.py and its re-exports are gone and
every importer, patch target and code-in-string names the new home. A
test that stubbed common.load_platform_config stubs each module that
reads the loader by its own name.
2026-11-18 11:09:13 +01:00
Abdessamad Derraz c784aef883 refactor: move leaf modules into packages
core: hashing, artifacts, ziptools, deterministic_zip, romdir, sect233r1,
crypto_verify, paths (REPO_ROOT). model: safeparse (needs yaml),
dumpcatalog, largefiles, alternatives. resolve: nativemode, validation,
launchers, slot, truth, gamedata, and exporter/baseline.py and
exporter/candidates.py as resolve/reconcile.py and resolve/categories.py,
which truth and gamedata read.

Every importer follows. Modules one level deeper read the repository
root from core.paths instead of __file__.
2026-11-18 10:50:45 +01:00