dump_setup moves next to scrape_setup, so readers of the setup format
no longer import the command. base_scraper names its dumper
PlatformDumper, and the command writes through write_if_changed.
Copies of helpers the first pass created, replaced by the helper:
- source_yaml_file for our YAML sources (generate_db read them in the
locale's encoding, a syntax error named no file);
- data_dir_registry_at in registry_bundles, platform_registry_at (new,
beside load_platform_registry) in the manifest;
- DATA_DIRS_FILE for the registry path five modules spelled;
- load_optional_database, sha1_at, VERSIONS_FILE, installer_module;
- DerivedView where a cache was keyed by id() of a dict;
- count_text and series where a plural or a list was written by hand.
Branch heads (scrapers, FBNeo import, data directories) resolve through
core.upstream.resolve_head, with cache_dir=None to keep nothing under
.cache/upstream. Streaming downloads (large files, external pack files,
data directory archives, scraper downloads, standalone probe) go through
one core.upstream.download: scratch then rename, size cap, retries of a
cut stream, a 5xx or a rate limit. The shared rate limit wait reads
GoatCounter's X-Rate-Limit-Reset, so site insights, download.py,
indexnow and the contributor list use the same retrying client.
list_gitlinks raises TruncatedListingError on a partial tree, read
from one tree walk shared with list_tree (Forgejo paging included).
The Recalbox configs/ listing is paged with the shared page cap.
fetch_bytes and fetch_body now share open_retrying and read_limited:
scrapers retry a 500 or a dropped connection like profile_sync, and
fetch_body caps the body it reads.
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.
BaseScraper reads JSON once (_fetch_json, json_object), every scraper files its requirements through systems_from_requirements, and the batocera-systems readers (Batocera, KNULLI, AmberELEC, EmuELEC) inherit CheckBiosScraper. Launcher modules share one Launcher record, one LauncherPatternMissing and one link_record. DAT importers build provenance entries from LogiqxDat.
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.
The scraper read emulatorLauncher master on every run, so an extractor
change was diffed together with upstream's commits since the pin. It now
rereads the commit platforms/retrobat.yml pins. --revision master moves
it, and check_freshness and refresh_stale pass that through the
registry's rescrape_args.
The extractors also read master (f681f435): Kronos and YabaSanshiro
fall back to sega_101.bin then mpr-17933.bin when the chosen BIOS is
absent, Ymir writes a forced BIOS only under its override flag, and a
folder created below bios (Ymir's cdb) is a passes_path record. At the
pin the 187 records are unchanged.
The amiberry and hatarib extractors give a search record and its copy
record one list object, and PyYAML wrote it as &id001 and *id001.
platforms/retrobat.yml, batocera.yml and knulli.yml carried such
anchors. The platform dumper now writes every list out, and the two
files the RetroBat scrape does not rewrite are dumped again through it:
their content is unchanged.
batocera.linux 6b08b873 lets a biosFiles item declare its md5 as a
list of strings, and checkBios accepts a file matching any of them.
The scrapers join the values with commas, as for Recalbox, and record
md5_list so the export writes the list back as a list, byte for byte.
scraper_cli wrote a platform YAML with no system when the parse came back
empty, and exited 0. It now exits 1 before writing, unless the scraper
declares lists_files = False (RetroPie, whose files are inherited); RetroPie
in turn raises when its archive declares no package.
--emulator accepts a buildbot core name from a profile's cores:, and a
mistyped target gets the closest names instead of every target. diff_truth
shows destinations and reports unpaired entries as evidence, not removals.
The verify summary counts discrepancies, a shared destination names both
systems, a truth hash conflict names both cores, and pipeline steps carry
their place in the real run instead of N/8. Every GitHub API caller takes
the token from github_token(), which falls back to gh auth token.
Scrapers resolve their tag or branch head in the constructor, which ran outside the try in scraper_cli: a refused GitHub call ended in a traceback. The error is now printed with the next step, setting GITHUB_TOKEN when the API refused an anonymous call.
Six platforms are read from a branch: System.dat, batocera-systems.json, checkBIOS.sh, the MiSTer BiosDB, the RetroPie scriptmodules and the RetroDECK component manifests. Their YAML named the branch, so the native export patched whatever the branch had become since the scrape. Each scraper now resolves the branch head once, reads every file at that commit and writes it into source. The export follows a recorded tarball and a recorded tree as it already followed a raw file URL.
Profiles, the wiki, comments, docstrings, command output and schema descriptions carried em-dashes, clause-joining semicolons, unicode arrows, box-drawing banners and check-mark glyphs. Each sentence was rewritten rather than having its character swapped. Hashes, paths, source_ref values and every cited file:line are unchanged, which a comparison of each parsed profile against the previous revision confirms.
validate_pr comments now say PASS and FAIL in words, and source_ref values in a profile's structured blocks render as code. test_prose_style fails if any of these comes back, in tracked files or in the generated site.
argparse completed a prefix into the only flag starting with it:
slots.py --emulator read profiles from a directory named after the
emulator and reported nothing, and pipeline.py --all built every pack
variant. Every parser now refuses an abbreviation.
Loading the emulator profiles is the most expensive step of every
command here, and all forty call sites used the pure-Python scanner
while libyaml sat unused in the same wheel. One shared yaml_load picks
the C loader when pyyaml ships it: the 375 profiles parse in 0.18s
instead of 1.39s, and verify --platform retroarch drops from 2.17s to
0.73s. The loader class is the same restricted one safe_load uses.
es_bios.xml was parsed straight from the network while install.py
already refused a document declaring entities; both now share one
guard. Scrapers reach it through a single path bootstrap in the
package rather than two ad-hoc ones.
Run ruff check --fix: remove unused imports (F401), fix f-strings
without placeholders (F541), remove unused variables (F841), fix
duplicate dict key (F601).
Run isort --profile black: normalize import ordering across all files.
Run ruff format: apply consistent formatting (black-compatible) to
all 58 Python files.
3 intentional E402 remain (imports after require_yaml() must execute
after yaml is available).
Add many MAME/MESS BIOS entries (TRS-80 family, Bandai RX-78, Sega AI) and update docs/navigation counts (README, mkdocs). Remove empty supplemental file references from database.json and update generated timestamps and totals. Harden and refactor tooling: add MAX_RESPONSE_SIZE limited reader in base_scraper, make target scrapers an abstract base, narrow exception handling in the Batocera targets parser, and switch generate_pack.py and verify.py to use build_target_cores_cache (simplifies target config loading and error handling). verify.py also loads supplemental cross-reference names and accepts them through verify_platform. Update tests to import from updated modules (validation/truth). Misc: small bugfix for case-insensitive path conflict check.
Identical _fetch_raw() implementation (URL fetch + cache + error handling)
was duplicated in 4 scrapers. Moved to BaseScraper.__init__ with url param.
Each scraper now passes url to super().__init__() and inherits _fetch_raw().
Eliminates ~48 lines of duplicated code.
DRY audit now clean: resolve logic in common.py, scraper CLI in base_scraper,
_fetch_raw in BaseScraper. Remaining duplications are justified (different
list_platforms semantics, context-specific hash computation).