Commit Graph
2880 Commits
Author SHA1 Message Date
Abdessamad Derraz 2f8f78b6b5 refactor: one git runner and main line fallback
core.gitclone gains required_git_lines, which raises GitRefused with
git's error, and fallback_lines, the remote lines tried when no remote
names the project. profile_sync and validate_pr use both.

profile_sync --changed without --base now also finds a clone whose main
line is upstream/master, upstream/v2, origin/master or origin/v2, as
validate_pr already did, before falling back to HEAD.
2026-11-20 20:03:26 +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 e6e4095081 refactor: read the site build commit in one place
sitegen.config.build_commit (GITHUB_SHA in CI, HEAD locally, a full
commit id or an error) replaces the copies in bootstrap, pagemarkdown
and dataexports.

The page stamps now refuse a GITHUB_SHA that is not a commit id. The
data exports now name GITHUB_SHA when it is set, and still name no
commit outside a checkout.
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 ab0805e6cb refactor: print sizes with one function
core.sizes.size_text replaces readme format_size, release record
size_text, render fmt_size, the large-files notes _mib and the handheld
_size. It prints one decimal in the largest unit reached, as the site
and the installer already did.

The README download table, the release notes and the large-files page
now say 29.2 MB where they said 29 MB, a handheld archive says 85.3 KB
where it said 85 KB, and a large-files asset under 1 MB is given in KB.
2026-11-20 20:03:26 +01:00
Abdessamad Derraz 3a76cf48ba refactor: share resolver, content and nightly
The probes resolve held files, read content.yml, list the buildbot and
fetch nightlies through one function each.

- region_check resolves BIOS files from the repo root (probes.entries
  held_file), so a run outside the root no longer sees every file missing.
- region_check reads content.yml as Content objects, and a malformed
  content folder raises Unavailable instead of FileNotFoundError.
- region_check and pack_probe fetch nightlies like the campaign: retried
  on network errors, streamed to disk, and replaced when the buildbot's
  ETag or Last-Modified moves. region_check keeps its cores under
  .cache/region/cores/<core>/ with a build.json record. pack_probe
  --refresh-cores now downloads only a nightly the buildbot replaced.
- The campaign loads profiles with load_emulator_profiles, so *.old.yml
  backups are skipped and hashes are normalized. Profile digests still
  come from the file on disk, so recorded checks keep their digest.
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 ca3ff1d4c5 refactor: place every file through Placed
data_directory_members, pack_data_tree and manifest_core_entries take
the Placed record instead of three loose sets and a fold flag, and verify's
replay of the builder (_builder_placement), hidden_extras and the
emulator pack check keep a Placed of their own. hidden_extras records the
sha1 at each taken path through the new Placed content option, which keeps
its same-content case twin rule. No behavior change.
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 b679edb133 refactor: one rule for system and maker names
packs.naming.system_display_name names a system in a pack file name,
read by system_tag in place of its copy of the loop. names_manufacturer
spells a maker through model.collection.manufacturer_slug, and
resolve.identity reads the maker folder with ownership.maker_of_relative,
the rule maker_folder applies. No behavior change.
2026-11-20 20:03:26 +01:00
Abdessamad Derraz 6b3a588231 refactor: walk the collection's zips once
build_supplemental_index and _supplemental_locations each opened every
ZIP under bios/. Both read _zip_members, cached per root, so an
unreadable archive is reported once instead of twice. No other change.
2026-11-20 20:03:26 +01:00
Abdessamad Derraz cc85999e22 refactor: read zip member crcs in one place
core.ziptools.readable_zip_member_crcs answers None for a file that is
no readable archive, and zip_member_crcs reads it as empty. The covering
archive choice of resolve.packfiles uses it in place of its own reader,
so it still gives up on an unreadable candidate and now shares the cache.
No behavior change.
2026-11-20 20:03:26 +01:00
Abdessamad Derraz 187d9ea5e4 refactor: look regions up through lookup_slot
lookup_regions walked the destination, its suffixes and the name
again. It now projects the entry lookup_slot finds. No behavior change.
2026-11-20 20:03:26 +01:00
Abdessamad Derraz 8f153e2b89 refactor: read a platform's check mode one way
nativemode.platform_mode(config) replaces the inline
config.get("verification_mode", "existence") of the builder, the
manifest, slots, integrity, extras, gaps, coverage and review. A value
outside the schema enum now falls back to the default everywhere, as
coverage already did. Every platform declares a valid mode.
2026-11-20 20:03:26 +01:00
Abdessamad Derraz 1b0389f6ca refactor: share line spans with the shell readers
csharp_source formats a source_ref through shell_launchers.merge_lines
and finds lines through core.lines.LineIndex. Its span merge joined the
same one-line gaps, so retrobat.yml refs are unchanged.

