Commit Graph
2760 Commits
Author SHA1 Message Date
Abdessamad Derraz 8bc497cf15 fix: check zip member paths with core.ziptools
The data directory refresh dropped any name containing .. in silence,
wrote a backslash as a filename character and let a drive letter or a
backslash traversal through. The pack integrity check flagged Read..me
as a traversal. Both now use safe_member_parts, and an unsafe member
fails the refresh of its key instead of thinning the tree.
2026-11-21 06:00:53 +01:00
Abdessamad Derraz 79e5eae036 fix: retry site image and redump requests
fetch_site_images goes through fetch_bytes and the redump datfile HEAD
through open_retrying: one 429 or reset no longer stops either.
2026-11-21 06:00:45 +01:00
Abdessamad Derraz 837cc73937 fix: fetch acquisition sources with core.upstream
A read that timed out raised TimeoutError past every handler and ended
the search for every remaining file, a 429 was never waited out, and an
oversize body at the name URL skipped the destination URL.
2026-11-21 06:00:45 +01:00
Abdessamad Derraz 8bfa188960 fix: build github api headers with forge_headers
download.py read GITHUB_TOKEN only and missed the gh login token, the
readme built its header by hand, and the large files listing cached one
failed request as an empty release for the whole run.
2026-11-21 06:00:45 +01:00
Abdessamad Derraz 6138d43dfb fix: resolve data dir revisions with core.upstream
get_remote_sha parsed a GitLab subgroup as its first two segments, asked
the branches endpoint, which resolves no tag, sent the token to any URL
containing github and skipped the refresh on one 502. resolve_head reads
subgroups, encodes the ref, scopes the token and retries.
2026-11-21 06:00:44 +01:00
Abdessamad Derraz 95ed63a3f3 refactor: one etag probe for buildbot and refresh
The buildbot check now waits 30 s like the refresh, not 15.
2026-11-21 06:00:31 +01:00
Abdessamad Derraz 85f60ec525 refactor: build path commit listings in core 2026-11-21 06:00:20 +01:00
Abdessamad Derraz fdd7595a71 refactor: one retrying fetch loop in core.upstream
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.
2026-11-21 06:00:20 +01:00
Abdessamad Derraz 75b5fb987e fix: check zipped pack members like the builder 2026-11-21 06:00:14 +01:00
Abdessamad Derraz 434d660647 refactor: route atomic writes through one helper 2026-11-21 06:00:14 +01:00
Abdessamad Derraz 856883f690 refactor: share file key and member size bound 2026-11-21 05:59:58 +01:00
Abdessamad Derraz b5cfa9179f refactor: drop the unused deterministic zip writer 2026-11-21 05:59:58 +01:00
Abdessamad Derraz 3fa2f77722 refactor: share one timestamp key table 2026-11-21 05:59:58 +01:00
Abdessamad Derraz 6df0ec503b refactor: stamp site data with build_timestamp 2026-11-21 05:59:58 +01:00
Abdessamad Derraz 88ee986ee6 refactor: check --bios-dir of generate_db once 2026-11-21 05:59:51 +01:00
Abdessamad Derraz fc70a1afa6 fix: accept core names in profile_sync and audit 2026-11-21 05:59:51 +01:00
Abdessamad Derraz 0107ac8062 refactor: read entry systems with entry_system_ids 2026-11-21 05:59:51 +01:00
Abdessamad Derraz 91b27854c8 refactor: name the emulator profile filters 2026-11-21 05:59:51 +01:00
Abdessamad Derraz 8fdc00e07f refactor: look up a path's sha1 with sha1_at 2026-11-21 05:59:51 +01:00
Abdessamad Derraz 82d3f595de refactor: read data/.versions.json in one place 2026-11-21 05:59:51 +01:00
Abdessamad Derraz 67cb99606d refactor: read data dirs and inherits in one place 2026-11-21 05:59:51 +01:00
Abdessamad Derraz 7be8a7cd7b fix: stop on one line when pyyaml is missing 2026-11-21 05:59:51 +01:00
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 0bf9b04bc0 refactor: read rocknix-systems like batocera
parse_systems read the systems dict with regular expressions beside extract_systems_dict. It now uses the shared reader: on the cached rocknix-systems both give the same 14 systems and entries.
2026-11-20 20:05:47 +01:00
Abdessamad Derraz 1dc99849bc refactor: read pack part names from packs.parts
download.py kept its own copy of the part-name pattern. packs.parts.part_of gives the pack, part number and count, and is_part is built on it.
2026-11-20 20:05:46 +01:00
Abdessamad Derraz f025264f4e refactor: link platform lists through permalinks
ListSource.browse builds file links with source_permalink, which quotes
the path. A list read at no revision still links the repository, and a
GitLab list with no path now links its tree instead of a blob URL
ending in a slash.
2026-11-20 20:03:26 +01:00
Abdessamad Derraz d56c3e6e22 chore: drop the unused large-files asset fetch
release.assets.fetch_assets had no caller: check_release reads release.check.fetch_assets, and check_release_assets reads fetch_release.
2026-11-20 20:03:26 +01:00
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