Commit Graph
52 Commits
Author SHA1 Message Date
Abdessamad Derraz b520e48798 refactor: move profile selection into profiling
select_profiles and version_selection go to profiling.selection, the flag
refusals to profiling.flagchecks. main calls selection, quota and the
profile loader through their modules, so tests patch them there.
generate_truth's parse_args becomes build_parser.
2026-11-21 15:47:20 +01:00
Abdessamad Derraz 61547d08b3 fix: let make_site_icons answer --help 2026-11-21 14:59:03 +01:00
Abdessamad Derraz 2428d92e6a refactor: move the truth diff into exporter 2026-11-21 14:59:03 +01:00
Abdessamad Derraz 75a69a4a42 refactor: move profile_sync logic into profiling 2026-11-21 14:59:03 +01:00
Abdessamad Derraz 2486c06932 chore: drop the stale token reader exemption 2026-11-21 14:58:26 +01:00
Abdessamad Derraz 6ba52a9682 refactor: move verify, slots, crossref into packs
The three commands keep their parser, main and printing. Scans, scopes,
report text, the JSON forms, the strict gate and the destinations file
live in new packs modules, one subject each.
2026-11-21 14:58:26 +01:00
Abdessamad Derraz 7ff8b5faf6 fix: read pipeline caches from the repository root 2026-11-21 14:58:02 +01:00
Abdessamad Derraz 985d07b97e refactor: move pipeline steps into orchestrate 2026-11-21 14:58:02 +01:00
Abdessamad Derraz fbbb941e38 refactor: one owner for the test scratch folder
Test modules passed dir= the repository's tmp/ or a hard-coded tmp/tests by hand, and seven modules kept their own _tempdir copy. Under run_tests.py the literal tmp/tests did not exist in a fresh clone (FileNotFoundError in test_core_probe and scratch_checkout), and dir=tmp/ wrote beside the per-module scratch folders. Every temporary directory now lands in the folder tests/__init__ sets, and scratch_dir() replaces the copies. The X socket binds by a relative name, since a scratch path can exceed the 108-byte AF_UNIX limit. The journeys keep the short tmp/ root: their word budgets count the printed card path.
2026-11-21 06:04:40 +01:00
Abdessamad Derraz ee66aa4e66 fix: scope --target the same way in every tool
slots and cross_reference go through model.targets.target_scope, so a
mistyped target ends with ERROR and exit 1 as in verify, where they
exited 2. The platforms --all skips are noted on stderr, which kept
slots --json from printing them ahead of its document. slots reads the
mode through platform_mode and builds the ZIP index and data-directory
registry once per run instead of twice per platform.
2026-11-21 06:04:31 +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 fc70a1afa6 fix: accept core names in profile_sync and audit 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 812f2609db fix: read every source yaml as utf-8 2026-11-21 05:59:51 +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 0b532366d0 refactor: move pack library code into packs/ 2026-11-18 13:47:31 +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 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
Abdessamad Derraz 5f18caec31 refactor: put scripts/ on the test path once
tests/__init__ now puts the repository root and scripts/ on sys.path,
so no test module inserts them and every import sits in the import
block. ruff accepts the bare `import tests` the modules keep for its
side effects. The last suppressions go: helper test modules import as
tests.<name>, files open in with blocks, lambdas become functions.
2026-11-17 16:11:23 +01:00
Abdessamad Derraz cc028fe7ee chore: clear the ruff findings in tests 2026-11-17 07:21:28 +01:00
Abdessamad Derraz 4eacb6ff39 chore: lint scripts and tests with ruff
pyproject.toml now carries the ruff rule set: pyflakes, the B rules,
simplify, perf, pyupgrade, complexity and size limits. This commit
applies the fixes that change no behavior and the small defects the
first run named:

- tests/test_install.py used argparse without importing it
- three loops rebound the outer `profile` with each layout
  (packextras, slots, verify); the loop variable is now `layout`
- profile_sync loops shadowed dataclasses.field
- generate_readme and packextras computed values nothing read
- stale noqa markers for rules the project does not enforce