retropie_launchers keeps its adjacent-only rule: merge_lines would
rewrite lr-prboom.sh:86, 88 in four committed retropie.yml records.
2026-11-20 20:03:20 +01:00
Abdessamad Derraz facebef9e5 refactor: index source lines once per file
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.
2026-11-20 20:03:20 +01:00
Abdessamad Derraz 0332f6149a refactor: read RetroPie scripts from one tarball
script_members in retropie_scraper yields every shell script of a
RetroPie-Setup tarball. The platform scraper, the exporter and the target
scraper read the scripts through it. The target scraper fetched one
contents listing per section and about 200 raw files; it now reads the
tarball of the pinned revision in one request. On the cached tarball the
three produce the same module ids, scripts, BIOS-bearing scripts and
targets as before. The targets file keeps its source URL.
2026-11-20 20:03:09 +01:00
Abdessamad Derraz f7c08a6ca3 refactor: read md5 lists through parse_hash_list
The RetroDECK and Recalbox exporters compare md5 lists with
resolve.reconcile.hash_values, and the RetroDECK scraper reads an entry's
md5 with md5_field and parse_hash_list instead of its own copy.

Recalbox's comparison no longer keeps an empty item: md5="a,,b" states
a,b where it stated ,a,b. The RetroDECK scraper now splits a
comma-joined value and refuses an md5 that is neither a string nor a
list of strings, as the batocera-systems readers do. The ten cached
component manifests write neither form, so retrodeck.yml is unchanged.
2026-11-20 20:02:44 +01:00
Abdessamad Derraz e19025231e refactor: locate the systems dict once
systems_span in batocera_scraper finds the systems literal of a
batocera-systems script by reading strings of either quote and
comments, and accepts systems = OrderedDict({. The exporter cuts the
script at those braces and reads comments with the same comment_start,
in place of its line prefix rule, its ast fallback and a comment test
that only knew double quotes. Both give the same cut on the cached
Batocera, AmberELEC, EmuELEC, KNULLI and ROCKNIX scripts.

An unclosed dict is refused by name instead of failing in literal_eval.
2026-11-20 20:02:44 +01:00
Abdessamad Derraz db1446079a refactor: read listxml through one streamer
scripts/scraper/listxml.py holds the element window, attribute
reader, ROM member extraction and open_listxml that romset_dat_importer,
mame_devices and arcade_parent_importer each wrote. On mame0289lx.zip
and the 19 FBNeo DATs the three produce the same recipes, release and
sets as before.

Attribute values are entity-decoded everywhere: romset_dat_importer
kept f&amp;m.basic.bin where the archive member is f&m.basic.bin. The
five comx_eb member names of recipes/mame.json are corrected to what a
re-import now writes. A release zip with no or several .xml members is
refused by name instead of raising StopIteration.
2026-11-20 20:02:44 +01:00
Abdessamad Derraz 3505eaa835 refactor: walk es_systems.yml once
es_systems_entries yields (system, emulator, core, spec) and the four
batocera_scraper readers and the target scraper's package map are built
on it. Output is identical on batocera-43.1's es_systems.yml.

The target scraper now raises on a file that is not a mapping or does not
parse, where it returned an empty map and failed later on 0 mappings.
2026-11-20 20:02:30 +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 7cd499531d refactor: share scraper and launcher helpers
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.
2026-11-20 18:28:33 +01:00
Abdessamad Derraz ac16875c5b fix: date the site period from its first count 2026-11-20 08:18:16 +01:00
Abdessamad Derraz 84f749fda9 feat: read GoatCounter counts from its export
Paging /stats/hits by exclude_paths spent more than the 500 requests
GoatCounter allows in an hour on four weeks. The JSON export holds the
same hourly counts by path and referrer: on 2026-11-10 to 16 it gave
67,877 views and 24,343 actions, the figures /stats/total gives, with
identical top paths and referrers. One export an hour is allowed.
2026-11-20 07:17:36 +01:00
Abdessamad Derraz 075ae0d9ad fix: keep a smaller GoatCounter window once full
A day over the excluded-path cap was read whole, then again in halves,
and the next day the same. Four busy weeks spent the 500 requests
GoatCounter allows per hour before the report was written. The window
now keeps the size that fit, so the overflow is paid once.
2026-11-20 04:37:46 +01:00
Abdessamad Derraz 219ad52a68 docs: split a docstring clause chain 2026-11-20 04:35:23 +01:00
Abdessamad Derraz 56290f3bb7 fix: name an unanswered directory by its path 2026-11-19 20:23:54 +01:00
Abdessamad Derraz b4b4ddffb5 feat: give every Nintendo console its own page
"gba bios" landed on mGBA's page because the Game Boy Advance was a section of the Nintendo page. CONSOLE_PAGES now splits Nintendo as it does Sony: eleven more consoles get a page (Famicom Disk System, Game Boy Advance, Game Boy Color, Nintendo 64, Pokemon Mini, Satellaview, SuFami Turbo, Super Famicom Box, Super Game Boy, Switch, Wii). Each section keeps its heading and anchor on the Nintendo page and leads to the console's page. The search gate expects the Game Boy Advance, Game Boy Color and Wii pages first for their queries.
2026-11-19 19:58:08 +01:00
Abdessamad Derraz 2d587749a5 feat: move two long gap tables to their own pages
The per-emulator table (339 rows) and the files not collected yet (282 rows) held most of the 8,300 elements of /gaps/, laid out in one 200 ms task on a phone. Each is now a page of its own linked from its section, which keeps its heading and anchors (per-emulator, not-collected-yet, acknowledged-gaps) with the row count. Emulator cards link the new page. Mobile Lighthouse Performance on /gaps/ goes from 99 to 100.
2026-11-19 19:58:08 +01:00
Abdessamad Derraz 9760c2fadd fix: size the upstream table by a class
The cross-reference upstream table was reached with
.sl-heading-wrapper:has(> #by-upstream-emulator) ~ section, which the
browser matched again for every block added after any heading of any
page: about 400 ms of style work while the gaps page loads (mobile, 4x
CPU throttling, 586 ms down to 200 ms). The table sits in a
.rb-xref-upstream block, and the address column is its second.
2026-11-19 18:42:55 +01:00
Abdessamad Derraz 76468c6599 fix: keep goatcounter addresses under 8 kb
The server accepted 8,125 characters and dropped the connection at
10,125. Windows are read day by day with at most 700 excluded paths, so
fewer overflow and get read twice.
2026-11-19 18:17:12 +01:00
Abdessamad Derraz 950aa6de25 feat: put the command first on split pack pages
A get/ page whose release pack comes in parts opens on the command, then offers the parts and says all are needed. A pack in one file keeps its ZIP first and now shows the command after it.
2026-11-19 17:46:30 +01:00
Abdessamad Derraz 2d1727822d feat: title pages by what their files are
An emulator or system page title names keys, firmware or BIOS files from its file names: each kind that holds a quarter of the distinct names. Eden keys, Vita3K firmware, Citra keys and BIOS files; mGBA stays BIOS files.
2026-11-19 17:46:30 +01:00
Abdessamad Derraz 7623ead3db feat: rank search pages by clicks lost
Search Console rows are merged across page anchors. The expected click
rate is the site's own rate at each rounded position, so a search is
flagged when clicked less than half of it. A by-page table ranks pages
by clicks lost, with changes against the period before. Each section
states its period, and release downloads show the change since the
snapshot the previous run left in .cache/insights/.
2026-11-19 16:51:32 +01:00
Abdessamad Derraz 070a5a1ba6 fix: read goatcounter hits in weekly windows
Paging the whole span with exclude_paths grew the address past what the
server accepts. Windows add up since GoatCounter keeps hourly counts; a
long rate-limit wait now ends the run with its reason.
2026-11-19 16:44:03 +01:00
Abdessamad Derraz 022591a67e fix: settle three validation checks
The retrodeck games fallback is computed from the manifests and went
stale with the data tree manifest change. Two docstrings carried clause
semicolons. The install run test read bytes_done as the sum of finished
files, but it counts every byte arrived, a file still in transfer
included, as progress does; the test now checks that bound and the doc
says it.
2026-11-19 16:11:49 +01:00
Abdessamad Derraz ff69210b18 feat: pin forge data trees, follow nightly ones
A data tree whose source names a revision is fetched at the commit its
branch points to and listed at that commit, whose bytes never change.
A source with no revision (the buildbot's nightly assets) is marked
rolling: the installer writes each listed file as the source serves it,
checked against its ZIP CRC-32, as RetroArch's own downloader does, and
the install record keeps it in place on the next run. The PPSSPP list
refused 49 of 169 files after each buildbot rebuild.
2026-11-19 08:59:42 +01:00
Abdessamad Derraz a9c0dcac3c fix: ship the archive covering a twin md5 pin
RetroDECK pins bios/cdibios.zip and bios/stvbios.zip twice, the older
MAME set for its mame component and the full set for the RetroArch
core. The first pin in system order shipped the smaller set, which
current MAME rejects (cdi.cpp:922 needs the slave MCU ROM). The archive
whose members cover the other now ships: it serves both readers.
2026-11-19 06:33:17 +01:00
Abdessamad Derraz 753d39ffe3 refactor: installer pins keyed by bootstrap file
installer_build.pins read the site's served names from model.guides,
which loads the guides YAML at import. Since the launcher builders read
the pin through it, the installer doc build pulled pyyaml in, and the
Python 3.8 installer job has none.
2026-11-19 02:57:02 +01:00
Abdessamad Derraz 9ac3145c5e refactor: commands read the repository root 2026-11-18 23:14:52 +01:00
Abdessamad Derraz 3853ca2f1c refactor: public names for cross-module reads 2026-11-18 22:59:51 +01:00
Abdessamad Derraz f371790dc6 refactor: hash fields and digests read in core 2026-11-18 22:19:45 +01:00
Abdessamad Derraz 238f70c7a7 refactor: one copy of each duplicated helper 2026-11-18 22:16:55 +01:00
Abdessamad Derraz 2c8a9cfad8 refactor: one digest loop for files and streams 2026-11-18 21:42:28 +01:00