core.lines.LineIndex answers the line of an offset by binary search.
mame_parser and fbneo_parser counted the newlines before each match,
O(n) per set, and csharp_source kept its own copy of the index.
arcade_parent_importer reads a profile's repository slug through
core.upstream.parse_repo and refuses a source that is not on GitHub,
the only forge its fetches reach.
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.
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.
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.
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.
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.
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.
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__.