Complexity, size and the remaining findings are handled next.
2026-11-17 07:07:48 +01:00
Abdessamad Derraz 6c14468862 feat: say the installer and setup pages plainly
- The installer speaks without "you": the first screen asks "Where
  to install?", rows read "Copy the BIOS files from an old card or a
  folder", a close match reads "Close matches: ...". The handheld
  launchers and their port text follow, and the pronoun guard no
  longer lists any installer message.
- A setup that runs as an app opens on its one-line command, the
  folder table after it; a setup that runs on its own device keeps
  the network folder first, which its ZIP route needs.
- The home steps say what to do: "Its page gives one line to copy",
  "Paste it, press Enter".
2026-11-09 16:33:56 +01:00
Abdessamad Derraz 8e3ba2cfd3 chore: merge scraper and tool fixes 2026-11-06 16:36:32 +01:00
Abdessamad Derraz 057fd2d0f6 fix: isolate every test module however it runs
tests/__init__.py keeps a run offline, its scratch under tmp/ and its
installer cache its own, but only discover -s tests -t . imported it.
discover tests ran with RETROBIOS_OFFLINE unset, scratch on the /tmp
tmpfs and the user's real installer cache, the setting in which e2e
fixtures had written into the shared .cache/large. Every test module now
imports the package first, and a test fails on a module that does not.
test_verify_listing.py took its line with the previous commit.
2026-11-06 15:14:05 +01:00
Abdessamad Derraz 1b4b31fb32 fix: run the read-only tools from the repo root
Only verify.py and generate_pack.py moved to the repository root. From
any other folder slots, region_audit, provenance_report and bundled_only
said database.json was missing and to rebuild it, identity and
list_platforms named a missing folder, and game_rules ended on a
FileNotFoundError traceback. work_from_repo_root moves to common.py and
the eight tools call it: defaults are read from the root, a path the
user typed from where it was typed.
2026-11-06 15:09:35 +01:00
Abdessamad Derraz bf10ebaa82 docs: say verify --all covers every platform
The --all help still read 'Verify all active platforms' after the
archived status was dropped. --all covers every registered platform.
2026-11-06 15:06:42 +01:00
Abdessamad Derraz 1fe37d16ac fix: keep stderr after the report it closes
verify.py --emulator fbneo --strict > log 2>&1 put the ERROR verdict on
the first line of the log: redirected, stdout is block-buffered and
stderr is not, and run_cli flushed stdout only after main returned.
run_cli now sets stdout to line buffering, so every tool it runs keeps
the two streams in the order they were written.
2026-11-06 15:06:26 +01:00
Abdessamad Derraz 1834d20dc9 fix: name the file a YAML syntax error is in
Every profile is loaded whatever the command, so one misindented key in
an unrelated profile stopped verify.py --emulator handy and generate_pack
on a 37-line yaml traceback. The sources common.py reads (profiles,
platform files, registry, shared groups, targets) now raise
SourceUnreadable, which run_cli prints on one line with the file, the
line and the validate_schemas command. It is not a FileNotFoundError:
ten callers skip a platform whose file is absent, and a damaged one must
not be skipped the same way.
2026-11-06 15:02:01 +01:00
Abdessamad Derraz de8f20f409 fix: count listed systems in the --system hint
A mistyped --system said '--list-systems lists all 579' and the listing
prints 532: the hint counted every spelling across profiles, and
system_index merges the ones that differ in case or separator before
printing. Both verify.py and generate_pack.py now pass that count to
suggest_names, whose listed parameter exists for this case.
2026-11-06 14:55:40 +01:00
Abdessamad Derraz 2d1c889d41 refactor: name the database option --db everywhere 2026-11-06 14:42:05 +01:00
Abdessamad Derraz 4d3f589ef4 refactor: drop the archived platform status
RetroPie was the only platform with status: archived, which kept it out
of verify --all, slots, the pipeline and list_platforms unless
--include-archived was typed. release_pack already decides which packs a
release publishes and the installer serves every platform, so the status
set nothing apart. The field, its schema entry and the flag are gone, and
RetroPie is covered by every full run like any other platform.
2026-11-06 11:52:34 +01:00
Abdessamad Derraz f255efca0f docs: list pipeline flag refusals in one table
tools.md said --full-narrowings is refused with --skip-packs only, while
pipeline.py also refuses it with --source platform or truth, and
advanced-usage.md kept a second, shorter list. The tools table now
carries every pair, checked against _refuse_unapplied_flags, and
advanced-usage links to it.
2026-11-06 08:27:59 +01:00
Abdessamad Derraz da9e1f568c fix: refuse an offline export with no originals
pipeline.py --offline --with-export, listed as a standard command, passes
no --fetch to step 2e: on a fresh clone the database, verify and truth
were built before the export failed on every platform whose own file it
patches. The run is refused before step 0 when .cache/upstream-native/
holds nothing for such a platform, and tools.md says how to fill it.
2026-11-06 08:27:32 +01:00
Abdessamad Derraz 4b54b82966 fix: suggest the target when no platform has it
verify --all --target swich ended on 'no platform has it' after seventeen INFO lines, two of which held the suggestion. The refusal now names the closest targets across every platform with the platforms that have them, and the per-platform lines print only when some platform keeps the target.
2026-11-05 19:21:23 +01:00
Abdessamad Derraz 9ae3919d34 fix: spell cited commands so a paste runs them
Messages in check_freshness, generate_pack, common, profile_sync and fileless_audit named commands as export_native.py --platform x, which fails from the repository root. They now read python scripts/<name>.py like the rest of the report.
2026-11-05 19:19:04 +01:00
Abdessamad Derraz b90f8bb0b9 chore: merge tooling batch 2026-11-05 15:57:19 +01:00
Abdessamad Derraz 4fbc028e20 fix: refuse an offline run with no data cached 2026-11-05 11:54:47 +01:00
Abdessamad Derraz 6190f30d2d fix: account for every profile entry in gaps 2026-11-05 11:53:29 +01:00
Abdessamad Derraz f2e25aeea2 feat: list platforms with --list-platforms
install.py took --list-platforms, generate_pack.py --list and verify.py
nothing. Both tools now take --list-platforms and print the same list
from common.py. generate_pack.py keeps --list (finding 80).
2026-11-05 11:52:26 +01:00
Abdessamad Derraz 0c92fb6705 fix: suggest the closest data directory key 2026-11-05 11:46:30 +01:00
Abdessamad Derraz 609710e2d7 fix: say a platform has no hardware targets
The error named platforms/targets/<name>.yml, which read as a file
missing from the repository (finding 63).
2026-11-05 11:42:46 +01:00
Abdessamad Derraz f3fe6f58b4 fix: name the path of a file read at two places
MyMinUI printed the same MISSING line twice for Bios/FBN/ and Bios/NG/
sfiii2a.zip (finding 78).
2026-11-05 11:41:46 +01:00
Abdessamad Derraz 666883ad53 fix: print missing core files under their count
They came after the held-but-not-packed line and read as files
installed with their emulator (finding 79).
2026-11-05 11:41:02 +01:00
Abdessamad Derraz 5e4becf876 fix: count each reason a held file is not packed
The first entry's reason stood for the whole count: 16 Lakka files
under one cause that 2 of them carried (findings 23 and 76).
2026-11-05 11:40:40 +01:00
Abdessamad Derraz 6e77da4b82 fix: write every platform count in the summary
A platform with one entry had no number, so the named counts did not
add up to the total (finding 81).
2026-11-05 11:39:25 +01:00
Abdessamad Derraz 32c648b67d feat: release packs for marked platforms only
release_pack: true in the registry is the list a release builds: RetroArch,
EmuDeck, RetroBat, Batocera, RomM and MiSTer, 83% of the downloads of
v2026.10.10. generate_pack --all, --verify-packs, the pipeline consistency
step, release_record and check_release read it. Manifests are still written
for every platform.
2026-10-23 17:06:46 +02:00
Abdessamad Derraz 96674273c0 fix: write the pipeline export to exports/ 2026-10-21 11:10:38 +02:00
Abdessamad Derraz 2eee7a991d fix: accept -p and -t in every tool
verify, generate_pack and cross_reference took -p and -t, slots, generate_truth, diff_truth, export_native and refresh_data_dirs refused them. A test reads every add_argument call.
2026-10-21 10:11:22 +02:00
Abdessamad Derraz fac47dc4c0 fix: say how to run the schema check step 0 skips
Without jsonschema the step printed only the missing module, and the run then read COMPLETE while PR validation runs the same check. The skip now names the install command and the PR check.
2026-10-21 10:09:28 +02:00