mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-12-02 22:38:54 -06:00
refactor: one naming style per package
This commit is contained in:
1 parent
60c904b8f2
commit
88ea3d58ad
35 files changed
+168
-168
No files matched your search
@@ -17,7 +17,7 @@ on:
|
||||
- "scripts/core/anchors.py"
|
||||
- "scripts/core/artifacts.py"
|
||||
- "scripts/core/cli.py"
|
||||
- "scripts/core/crypto_verify.py"
|
||||
- "scripts/core/cryptoverify.py"
|
||||
- "scripts/core/gitclone.py"
|
||||
- "scripts/core/github.py"
|
||||
- "scripts/core/hashing.py"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
These pictures show a real screen, so they are captured on a real install and
|
||||
never drawn as a mock-up. Each entry says what the capture must show, where it
|
||||
goes, and the alt text it carries. Folder layouts that follow from data are
|
||||
drawn by `scripts/sitediagrams.py` instead (the MinUI card tree is
|
||||
drawn by `scripts/site_diagrams.py` instead (the MinUI card tree is
|
||||
`<!-- image: minui-card -->`).
|
||||
|
||||
Captures: PNG or WebP, 1200 px wide at most, cropped tight, under 150 KB,
|
||||
|
||||
File renamed without changes.
@@ -12,7 +12,7 @@ from pathlib import Path
|
||||
from core import upstream
|
||||
from core.paths import REPO_ROOT
|
||||
from scripts.scraper import game_dat_importer
|
||||
from scripts.scraper.datfetch import is_tracked_dat, label_version
|
||||
from scripts.scraper.dat_fetch import is_tracked_dat, label_version
|
||||
from scripts.scraper.redump_dat_scraper import fetch_snapshot
|
||||
from freshness.findings import (
|
||||
FBNEO_RECIPES, MAME_RECIPES, NO_INTRO_GAMES, OK, REDUMP_GAMES, SKIPPED, STALE, UNKNOWN,
|
||||
|
||||
@@ -14,7 +14,7 @@ def check_source_paths(profiles: dict) -> Finding:
|
||||
"""The site links a cited path only where source-paths.json records it
|
||||
in the tree the profile pins. A recorded tree no profile pins any more,
|
||||
or a pinned tree the record lacks, means a pin moved or a profile was
|
||||
added and `sitesources.py --fetch` was not run after it. Every tree a run
|
||||
added and `site_sources.py --fetch` was not run after it. Every tree a run
|
||||
tries is recorded, read or not, so a lacking one was never tried."""
|
||||
from sitegen import sources as sitegen_sources
|
||||
|
||||
@@ -34,7 +34,7 @@ def check_source_paths(profiles: dict) -> Finding:
|
||||
"source-paths.json",
|
||||
STALE if problems else OK,
|
||||
local=f"{len(recorded)} trees",
|
||||
detail=(", ".join(problems) + ": run python scripts/sitesources.py --fetch") if problems
|
||||
detail=(", ".join(problems) + ": run python scripts/site_sources.py --fetch") if problems
|
||||
else "every pinned tree is recorded, and only those",
|
||||
)
|
||||
|
||||
|
||||
@@ -220,7 +220,7 @@ def load_emulator_profiles(
|
||||
emu_path = Path(emulators_dir)
|
||||
if not emu_path.is_dir():
|
||||
# Read as "no emulator", a mistyped --emulators-dir built a pack
|
||||
# without any core file marked OK, and sitesources wrote {} over
|
||||
# without any core file marked OK, and site_sources wrote {} over
|
||||
# source-paths.json, both exiting 0.
|
||||
raise InputMissing(f"no emulator profile directory at {emulators_dir}")
|
||||
for f in source_yaml_paths(emu_path):
|
||||
|
||||
@@ -15,7 +15,7 @@ from core import upstream
|
||||
from model.platforms import load_platform_config
|
||||
from model.profiles import load_emulator_profiles
|
||||
from model.registry import list_registered_platforms
|
||||
from profiling import version_basis
|
||||
from profiling import versionbasis
|
||||
from profiling.anchoring import REVIEW_STATUSES
|
||||
from profiling.rebase import pending_recale, pin_blockers
|
||||
from profiling.reports import ProfileReport, SkipKind
|
||||
@@ -37,7 +37,7 @@ def apply_readings(document: dict, readings: list) -> tuple[object, dict | None]
|
||||
if isinstance(version, dict):
|
||||
version = dict(version)
|
||||
for reading in readings:
|
||||
if reading.status not in (version_basis.MATCH, version_basis.DRIFT):
|
||||
if reading.status not in (versionbasis.MATCH, versionbasis.DRIFT):
|
||||
continue
|
||||
if reading.mode:
|
||||
if not isinstance(version, dict):
|
||||
@@ -190,7 +190,7 @@ def bump_commit(
|
||||
new_text = _set_pin(
|
||||
new_text, document, "upstream_commit", report.upstream_head, "source_commit"
|
||||
)
|
||||
readings = version_basis.check(expected, cache_dir, offline, recompute=True)
|
||||
readings = versionbasis.check(expected, cache_dir, offline, recompute=True)
|
||||
refused = version_refusal(readings)
|
||||
if refused:
|
||||
return Bump(False, f"{refused}, its pin is not advanced")
|
||||
@@ -207,11 +207,11 @@ def bump_commit(
|
||||
def version_refusal(readings: list) -> str | None:
|
||||
"""Why the version at a new pin cannot be stated, or None."""
|
||||
for reading in readings:
|
||||
if reading.status == version_basis.NO_BASIS:
|
||||
if reading.status == versionbasis.NO_BASIS:
|
||||
return "no version_basis says where its version is read"
|
||||
if reading.status == version_basis.UNREADABLE:
|
||||
if reading.status == versionbasis.UNREADABLE:
|
||||
return f"core_version cannot be read at the new pin: {reading.where}"
|
||||
if reading.status == version_basis.UNCHECKED:
|
||||
if reading.status == versionbasis.UNCHECKED:
|
||||
return f"core_version is {reading.where}, not read from the code at a pin"
|
||||
return None
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ from profiling.sourcepaths import record_write
|
||||
from profiling.triage import (
|
||||
PROGRESS_SECONDS, Progress, print_interrupted, print_triage, score_reports, scored_to_dict,
|
||||
)
|
||||
from profiling.version_basis import VersionTag, version_tags
|
||||
from profiling.versionbasis import VersionTag, version_tags
|
||||
from profiling.versions import (
|
||||
VersionReport,
|
||||
check_version,
|
||||
|
||||
@@ -33,7 +33,7 @@ def refresh_source_paths(args: argparse.Namespace, written: set[str]) -> None:
|
||||
"""Rebuild the site's record of cited source paths after a write.
|
||||
|
||||
Each bump left website/src/data/source-paths.json behind its pins, and
|
||||
the site's freshness test stayed red until someone ran sitesources.py
|
||||
the site's freshness test stayed red until someone ran site_sources.py
|
||||
--fetch by hand. A run that writes nothing, or makes no request, leaves
|
||||
it alone. The record describes the repository's profiles: a pass over
|
||||
another tree prints the command for it instead of reducing the record
|
||||
@@ -44,7 +44,7 @@ def refresh_source_paths(args: argparse.Namespace, written: set[str]) -> None:
|
||||
if Path(args.emulators_dir).resolve() != (REPO_ROOT / EMULATORS_DIR).resolve():
|
||||
print(
|
||||
f"source paths not refreshed: {args.emulators_dir} is not the repository's "
|
||||
f"{EMULATORS_DIR}/: run python scripts/sitesources.py --fetch "
|
||||
f"{EMULATORS_DIR}/: run python scripts/site_sources.py --fetch "
|
||||
f"--emulators-dir {args.emulators_dir} --cache-dir {args.cache_dir} "
|
||||
"--output <record> to record them",
|
||||
file=sys.stderr,
|
||||
@@ -66,7 +66,7 @@ def refresh_source_paths(args: argparse.Namespace, written: set[str]) -> None:
|
||||
except ArtifactLockBusy as exc:
|
||||
# The profiles are written: only the record waits for the other run.
|
||||
print(
|
||||
f"source paths not refreshed ({exc}): run python scripts/sitesources.py "
|
||||
f"source paths not refreshed ({exc}): run python scripts/site_sources.py "
|
||||
"--fetch once it finishes",
|
||||
file=sys.stderr,
|
||||
)
|
||||
|
||||
@@ -10,7 +10,7 @@ from dataclasses import dataclass, field
|
||||
|
||||
from core import upstream
|
||||
from profiling.reports import ProfileReport, report_to_dict, triage_state
|
||||
from profiling.version_basis import version_repo, version_tags
|
||||
from profiling.versionbasis import version_repo, version_tags
|
||||
from profiling.versions import VersionReport, check_version
|
||||
|
||||
|
||||
|
||||
File renamed without changes.
@@ -9,19 +9,19 @@ from collections import Counter
|
||||
from dataclasses import asdict
|
||||
from pathlib import Path
|
||||
|
||||
from profiling import version_basis
|
||||
from profiling import versionbasis
|
||||
from profiling.bump import write_version
|
||||
from profiling.worktree import refuse_dirty_tree
|
||||
from profiling.yamledit import YamlWriteError
|
||||
|
||||
|
||||
def format_reading(name: str, reading: version_basis.Reading) -> str:
|
||||
def format_reading(name: str, reading: versionbasis.Reading) -> str:
|
||||
"""One reading as a line: its status, the version said, and where it was read."""
|
||||
mode = f"[{reading.mode}] " if reading.mode else ""
|
||||
kind = f"{reading.kind} " if reading.kind else ""
|
||||
if reading.status == version_basis.DRIFT:
|
||||
if reading.status == versionbasis.DRIFT:
|
||||
said = f"declared {reading.declared}, code {reading.read}"
|
||||
elif reading.status == version_basis.MATCH:
|
||||
elif reading.status == versionbasis.MATCH:
|
||||
said = str(reading.read)
|
||||
else:
|
||||
said = f"declared {reading.declared}"
|
||||
@@ -36,13 +36,13 @@ def run_versions(args: argparse.Namespace, profiles: dict, selected: dict) -> No
|
||||
rows = []
|
||||
failed = False
|
||||
for name, profile in selected.items():
|
||||
readings = version_basis.check(
|
||||
readings = versionbasis.check(
|
||||
profile, args.cache_dir, args.offline, profiles, recompute=args.set_version
|
||||
)
|
||||
for reading in readings:
|
||||
counts[reading.status] += 1
|
||||
rows.append({"profile": name, **asdict(reading)})
|
||||
if not args.as_json and (not args.changed_only or reading.status != version_basis.MATCH):
|
||||
if not args.as_json and (not args.changed_only or reading.status != versionbasis.MATCH):
|
||||
print(format_reading(name, reading))
|
||||
if args.set_version:
|
||||
path = Path(args.emulators_dir) / f"{name}.yml"
|
||||
@@ -54,7 +54,7 @@ def run_versions(args: argparse.Namespace, profiles: dict, selected: dict) -> No
|
||||
except YamlWriteError as exc:
|
||||
print(f"{name}: write refused: {exc}", file=sys.stderr)
|
||||
failed = True
|
||||
elif any(r.status in version_basis.FAILING for r in readings):
|
||||
elif any(r.status in versionbasis.FAILING for r in readings):
|
||||
failed = True
|
||||
if args.as_json:
|
||||
print(json.dumps(rows, indent=2))
|
||||
|
||||
@@ -6,7 +6,7 @@ import re
|
||||
from dataclasses import dataclass
|
||||
|
||||
from core import upstream
|
||||
from profiling.version_basis import VersionTag, declared
|
||||
from profiling.versionbasis import VersionTag, declared
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
|
||||
@@ -199,7 +199,7 @@ def _rule_failure(
|
||||
if check not in skip and not content_fits({"validation": [check], check: spec}, local_path):
|
||||
return _CONTENT_REASONS[check]
|
||||
if rule["crypto"] - skip:
|
||||
from core.crypto_verify import check_crypto_validation
|
||||
from core.cryptoverify import check_crypto_validation
|
||||
|
||||
return check_crypto_validation(local_path, filename, bios_dir)
|
||||
return None
|
||||
@@ -527,7 +527,7 @@ def check_file_validation(
|
||||
|
||||
# Signature/crypto checks (3DS RSA, AES)
|
||||
if entry["crypto_only"]:
|
||||
from core.crypto_verify import check_crypto_validation
|
||||
from core.cryptoverify import check_crypto_validation
|
||||
|
||||
crypto_reason = check_crypto_validation(local_path, filename, bios_dir)
|
||||
if crypto_reason:
|
||||
|
||||
@@ -61,7 +61,7 @@ from .fbneo_parser import zip_name
|
||||
from .clex import DriverSourceError, blank_comments, call_args, call_span
|
||||
from .listxml import Opener, attrs, iter_elements, open_listxml, rom_members
|
||||
from model.mamerelease import mame_tag
|
||||
from .datfetch import MAME_LISTXML_URL, api_json, cached_pack, fetch_pack
|
||||
from .dat_fetch import MAME_LISTXML_URL, api_json, cached_pack, fetch_pack
|
||||
|
||||
SCHEMA_VERSION = 1
|
||||
DEFAULT_OUTPUT = Path("games") / "arcade"
|
||||
|
||||
File renamed without changes.
@@ -58,7 +58,7 @@ from .mame_devices import (
|
||||
)
|
||||
from .listxml import open_listxml
|
||||
from model.mamerelease import mame_tag, mame_version
|
||||
from .datfetch import fetch_pack
|
||||
from .dat_fetch import fetch_pack
|
||||
from .sparse_clone import fresh_cache, remove_clone, sparse_clone
|
||||
from .mame_parser import parse_mame_source_tree
|
||||
from core.paths import EMULATORS_DIR, PLATFORMS_DIR, REPO_ROOT
|
||||
|
||||
@@ -50,7 +50,7 @@ from model.database import load_database
|
||||
from model.dumpcatalog import build_snapshot, load_provenance_snapshots, write_snapshot
|
||||
from resolve.localfile import variant_base_name
|
||||
from .base_scraper import BlobMismatchError, fetch_github_latest_version
|
||||
from .datfetch import fetch_pack, mame_label
|
||||
from .dat_fetch import fetch_pack, mame_label
|
||||
from .listxml import (
|
||||
Opener,
|
||||
iter_dat_documents,
|
||||
|
||||
File renamed without changes.
File renamed without changes.
+3
-3
@@ -87,8 +87,8 @@ COMMANDS = {
|
||||
"sitegen/extraction.py", "sitegen/releasepacks.py", "sitegen/archivecounts.py",
|
||||
"packs/crossref.py",
|
||||
),
|
||||
"sitediagrams.py": ("sitegen/diagrams.py",),
|
||||
"sitesources.py": ("sitegen/sources.py",),
|
||||
"site_diagrams.py": ("sitegen/diagrams.py",),
|
||||
"site_sources.py": ("sitegen/sources.py",),
|
||||
"site_markdown.py": ("sitegen/pagemarkdown.py",),
|
||||
"validate_site.py": ("sitegen/validate.py",),
|
||||
"site_insights.py": ("sitegen/insights.py",),
|
||||
@@ -175,7 +175,7 @@ COMMANDS = {
|
||||
"profile_sync.py": (
|
||||
"profiling/citations.py", "profiling/anchoring.py", "profiling/repos.py",
|
||||
"profiling/resolver.py", "profiling/reports.py", "profiling/versions.py",
|
||||
"profiling/version_basis.py", "profiling/detection.py", "profiling/triage.py",
|
||||
"profiling/versionbasis.py", "profiling/detection.py", "profiling/triage.py",
|
||||
"profiling/yamledit.py", "profiling/proseedit.py", "profiling/rebase.py",
|
||||
"profiling/bump.py", "profiling/realign.py", "profiling/run.py", "profiling/worktree.py",
|
||||
"profiling/quota.py", "profiling/sourcepaths.py", "profiling/realignpass.py",
|
||||
|
||||
@@ -71,7 +71,7 @@ from model.romfolders import load_sources, sources_dir
|
||||
from model.safeparse import yaml_load
|
||||
from model.targets import platform_overrides
|
||||
from profiling.reports import ProfileReport, SkipKind, report_to_dict
|
||||
from scripts.scraper import datfetch, game_dat_importer
|
||||
from scripts.scraper import dat_fetch, game_dat_importer
|
||||
from tests.sources import SCRIPTS
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
@@ -648,11 +648,11 @@ class CatalogParsingTests(unittest.TestCase):
|
||||
self.assertEqual(mame_versions(recipes), ["mame0250", "mame0289"])
|
||||
|
||||
def test_versions_and_blobs_follow_the_importer_rules(self):
|
||||
recipes = {"dats": {datfetch.mame_label("mame0289lx"): "mame0289lx"}}
|
||||
recipes = {"dats": {dat_fetch.mame_label("mame0289lx"): "mame0289lx"}}
|
||||
self.assertEqual(mame_versions(recipes), ["mame0289"])
|
||||
# The check asks the importer which DATs it reads, never a copy of the rule.
|
||||
self.assertIs(freshness.catalogs.is_tracked_dat, datfetch.is_tracked_dat)
|
||||
self.assertIs(freshness.catalogs.label_version, datfetch.label_version)
|
||||
self.assertIs(freshness.catalogs.is_tracked_dat, dat_fetch.is_tracked_dat)
|
||||
self.assertIs(freshness.catalogs.label_version, dat_fetch.label_version)
|
||||
|
||||
|
||||
def _rows(*reports: ProfileReport) -> list[dict]:
|
||||
|
||||
@@ -13,7 +13,7 @@ import ast
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
from core import crypto_verify
|
||||
from core import cryptoverify
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
@@ -24,7 +24,7 @@ class StdlibAes(unittest.TestCase):
|
||||
def test_fips_197_vector(self):
|
||||
key = bytes.fromhex("000102030405060708090a0b0c0d0e0f")
|
||||
cipher = bytes.fromhex("69c4e0d86a7b0430d8cdb78070b4c55a")
|
||||
plain = crypto_verify._decrypt_block(cipher, crypto_verify._expand_key(key))
|
||||
plain = cryptoverify._decrypt_block(cipher, cryptoverify._expand_key(key))
|
||||
self.assertEqual(plain.hex(), "00112233445566778899aabbccddeeff")
|
||||
|
||||
def test_cbc_chains_blocks(self):
|
||||
@@ -35,12 +35,12 @@ class StdlibAes(unittest.TestCase):
|
||||
"7649abac8119b246cee98e9b12e9197d5086cb9b507219ee95db113a917678b2"
|
||||
)
|
||||
self.assertEqual(
|
||||
crypto_verify._aes_128_cbc_decrypt(cipher, key, iv).hex(),
|
||||
cryptoverify._aes_128_cbc_decrypt(cipher, key, iv).hex(),
|
||||
"6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e51",
|
||||
)
|
||||
|
||||
def test_no_third_party_import(self):
|
||||
tree = ast.parse((REPO_ROOT / "scripts" / "core" / "crypto_verify.py").read_text())
|
||||
tree = ast.parse((REPO_ROOT / "scripts" / "core" / "cryptoverify.py").read_text())
|
||||
modules = {
|
||||
(node.module if isinstance(node, ast.ImportFrom) else alias.name).split(".")[0]
|
||||
for node in ast.walk(tree)
|
||||
|
||||
@@ -26,7 +26,7 @@ import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
from core import crypto_verify
|
||||
from core import cryptoverify
|
||||
from core import sect233r1 as ec
|
||||
|
||||
# A 2048-bit RSA key, the size the 3DS signatures use, from two fixed primes
|
||||
@@ -108,26 +108,26 @@ class SecureInfoA(_Fixture):
|
||||
return self._write("SecureInfo_A", _rsa_sign(sign or body) + body)
|
||||
|
||||
def test_a_correctly_signed_file_verifies(self):
|
||||
ok, reason = crypto_verify.verify_secure_info_a(self._file(), _keys())
|
||||
ok, reason = cryptoverify.verify_secure_info_a(self._file(), _keys())
|
||||
self.assertTrue(ok, reason)
|
||||
self.assertEqual(reason, "signature valid")
|
||||
|
||||
def test_wrong_size_is_refused_before_anything_else(self):
|
||||
path = self._write("SecureInfo_A", b"\x00" * 100)
|
||||
ok, reason = crypto_verify.verify_secure_info_a(path, _keys())
|
||||
ok, reason = cryptoverify.verify_secure_info_a(path, _keys())
|
||||
self.assertFalse(ok)
|
||||
self.assertIn("size mismatch", reason)
|
||||
|
||||
def test_an_all_zero_serial_is_refused(self):
|
||||
body = bytes([1]) + b"\x00" + b"\x00" * 15
|
||||
ok, reason = crypto_verify.verify_secure_info_a(self._file(body), _keys())
|
||||
ok, reason = cryptoverify.verify_secure_info_a(self._file(body), _keys())
|
||||
self.assertFalse(ok)
|
||||
self.assertIn("serial_number is all zeros", reason)
|
||||
|
||||
def test_missing_keys_are_reported_rather_than_guessed(self):
|
||||
keys = _keys()
|
||||
keys["RSA"].pop("secureInfoMod")
|
||||
ok, reason = crypto_verify.verify_secure_info_a(self._file(), keys)
|
||||
ok, reason = cryptoverify.verify_secure_info_a(self._file(), keys)
|
||||
self.assertFalse(ok)
|
||||
self.assertIn("missing RSA keys", reason)
|
||||
|
||||
@@ -135,7 +135,7 @@ class SecureInfoA(_Fixture):
|
||||
body = _secure_info_body()
|
||||
tampered = body[:2] + b"X" + body[3:]
|
||||
path = self._write("SecureInfo_A", _rsa_sign(body) + tampered)
|
||||
ok, reason = crypto_verify.verify_secure_info_a(path, _keys())
|
||||
ok, reason = cryptoverify.verify_secure_info_a(path, _keys())
|
||||
self.assertFalse(ok)
|
||||
self.assertEqual(reason, "signature invalid")
|
||||
|
||||
@@ -144,7 +144,7 @@ class SecureInfoA(_Fixture):
|
||||
signed = _secure_info_body(region=2)
|
||||
shipped = _secure_info_body(region=5)
|
||||
path = self._write("SecureInfo_A", _rsa_sign(signed) + shipped)
|
||||
ok, reason = crypto_verify.verify_secure_info_a(path, _keys())
|
||||
ok, reason = cryptoverify.verify_secure_info_a(path, _keys())
|
||||
self.assertFalse(ok)
|
||||
self.assertIn("region changed from 2 to 5", reason)
|
||||
|
||||
@@ -155,17 +155,17 @@ class LocalFriendCodeSeedB(_Fixture):
|
||||
return self._write("LocalFriendCodeSeed_B", _rsa_sign(sign or body) + body)
|
||||
|
||||
def test_a_correctly_signed_file_verifies(self):
|
||||
ok, reason = crypto_verify.verify_local_friend_code_seed_b(self._file(), _keys())
|
||||
ok, reason = cryptoverify.verify_local_friend_code_seed_b(self._file(), _keys())
|
||||
self.assertTrue(ok, reason)
|
||||
|
||||
def test_wrong_size_is_refused(self):
|
||||
path = self._write("LocalFriendCodeSeed_B", b"\x00" * 0x111)
|
||||
ok, reason = crypto_verify.verify_local_friend_code_seed_b(path, _keys())
|
||||
ok, reason = cryptoverify.verify_local_friend_code_seed_b(path, _keys())
|
||||
self.assertFalse(ok)
|
||||
self.assertIn("size mismatch", reason)
|
||||
|
||||
def test_a_zero_friend_code_seed_is_refused(self):
|
||||
ok, reason = crypto_verify.verify_local_friend_code_seed_b(
|
||||
ok, reason = cryptoverify.verify_local_friend_code_seed_b(
|
||||
self._file(_lfcs_body(seed=0)), _keys()
|
||||
)
|
||||
self.assertFalse(ok)
|
||||
@@ -176,14 +176,14 @@ class LocalFriendCodeSeedB(_Fixture):
|
||||
path = self._write(
|
||||
"LocalFriendCodeSeed_B", _rsa_sign(body) + _lfcs_body(seed=0xDEAD)
|
||||
)
|
||||
ok, reason = crypto_verify.verify_local_friend_code_seed_b(path, _keys())
|
||||
ok, reason = cryptoverify.verify_local_friend_code_seed_b(path, _keys())
|
||||
self.assertFalse(ok)
|
||||
self.assertEqual(reason, "signature invalid")
|
||||
|
||||
def test_missing_keys_are_reported(self):
|
||||
keys = _keys()
|
||||
keys["RSA"].pop("lfcsExp")
|
||||
ok, reason = crypto_verify.verify_local_friend_code_seed_b(self._file(), keys)
|
||||
ok, reason = cryptoverify.verify_local_friend_code_seed_b(self._file(), keys)
|
||||
self.assertFalse(ok)
|
||||
self.assertIn("missing RSA keys", reason)
|
||||
|
||||
@@ -198,27 +198,27 @@ class MovableSed(_Fixture):
|
||||
return self._write("movable.sed", bytes(data))
|
||||
|
||||
def test_the_short_variant_verifies(self):
|
||||
ok, reason = crypto_verify.verify_movable_sed(self._file(), _keys())
|
||||
ok, reason = cryptoverify.verify_movable_sed(self._file(), _keys())
|
||||
self.assertTrue(ok, reason)
|
||||
self.assertIn("magic valid", reason)
|
||||
|
||||
def test_the_long_variant_verifies(self):
|
||||
ok, reason = crypto_verify.verify_movable_sed(self._file(size=0x140), _keys())
|
||||
ok, reason = cryptoverify.verify_movable_sed(self._file(size=0x140), _keys())
|
||||
self.assertTrue(ok, reason)
|
||||
|
||||
def test_a_wrong_magic_is_refused(self):
|
||||
ok, reason = crypto_verify.verify_movable_sed(self._file(magic=b"SEXD"), _keys())
|
||||
ok, reason = cryptoverify.verify_movable_sed(self._file(magic=b"SEXD"), _keys())
|
||||
self.assertFalse(ok)
|
||||
self.assertIn("invalid magic", reason)
|
||||
|
||||
def test_an_unexpected_size_is_refused(self):
|
||||
path = self._write("movable.sed", b"\x00" * 0x130)
|
||||
ok, reason = crypto_verify.verify_movable_sed(path, _keys())
|
||||
ok, reason = cryptoverify.verify_movable_sed(path, _keys())
|
||||
self.assertFalse(ok)
|
||||
self.assertIn("size mismatch", reason)
|
||||
|
||||
def test_a_tampered_embedded_seed_fails_while_the_magic_still_passes(self):
|
||||
ok, reason = crypto_verify.verify_movable_sed(self._file(seed=0xBADF00D), _keys())
|
||||
ok, reason = cryptoverify.verify_movable_sed(self._file(seed=0xBADF00D), _keys())
|
||||
self.assertFalse(ok)
|
||||
self.assertEqual(reason, "magic valid, LFCS signature invalid")
|
||||
|
||||
@@ -271,7 +271,7 @@ def _root_public() -> bytes:
|
||||
class Otp(_Fixture):
|
||||
def test_a_decrypted_otp_passes_every_stage(self):
|
||||
path = self._write("otp.bin", _otp_plaintext())
|
||||
ok, reason = crypto_verify.verify_otp(
|
||||
ok, reason = cryptoverify.verify_otp(
|
||||
path, _keys(ECC={"rootPublicXY": _root_public()})
|
||||
)
|
||||
self.assertTrue(ok, reason)
|
||||
@@ -279,13 +279,13 @@ class Otp(_Fixture):
|
||||
|
||||
def test_without_a_root_key_the_ecc_stage_is_skipped_not_faked(self):
|
||||
path = self._write("otp.bin", _otp_plaintext())
|
||||
ok, reason = crypto_verify.verify_otp(path, _keys())
|
||||
ok, reason = cryptoverify.verify_otp(path, _keys())
|
||||
self.assertTrue(ok)
|
||||
self.assertIn("ECC skipped", reason)
|
||||
|
||||
def test_wrong_size_is_refused(self):
|
||||
path = self._write("otp.bin", b"\x00" * 0xFF)
|
||||
ok, reason = crypto_verify.verify_otp(path, _keys())
|
||||
ok, reason = cryptoverify.verify_otp(path, _keys())
|
||||
self.assertFalse(ok)
|
||||
self.assertIn("size mismatch", reason)
|
||||
|
||||
@@ -293,13 +293,13 @@ class Otp(_Fixture):
|
||||
data = bytearray(_otp_plaintext())
|
||||
data[0x30] ^= 0xFF
|
||||
path = self._write("otp.bin", bytes(data))
|
||||
ok, reason = crypto_verify.verify_otp(path, _keys())
|
||||
ok, reason = cryptoverify.verify_otp(path, _keys())
|
||||
self.assertFalse(ok)
|
||||
self.assertIn("SHA-256 hash mismatch", reason)
|
||||
|
||||
def test_an_unsigned_certificate_is_refused(self):
|
||||
path = self._write("otp.bin", _otp_plaintext(sign=False))
|
||||
ok, reason = crypto_verify.verify_otp(
|
||||
ok, reason = cryptoverify.verify_otp(
|
||||
path, _keys(ECC={"rootPublicXY": _root_public()})
|
||||
)
|
||||
self.assertFalse(ok)
|
||||
@@ -311,7 +311,7 @@ class Otp(_Fixture):
|
||||
struct.pack_into("<I", data, 0x04, 0x0A0B0C0E)
|
||||
body = bytes(data[:0xE0])
|
||||
path = self._write("otp.bin", body + hashlib.sha256(body).digest())
|
||||
ok, reason = crypto_verify.verify_otp(
|
||||
ok, reason = cryptoverify.verify_otp(
|
||||
path, _keys(ECC={"rootPublicXY": _root_public()})
|
||||
)
|
||||
self.assertFalse(ok)
|
||||
@@ -319,21 +319,21 @@ class Otp(_Fixture):
|
||||
|
||||
def test_the_pre_v5_expiry_endianness_is_honoured(self):
|
||||
path = self._write("otp.bin", _otp_plaintext(otp_version=4))
|
||||
ok, reason = crypto_verify.verify_otp(
|
||||
ok, reason = cryptoverify.verify_otp(
|
||||
path, _keys(ECC={"rootPublicXY": _root_public()})
|
||||
)
|
||||
self.assertTrue(ok, reason)
|
||||
|
||||
def test_a_dev_unit_uses_the_dev_issuer(self):
|
||||
path = self._write("otp.bin", _otp_plaintext(system_type=1))
|
||||
ok, reason = crypto_verify.verify_otp(
|
||||
ok, reason = cryptoverify.verify_otp(
|
||||
path, _keys(ECC={"rootPublicXY": _root_public()})
|
||||
)
|
||||
self.assertTrue(ok, reason)
|
||||
|
||||
def test_an_encrypted_otp_without_keys_says_so(self):
|
||||
path = self._write("otp.bin", b"\x11" * 0x100)
|
||||
ok, reason = crypto_verify.verify_otp(path, _keys())
|
||||
ok, reason = cryptoverify.verify_otp(path, _keys())
|
||||
self.assertFalse(ok)
|
||||
self.assertIn("missing AES keys", reason)
|
||||
|
||||
@@ -343,19 +343,19 @@ class Dispatch(_Fixture):
|
||||
|
||||
def test_an_unknown_filename_is_not_this_module_business(self):
|
||||
self.assertIsNone(
|
||||
crypto_verify.check_crypto_validation("x", "scph5501.bin", str(self.tmp))
|
||||
cryptoverify.check_crypto_validation("x", "scph5501.bin", str(self.tmp))
|
||||
)
|
||||
|
||||
def test_a_known_filename_without_a_keys_file_does_not_crash(self):
|
||||
path = self._write("movable.sed", b"\x00" * 0x120)
|
||||
result = crypto_verify.check_crypto_validation(
|
||||
result = cryptoverify.check_crypto_validation(
|
||||
str(path), "movable.sed", str(self.tmp)
|
||||
)
|
||||
self.assertIsInstance(result, (str, type(None)))
|
||||
|
||||
def test_every_verifier_is_reachable_by_its_filename(self):
|
||||
self.assertEqual(
|
||||
sorted(crypto_verify._CRYPTO_VERIFIERS),
|
||||
sorted(cryptoverify._CRYPTO_VERIFIERS),
|
||||
["LocalFriendCodeSeed_B", "SecureInfo_A", "movable.sed", "otp.bin"],
|
||||
)
|
||||
|
||||
|
||||
+18
-18
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
"""The hand-written crypto that backs 3DS file validation.
|
||||
|
||||
crypto_verify.py and sect233r1.py reimplement RSA PKCS#1 v1.5, AES-128-CBC
|
||||
cryptoverify.py and sect233r1.py reimplement RSA PKCS#1 v1.5, AES-128-CBC
|
||||
and ECDSA over GF(2^233) in pure Python, and validation.py reaches them by a
|
||||
dynamic import. Nothing exercised them, and a signature check that accepts
|
||||
everything looks exactly like one that works.
|
||||
@@ -23,7 +23,7 @@ import unittest
|
||||
import unittest.mock
|
||||
from pathlib import Path
|
||||
|
||||
from core import crypto_verify
|
||||
from core import cryptoverify
|
||||
from core import sect233r1 as ec
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ class RsaPkcs1V15(unittest.TestCase):
|
||||
def test_a_valid_signature_verifies(self):
|
||||
message = b"SecureInfo_A body"
|
||||
self.assertTrue(
|
||||
crypto_verify._rsa_verify_pkcs1v15_sha256(
|
||||
cryptoverify._rsa_verify_pkcs1v15_sha256(
|
||||
message, self._sign(message), self.modulus, self.exponent
|
||||
)
|
||||
)
|
||||
@@ -207,7 +207,7 @@ class RsaPkcs1V15(unittest.TestCase):
|
||||
def test_a_changed_message_is_rejected(self):
|
||||
signature = self._sign(b"SecureInfo_A body")
|
||||
self.assertFalse(
|
||||
crypto_verify._rsa_verify_pkcs1v15_sha256(
|
||||
cryptoverify._rsa_verify_pkcs1v15_sha256(
|
||||
b"SecureInfo_B body", signature, self.modulus, self.exponent
|
||||
)
|
||||
)
|
||||
@@ -216,21 +216,21 @@ class RsaPkcs1V15(unittest.TestCase):
|
||||
tampered = bytearray(self._sign(b"body"))
|
||||
tampered[-1] ^= 0x01
|
||||
self.assertFalse(
|
||||
crypto_verify._rsa_verify_pkcs1v15_sha256(
|
||||
cryptoverify._rsa_verify_pkcs1v15_sha256(
|
||||
b"body", bytes(tampered), self.modulus, self.exponent
|
||||
)
|
||||
)
|
||||
|
||||
def test_a_signature_at_or_above_the_modulus_is_rejected(self):
|
||||
self.assertFalse(
|
||||
crypto_verify._rsa_verify_pkcs1v15_sha256(
|
||||
cryptoverify._rsa_verify_pkcs1v15_sha256(
|
||||
b"body", self.modulus, self.modulus, self.exponent
|
||||
)
|
||||
)
|
||||
|
||||
def test_an_all_zero_signature_is_rejected(self):
|
||||
self.assertFalse(
|
||||
crypto_verify._rsa_verify_pkcs1v15_sha256(
|
||||
cryptoverify._rsa_verify_pkcs1v15_sha256(
|
||||
b"body", b"\x00" * self.mod_len, self.modulus, self.exponent
|
||||
)
|
||||
)
|
||||
@@ -239,7 +239,7 @@ class RsaPkcs1V15(unittest.TestCase):
|
||||
"""A modulus too small to hold the required padding cannot verify."""
|
||||
tiny = (1 << 335).to_bytes(42, "big")
|
||||
self.assertFalse(
|
||||
crypto_verify._rsa_verify_pkcs1v15_sha256(
|
||||
cryptoverify._rsa_verify_pkcs1v15_sha256(
|
||||
b"body", b"\x01" * 42, tiny, self.exponent
|
||||
)
|
||||
)
|
||||
@@ -262,14 +262,14 @@ class AesCbc(unittest.TestCase):
|
||||
|
||||
def test_the_published_vector_decrypts(self):
|
||||
self.assertEqual(
|
||||
crypto_verify._aes_128_cbc_decrypt(self.CIPHERTEXT, self.KEY, self.IV),
|
||||
cryptoverify._aes_128_cbc_decrypt(self.CIPHERTEXT, self.KEY, self.IV),
|
||||
self.PLAINTEXT,
|
||||
)
|
||||
|
||||
def test_a_different_key_does_not_give_the_plaintext(self):
|
||||
other = bytes(self.KEY[:-1]) + bytes([self.KEY[-1] ^ 0x01])
|
||||
self.assertNotEqual(
|
||||
crypto_verify._aes_128_cbc_decrypt(self.CIPHERTEXT, other, self.IV),
|
||||
cryptoverify._aes_128_cbc_decrypt(self.CIPHERTEXT, other, self.IV),
|
||||
self.PLAINTEXT,
|
||||
)
|
||||
|
||||
@@ -295,7 +295,7 @@ class KeysFile(unittest.TestCase):
|
||||
"not a pair\n"
|
||||
"odd_length=abc\n"
|
||||
)
|
||||
parsed = crypto_verify.parse_keys_file(path)
|
||||
parsed = cryptoverify.parse_keys_file(path)
|
||||
self.assertEqual(
|
||||
parsed["AES"]["slot0x2CKeyN"],
|
||||
bytes.fromhex("00112233445566778899aabbccddeeff"),
|
||||
@@ -308,24 +308,24 @@ class KeysFile(unittest.TestCase):
|
||||
def test_an_empty_file_yields_no_sections(self):
|
||||
path = self.tmp / "aes_keys.txt"
|
||||
path.write_text("")
|
||||
self.assertEqual(crypto_verify.parse_keys_file(path), {})
|
||||
self.assertEqual(cryptoverify.parse_keys_file(path), {})
|
||||
|
||||
def test_the_keys_file_is_found_under_nintendo_3ds(self):
|
||||
target = self.tmp / "Nintendo" / "3DS"
|
||||
target.mkdir(parents=True)
|
||||
(target / "aes_keys.txt").write_text(":AES\n")
|
||||
self.assertEqual(
|
||||
crypto_verify.find_keys_file(self.tmp), target / "aes_keys.txt"
|
||||
cryptoverify.find_keys_file(self.tmp), target / "aes_keys.txt"
|
||||
)
|
||||
|
||||
def test_the_alternate_name_is_found(self):
|
||||
target = self.tmp / "Nintendo" / "3DS"
|
||||
target.mkdir(parents=True)
|
||||
(target / "keys.txt").write_text(":AES\n")
|
||||
self.assertEqual(crypto_verify.find_keys_file(self.tmp), target / "keys.txt")
|
||||
self.assertEqual(cryptoverify.find_keys_file(self.tmp), target / "keys.txt")
|
||||
|
||||
def test_absence_reports_none(self):
|
||||
self.assertIsNone(crypto_verify.find_keys_file(self.tmp))
|
||||
self.assertIsNone(cryptoverify.find_keys_file(self.tmp))
|
||||
|
||||
|
||||
class OneFileIsVerifiedOncePerContent(unittest.TestCase):
|
||||
@@ -347,14 +347,14 @@ class OneFileIsVerifiedOncePerContent(unittest.TestCase):
|
||||
self.calls.append(data)
|
||||
return data[0] == 1, "first byte is not 1"
|
||||
|
||||
patcher = unittest.mock.patch.dict(crypto_verify._CRYPTO_VERIFIERS, {"otp.bin": verifier})
|
||||
patcher = unittest.mock.patch.dict(cryptoverify._CRYPTO_VERIFIERS, {"otp.bin": verifier})
|
||||
patcher.start()
|
||||
self.addCleanup(patcher.stop)
|
||||
self.addCleanup(crypto_verify._crypto_cache.clear)
|
||||
self.addCleanup(cryptoverify._crypto_cache.clear)
|
||||
self.addCleanup(self._tmp.cleanup)
|
||||
|
||||
def check(self) -> str | None:
|
||||
return crypto_verify.check_crypto_validation(str(self.file), "otp.bin", str(self.bios))
|
||||
return cryptoverify.check_crypto_validation(str(self.file), "otp.bin", str(self.bios))
|
||||
|
||||
def test_the_same_file_is_verified_once(self):
|
||||
self.assertEqual([self.check() for _ in range(7)], ["first byte is not 1"] * 7)
|
||||
|
||||
+10
-10
@@ -76,7 +76,7 @@ from profiling.rebase import Recale, rebase_refs
|
||||
from profiling.repos import select_repo
|
||||
from model.sourceref import RefPart, parse_source_ref, split_source_ref
|
||||
from core import upstream
|
||||
from profiling import version_basis
|
||||
from profiling import versionbasis
|
||||
from core.upstream import CompareResult, FileChange
|
||||
|
||||
|
||||
@@ -84,11 +84,11 @@ def _version_read_as_written(profile, cache_dir, offline, profiles=None, recompu
|
||||
"""bump_commit reads core_version again at the new pin. These fixtures
|
||||
have no forge behind them, so the version reads as written here:
|
||||
tests/test_version_basis.py holds the reading and the refusals."""
|
||||
stated = version_basis.declared(profile, "")
|
||||
return [version_basis.Reading("", "file", stated, stated, "fixture", version_basis.MATCH)]
|
||||
stated = versionbasis.declared(profile, "")
|
||||
return [versionbasis.Reading("", "file", stated, stated, "fixture", versionbasis.MATCH)]
|
||||
|
||||
|
||||
_VERSION_AS_WRITTEN = mock.patch.object(version_basis, "check", _version_read_as_written)
|
||||
_VERSION_AS_WRITTEN = mock.patch.object(versionbasis, "check", _version_read_as_written)
|
||||
|
||||
|
||||
def setUpModule():
|
||||
@@ -3722,7 +3722,7 @@ class TestCheckVersion(unittest.TestCase):
|
||||
upstream.tag_commit = upstream.resolve_tag_commit
|
||||
|
||||
def _check(self, declared, tag=None):
|
||||
named = version_basis.VersionTag("", declared, tag or declared, 0, self.repo, "source")
|
||||
named = versionbasis.VersionTag("", declared, tag or declared, 0, self.repo, "source")
|
||||
return check_version(named, self.dir, False)
|
||||
|
||||
def tearDown(self):
|
||||
@@ -5270,7 +5270,7 @@ class TestRateLimitEndsOneProfile(unittest.TestCase):
|
||||
|
||||
class AWriteRefreshesTheSourcePaths(unittest.TestCase):
|
||||
"""Each bump left website/src/data/source-paths.json behind its pins and
|
||||
the site's freshness test red until someone ran sitesources by hand."""
|
||||
the site's freshness test red until someone ran site_sources by hand."""
|
||||
|
||||
def _args(self, **kw):
|
||||
base = {
|
||||
@@ -5334,7 +5334,7 @@ class AWriteRefreshesTheSourcePaths(unittest.TestCase):
|
||||
contextlib.redirect_stderr(io.StringIO()) as err:
|
||||
profiling_sourcepaths.refresh_source_paths(self._args(emulators_dir=tmp), {"p"})
|
||||
self.assertFalse(refreshed.called)
|
||||
self.assertIn(f"sitesources.py --fetch --emulators-dir {tmp}", err.getvalue())
|
||||
self.assertIn(f"site_sources.py --fetch --emulators-dir {tmp}", err.getvalue())
|
||||
|
||||
def test_the_run_cache_and_the_record_path_are_passed(self):
|
||||
from unittest import mock
|
||||
@@ -5351,7 +5351,7 @@ class AWriteRefreshesTheSourcePaths(unittest.TestCase):
|
||||
|
||||
def test_the_record_waits_for_a_run_holding_the_repository(self):
|
||||
"""profile_sync rewrote source-paths.json without the repository
|
||||
hold sitesources takes, in the middle of a pipeline run."""
|
||||
hold site_sources takes, in the middle of a pipeline run."""
|
||||
from unittest import mock
|
||||
|
||||
from core.artifacts import ArtifactLockBusy
|
||||
@@ -5367,7 +5367,7 @@ class AWriteRefreshesTheSourcePaths(unittest.TestCase):
|
||||
profiling_sourcepaths.refresh_source_paths(self._args(), {"x"})
|
||||
lock.assert_called_once_with(str(sources.SOURCE_PATHS))
|
||||
self.assertFalse(built.called)
|
||||
self.assertIn("sitesources.py --fetch", err.getvalue())
|
||||
self.assertIn("site_sources.py --fetch", err.getvalue())
|
||||
|
||||
|
||||
class EveryWriterIsRecorded(unittest.TestCase):
|
||||
@@ -5411,7 +5411,7 @@ class EveryWriterIsRecorded(unittest.TestCase):
|
||||
|
||||
|
||||
class AnUnreadTreeKeepsItsRecord(unittest.TestCase):
|
||||
"""sitesources --fetch, rate-limited by GitLab, dropped about twenty
|
||||
"""site_sources --fetch, rate-limited by GitLab, dropped about twenty
|
||||
trees it never read from source-paths.json."""
|
||||
|
||||
def test_unread_trees_carry_over(self):
|
||||
|
||||
@@ -912,10 +912,10 @@ class FbneoFetchReadsOneRevision(unittest.TestCase):
|
||||
CDN caches, and --fetch <revision> read the tip whatever was named."""
|
||||
|
||||
def setUp(self):
|
||||
from scripts.scraper import datfetch
|
||||
from scripts.scraper import dat_fetch
|
||||
from scripts.scraper import romset_dat_importer as importer
|
||||
|
||||
self.datfetch = datfetch
|
||||
self.dat_fetch = dat_fetch
|
||||
self.importer = importer
|
||||
self._tmp = tempfile.TemporaryDirectory()
|
||||
self.dir = Path(self._tmp.name)
|
||||
@@ -947,46 +947,46 @@ class FbneoFetchReadsOneRevision(unittest.TestCase):
|
||||
|
||||
from scripts.scraper import base_scraper
|
||||
|
||||
with mock.patch.object(self.datfetch, "api_json", self._api), \
|
||||
mock.patch.object(self.datfetch, "fetch_branch_head", self._head), \
|
||||
with mock.patch.object(self.dat_fetch, "api_json", self._api), \
|
||||
mock.patch.object(self.dat_fetch, "fetch_branch_head", self._head), \
|
||||
mock.patch.object(base_scraper, "download", self._download):
|
||||
yield
|
||||
|
||||
def test_bytes_that_are_not_the_listed_blob_are_refused(self):
|
||||
self.served = FBNEO_DAT.replace(b"1.0.0.03", b"1.0.0.02")
|
||||
with self._patched(), self.assertRaises(self.datfetch.BlobMismatchError):
|
||||
self.datfetch.fetch_pack("fbneo", "latest", self.dir)
|
||||
with self._patched(), self.assertRaises(self.dat_fetch.BlobMismatchError):
|
||||
self.dat_fetch.fetch_pack("fbneo", "latest", self.dir)
|
||||
self.assertFalse((self.dir / "fbneo-dats" / "c0ffee" / "Demo.dat").exists())
|
||||
|
||||
def test_the_named_revision_is_the_one_listed(self):
|
||||
with self._patched():
|
||||
target, blobs = self.datfetch.fetch_pack("fbneo", "v1.0.0.02", self.dir)
|
||||
target, blobs = self.dat_fetch.fetch_pack("fbneo", "v1.0.0.02", self.dir)
|
||||
self.assertEqual(
|
||||
self.calls,
|
||||
["libretro/FBNeo@v1.0.0.02",
|
||||
f"{self.datfetch.FBNEO_API}/contents/dats?ref=c0ffee"],
|
||||
f"{self.dat_fetch.FBNEO_API}/contents/dats?ref=c0ffee"],
|
||||
)
|
||||
self.assertEqual(list(blobs), ["Demo.dat"])
|
||||
|
||||
def test_the_cache_is_keyed_by_the_commit(self):
|
||||
with self._patched():
|
||||
target, blobs = self.datfetch.fetch_pack("fbneo", "v1.0.0.02", self.dir)
|
||||
target, blobs = self.dat_fetch.fetch_pack("fbneo", "v1.0.0.02", self.dir)
|
||||
self.assertEqual(target, self.dir / "fbneo-dats" / "c0ffee")
|
||||
self.assertEqual(self.datfetch.cached_pack("fbneo", "c0ffee", self.dir), (target, blobs))
|
||||
self.assertEqual(self.dat_fetch.cached_pack("fbneo", "c0ffee", self.dir), (target, blobs))
|
||||
|
||||
def test_another_commit_is_not_cached(self):
|
||||
with self._patched():
|
||||
self.datfetch.fetch_pack("fbneo", "latest", self.dir)
|
||||
with self.assertRaises(self.datfetch.NotCached):
|
||||
self.datfetch.cached_pack("fbneo", "da14132b", self.dir)
|
||||
self.dat_fetch.fetch_pack("fbneo", "latest", self.dir)
|
||||
with self.assertRaises(self.dat_fetch.NotCached):
|
||||
self.dat_fetch.cached_pack("fbneo", "da14132b", self.dir)
|
||||
|
||||
def test_an_uncached_listxml_is_named(self):
|
||||
with self.assertRaises(self.datfetch.NotCached):
|
||||
self.datfetch.cached_pack("mame", "mame0289", self.dir)
|
||||
with self.assertRaises(self.dat_fetch.NotCached):
|
||||
self.dat_fetch.cached_pack("mame", "mame0289", self.dir)
|
||||
|
||||
def test_latest_reads_the_default_branch(self):
|
||||
with self._patched():
|
||||
self.datfetch.fetch_pack("fbneo", "latest", self.dir)
|
||||
self.dat_fetch.fetch_pack("fbneo", "latest", self.dir)
|
||||
self.assertEqual(self.calls[0], "libretro/FBNeo@None")
|
||||
|
||||
def test_a_revision_import_is_labelled_and_leaves_the_tip_blobs(self):
|
||||
|
||||
@@ -985,7 +985,7 @@ class EveryGitHubApiCallerSendsTheToken(unittest.TestCase):
|
||||
for path in [*scripts.rglob("*.py"), *scripts.rglob("*.sh")]
|
||||
if "api.github.com" in (source := path.read_text(encoding="utf-8"))
|
||||
# arcade_parent_importer names API URLs and sends them through
|
||||
# datfetch.api_json, which holds the token, and the
|
||||
# dat_fetch.api_json, which holds the token, and the
|
||||
# scrapers through base_scraper.github_json, the rest through
|
||||
# core.upstream.fetch_body or forge_headers.
|
||||
and ("Request(" in source or "urlopen(" in source or path.suffix == ".sh")
|
||||
|
||||
@@ -145,7 +145,7 @@ class SourcePathsFreshness(unittest.TestCase):
|
||||
moved = dict(profile, source_commit="f" * 40, upstream_commit="e" * 40)
|
||||
finding = check_source_paths({"geolith": moved})
|
||||
self.assertEqual(finding.status, STALE)
|
||||
self.assertIn("sitesources.py --fetch", finding.detail)
|
||||
self.assertIn("site_sources.py --fetch", finding.detail)
|
||||
|
||||
def test_a_pinned_tree_never_read_is_stale(self):
|
||||
"""fbneo moved to two new pins while fbneo_cps12 kept the old ones:
|
||||
|
||||
@@ -294,7 +294,7 @@ def _command(path: Path) -> list[str]:
|
||||
class AMissingProfileDirIsRefused(unittest.TestCase):
|
||||
"""A mistyped --emulators-dir read as "no emulator": generate_pack built
|
||||
a pack without its core files marked OK, verify --strict passed, and
|
||||
sitesources wrote {} over source-paths.json, every one exiting 0."""
|
||||
site_sources wrote {} over source-paths.json, every one exiting 0."""
|
||||
|
||||
EXTRA = {
|
||||
"arcade_parent_importer": ["--all", "--offline"],
|
||||
@@ -306,7 +306,7 @@ class AMissingProfileDirIsRefused(unittest.TestCase):
|
||||
"mame_ref_audit": ["mame"],
|
||||
"profile_sync": ["--all", "--triage"],
|
||||
"romset_dat_importer": ["--source", "mame", "--pack", "{dat}", "--output", "{out}/r.json"],
|
||||
"sitesources": ["--cache-dir", "{cache}", "--output", "{out}/source-paths.json"],
|
||||
"site_sources": ["--cache-dir", "{cache}", "--output", "{out}/source-paths.json"],
|
||||
"validate_pr": ["bios/Sony/PlayStation/scph5501.bin"],
|
||||
"verify": ["--platform", "retroarch", "--strict"],
|
||||
}
|
||||
@@ -341,7 +341,7 @@ class AMissingProfileDirIsRefused(unittest.TestCase):
|
||||
]
|
||||
self.assertEqual(written, [])
|
||||
# Read as empty, generate_site rewrote published-parts.json and the
|
||||
# FAQ, and sitesources source-paths.json. The copy compares the
|
||||
# FAQ, and site_sources source-paths.json. The copy compares the
|
||||
# files themselves: a name `git diff` already listed hid a rewrite.
|
||||
after = snapshot(checkout)
|
||||
self.assertEqual(sorted(k for k in before.keys() | after.keys()
|
||||
|
||||
+39
-39
@@ -27,7 +27,7 @@ import profile_sync
|
||||
from profiling import resolver
|
||||
from profiling import yamledit
|
||||
from core import upstream
|
||||
from profiling import version_basis
|
||||
from profiling import versionbasis
|
||||
from model.profilerepos import pin_field
|
||||
from model.profiles import load_emulator_profiles
|
||||
from profiling.reports import ProfileReport, SkipKind
|
||||
@@ -68,13 +68,13 @@ class ReadsTheRecordedSourceOffline(unittest.TestCase):
|
||||
|
||||
def _check(self, name: str, profiles: dict | None = None) -> list:
|
||||
profiles = profiles or self.profiles
|
||||
return version_basis.check(profiles[name], str(self.cache), True, profiles)
|
||||
return versionbasis.check(profiles[name], str(self.cache), True, profiles)
|
||||
|
||||
def test_every_kind_reads_its_version(self):
|
||||
for name in self.profiles:
|
||||
with self.subTest(profile=name):
|
||||
readings = self._check(name)
|
||||
self.assertEqual([r.status for r in readings], [version_basis.MATCH],
|
||||
self.assertEqual([r.status for r in readings], [versionbasis.MATCH],
|
||||
readings)
|
||||
|
||||
def test_a_file_basis_names_the_line_it_read(self):
|
||||
@@ -94,26 +94,26 @@ class ReadsTheRecordedSourceOffline(unittest.TestCase):
|
||||
profiles = copy.deepcopy(self.profiles)
|
||||
profiles[name]["core_version"] = stale
|
||||
(reading,) = self._check(name, profiles)
|
||||
self.assertEqual(reading.status, version_basis.DRIFT)
|
||||
self.assertEqual(reading.status, versionbasis.DRIFT)
|
||||
|
||||
def test_a_tag_distance_the_forge_contradicts_is_drift(self):
|
||||
profiles = copy.deepcopy(self.profiles)
|
||||
profiles["dolphin"]["version_basis"]["distance"] = 400
|
||||
(reading,) = self._check("dolphin", profiles)
|
||||
self.assertEqual(reading.status, version_basis.DRIFT)
|
||||
self.assertEqual(reading.status, versionbasis.DRIFT)
|
||||
self.assertEqual(dict(reading.updates)["distance"], 437)
|
||||
|
||||
def test_a_pattern_that_no_longer_matches_is_unreadable(self):
|
||||
profiles = copy.deepcopy(self.profiles)
|
||||
profiles["snes9x"]["version_basis"]["pattern"] = "#define\\s+NOPE\\s+(\\S+)"
|
||||
(reading,) = self._check("snes9x", profiles)
|
||||
self.assertEqual(reading.status, version_basis.UNREADABLE)
|
||||
self.assertEqual(reading.status, versionbasis.UNREADABLE)
|
||||
|
||||
def test_a_profile_without_basis_is_reported(self):
|
||||
profiles = copy.deepcopy(self.profiles)
|
||||
del profiles["snes9x"]["version_basis"]
|
||||
(reading,) = self._check("snes9x", profiles)
|
||||
self.assertEqual(reading.status, version_basis.NO_BASIS)
|
||||
self.assertEqual(reading.status, versionbasis.NO_BASIS)
|
||||
|
||||
def test_the_command_fails_on_drift_and_passes_clean(self):
|
||||
emulators = Path(self.tmp.name) / "emulators"
|
||||
@@ -155,20 +155,20 @@ class EveryProfileSaysWhereItsVersionIsRead(unittest.TestCase):
|
||||
|
||||
def test_every_profile_has_a_basis(self):
|
||||
missing = sorted(name for name, p in self.profiles.items()
|
||||
if not version_basis.bases(p))
|
||||
if not versionbasis.bases(p))
|
||||
self.assertEqual(missing, [], "profiles without version_basis")
|
||||
|
||||
def test_no_placeholder_is_a_version(self):
|
||||
named = sorted(
|
||||
name for name, p in self.profiles.items()
|
||||
for mode in (version_basis.bases(p) or {"": {}})
|
||||
if version_basis.is_placeholder(version_basis.declared(p, mode))
|
||||
for mode in (versionbasis.bases(p) or {"": {}})
|
||||
if versionbasis.is_placeholder(versionbasis.declared(p, mode))
|
||||
)
|
||||
self.assertEqual(named, [])
|
||||
|
||||
def test_keyed_bases_follow_the_keyed_version(self):
|
||||
for name, profile in self.profiles.items():
|
||||
found = version_basis.bases(profile)
|
||||
found = versionbasis.bases(profile)
|
||||
if not found or "" in found:
|
||||
continue
|
||||
with self.subTest(profile=name):
|
||||
@@ -177,45 +177,45 @@ class EveryProfileSaysWhereItsVersionIsRead(unittest.TestCase):
|
||||
|
||||
def test_none_states_no_version(self):
|
||||
for name, profile in self.profiles.items():
|
||||
for mode, basis in version_basis.bases(profile).items():
|
||||
for mode, basis in versionbasis.bases(profile).items():
|
||||
if basis.get("kind") == "none":
|
||||
with self.subTest(profile=name, mode=mode):
|
||||
self.assertIsNone(version_basis.declared(profile, mode))
|
||||
self.assertIsNone(versionbasis.declared(profile, mode))
|
||||
|
||||
def test_a_tag_version_is_the_describe_form_of_its_pin(self):
|
||||
for name, profile in self.profiles.items():
|
||||
for mode, basis in version_basis.bases(profile).items():
|
||||
for mode, basis in versionbasis.bases(profile).items():
|
||||
if basis.get("kind") != "tag" or basis.get("url"):
|
||||
continue
|
||||
field = pin_field(str(basis.get("repo") or "source")) + "_commit"
|
||||
pin = version_basis._by_mode(profile, field, mode)
|
||||
pin = versionbasis._by_mode(profile, field, mode)
|
||||
if not pin:
|
||||
continue
|
||||
with self.subTest(profile=name, mode=mode):
|
||||
self.assertEqual(
|
||||
version_basis.declared(profile, mode),
|
||||
version_basis.describe_form(basis["tag"], basis["distance"], pin),
|
||||
versionbasis.declared(profile, mode),
|
||||
versionbasis.describe_form(basis["tag"], basis["distance"], pin),
|
||||
)
|
||||
|
||||
def test_an_alias_carries_the_version_of_its_profile(self):
|
||||
for name, profile in self.profiles.items():
|
||||
for mode, basis in version_basis.bases(profile).items():
|
||||
for mode, basis in versionbasis.bases(profile).items():
|
||||
if basis.get("kind") != "alias":
|
||||
continue
|
||||
with self.subTest(profile=name):
|
||||
(reading,) = [r for r in version_basis.check(
|
||||
(reading,) = [r for r in versionbasis.check(
|
||||
profile, "", True, self.profiles) if r.mode == mode]
|
||||
self.assertEqual(reading.status, version_basis.MATCH, reading)
|
||||
self.assertEqual(reading.status, versionbasis.MATCH, reading)
|
||||
|
||||
def test_a_package_named_after_its_version_states_it(self):
|
||||
for name, profile in self.profiles.items():
|
||||
for mode, basis in version_basis.bases(profile).items():
|
||||
for mode, basis in versionbasis.bases(profile).items():
|
||||
if basis.get("kind") != "package" or not basis.get("pattern"):
|
||||
continue
|
||||
with self.subTest(profile=name):
|
||||
(reading,) = [r for r in version_basis.check(profile, "", True)
|
||||
(reading,) = [r for r in versionbasis.check(profile, "", True)
|
||||
if r.mode == mode]
|
||||
self.assertEqual(reading.status, version_basis.MATCH, reading)
|
||||
self.assertEqual(reading.status, versionbasis.MATCH, reading)
|
||||
|
||||
|
||||
SAMPLE = """emulator: Sample
|
||||
@@ -240,13 +240,13 @@ class TheBasisPinIsTheComparisonPin(unittest.TestCase):
|
||||
"profiled_date": "2026-01-01"}
|
||||
basis = {"kind": "file", "repo": "source"}
|
||||
with mock.patch.object(upstream, "resolve_commit_at", return_value="a" * 40) as at:
|
||||
repo, pin = version_basis._repo_and_pin(profile, basis, "", "cache", True)
|
||||
repo, pin = versionbasis._repo_and_pin(profile, basis, "", "cache", True)
|
||||
self.assertEqual((repo.slug, pin), ("o/r", "a" * 40))
|
||||
self.assertEqual(at.call_args.args[1:], ("2026-01-01", "cache", True, "port"))
|
||||
|
||||
def test_a_mirror_is_pinned_by_the_source_commit(self):
|
||||
profile = {"source_mirror": "https://github.com/o/m", "source_commit": "b" * 40}
|
||||
repo, pin = version_basis._repo_and_pin(
|
||||
repo, pin = versionbasis._repo_and_pin(
|
||||
profile, {"kind": "file", "repo": "source_mirror"}, "", "cache", True)
|
||||
self.assertEqual((repo.slug, pin), ("o/m", "b" * 40))
|
||||
|
||||
@@ -262,18 +262,18 @@ class TheVersionRepositoryIsTheBasisRepository(unittest.TestCase):
|
||||
}
|
||||
|
||||
def test_a_basis_naming_the_upstream_is_read_there(self):
|
||||
repo, field = version_basis.version_repo(self.PROFILE)
|
||||
repo, field = versionbasis.version_repo(self.PROFILE)
|
||||
self.assertEqual((repo.slug, field), ("o/up", "upstream"))
|
||||
|
||||
def test_a_profile_without_basis_is_read_where_it_was_profiled(self):
|
||||
profile = {k: v for k, v in self.PROFILE.items() if k != "version_basis"}
|
||||
repo, field = version_basis.version_repo(profile)
|
||||
repo, field = versionbasis.version_repo(profile)
|
||||
self.assertEqual((repo.slug, field), ("o/port", "source"))
|
||||
|
||||
def test_a_basis_url_is_its_own_repository(self):
|
||||
profile = dict(self.PROFILE, version_basis={
|
||||
"kind": "package", "url": "https://github.com/o/pkg/releases"})
|
||||
repo, field = version_basis.version_repo(profile)
|
||||
repo, field = versionbasis.version_repo(profile)
|
||||
self.assertEqual((repo.slug, field), ("o/pkg", "url"))
|
||||
|
||||
def test_the_check_reads_the_tags_and_the_pin_of_that_repository(self):
|
||||
@@ -339,17 +339,17 @@ class TheTagCoreVersionNames(unittest.TestCase):
|
||||
return report, asked
|
||||
|
||||
def test_a_tag_basis_names_its_tag(self):
|
||||
[named] = version_basis.version_tags(self.DESCRIBED)
|
||||
[named] = versionbasis.version_tags(self.DESCRIBED)
|
||||
self.assertEqual((named.declared, named.tag, named.distance),
|
||||
("2.9.2-77-gfc4ab0b", "2.9.2", 77))
|
||||
|
||||
def test_a_mode_keyed_version_names_one_tag_per_build(self):
|
||||
profile = {"source": "https://github.com/o/n",
|
||||
"core_version": {"standalone": "v1.1", "libretro": "v0.9"}}
|
||||
self.assertEqual([(n.mode, n.tag) for n in version_basis.version_tags(profile)],
|
||||
self.assertEqual([(n.mode, n.tag) for n in versionbasis.version_tags(profile)],
|
||||
[("standalone", "v1.1"), ("libretro", "v0.9")])
|
||||
same = dict(profile, core_version={"standalone": "0.14.1", "libretro": "0.14.1"})
|
||||
self.assertEqual([n.tag for n in version_basis.version_tags(same)], ["0.14.1"])
|
||||
self.assertEqual([n.tag for n in versionbasis.version_tags(same)], ["0.14.1"])
|
||||
|
||||
def test_a_release_after_the_described_pin_is_named(self):
|
||||
report, asked = self._attach(self.DESCRIBED, {"2.9.2": "tag292", "2.10.0": "rel210"})
|
||||
@@ -388,16 +388,16 @@ class AnAdvanceReadsTheVersionAgain(unittest.TestCase):
|
||||
self.tmp.cleanup()
|
||||
|
||||
def _reading(self, status: str, value: str | None):
|
||||
return version_basis.Reading("", "file", "1.0", value, "o/n@bbbbbbb:version.h:3", status)
|
||||
return versionbasis.Reading("", "file", "1.0", value, "o/n@bbbbbbb:version.h:3", status)
|
||||
|
||||
def test_the_version_moves_with_the_pin(self):
|
||||
seen = []
|
||||
|
||||
def check(profile, cache_dir, offline, profiles=None, recompute=False):
|
||||
seen.append((profile["source_commit"], recompute))
|
||||
return [self._reading(version_basis.DRIFT, "2.0")]
|
||||
return [self._reading(versionbasis.DRIFT, "2.0")]
|
||||
|
||||
with mock.patch.object(version_basis, "check", check):
|
||||
with mock.patch.object(versionbasis, "check", check):
|
||||
self.assertTrue(bump_commit(self.path, self.report).moved)
|
||||
written = yaml.safe_load(self.path.read_text(encoding="utf-8"))
|
||||
self.assertEqual(written["source_commit"], "bbbbbbb")
|
||||
@@ -406,8 +406,8 @@ class AnAdvanceReadsTheVersionAgain(unittest.TestCase):
|
||||
self.assertEqual(seen, [("bbbbbbb", True)])
|
||||
|
||||
def test_an_unreadable_version_holds_the_pin(self):
|
||||
with mock.patch.object(version_basis, "check",
|
||||
return_value=[self._reading(version_basis.UNREADABLE, None)]):
|
||||
with mock.patch.object(versionbasis, "check",
|
||||
return_value=[self._reading(versionbasis.UNREADABLE, None)]):
|
||||
self.assertFalse(bump_commit(self.path, self.report).moved)
|
||||
self.assertEqual(self.path.read_text(encoding="utf-8"), SAMPLE)
|
||||
|
||||
@@ -418,9 +418,9 @@ class AnAdvanceReadsTheVersionAgain(unittest.TestCase):
|
||||
self.assertEqual(self.path.read_text(encoding="utf-8"), before)
|
||||
|
||||
def test_a_package_version_is_advanced_by_hand(self):
|
||||
reading = version_basis.Reading("", "package", "1.0", None, "read from x.apk",
|
||||
version_basis.UNCHECKED)
|
||||
with mock.patch.object(version_basis, "check", return_value=[reading]):
|
||||
reading = versionbasis.Reading("", "package", "1.0", None, "read from x.apk",
|
||||
versionbasis.UNCHECKED)
|
||||
with mock.patch.object(versionbasis, "check", return_value=[reading]):
|
||||
self.assertFalse(bump_commit(self.path, self.report).moved)
|
||||
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ class DeploySiteTriggers(unittest.TestCase):
|
||||
self.assertNotIn("tests/**", patterns)
|
||||
|
||||
def test_the_site_reads_the_ref_grammar_not_the_checker(self):
|
||||
"""sitesources imported two parsing functions from profile_sync, so
|
||||
"""site_sources imported two parsing functions from profile_sync, so
|
||||
every change to the comparison tool rebuilt an unchanged site."""
|
||||
read = closure(["generate_site.py"])
|
||||
self.assertNotIn("scripts/profile_sync.py", read)
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
.rb-terminal wraps a code block that shows terminal output
|
||||
.rb-cmd wraps a command that must wrap instead of scrolling
|
||||
code.rb-path a folder path shown as a chip
|
||||
.rb-figure a generated diagram (scripts/sitediagrams.py)
|
||||
.rb-figure a generated diagram (scripts/site_diagrams.py)
|
||||
.rb-bar inline coverage bar, width from --v
|
||||
.rb-details-* collapsible block, neutral unless caution or danger
|
||||
dl.rb-facts the facts of a file card, label and value side by side
|
||||
@@ -772,8 +772,8 @@ body:has(table.rb-entries) { --sl-content-width: var(--rb-grid-width); }
|
||||
/* Terminal output: what the screen shows, not something to type */
|
||||
.sl-markdown-content .rb-terminal .expressive-code pre { background: var(--rb-terminal-bg); color: var(--rb-terminal-fg); }
|
||||
|
||||
/* Diagrams written by scripts/sitediagrams.py follow the theme: each is an
|
||||
image per theme (its colours written in the file, sitediagrams.THEMES),
|
||||
/* Diagrams written by scripts/site_diagrams.py follow the theme: each is an
|
||||
image per theme (its colours written in the file, sitegen.diagrams.THEMES),
|
||||
and the one of the other theme is not shown, so not fetched either.
|
||||
Starlight's dark theme is the one without data-theme='light'. */
|
||||
.sl-markdown-content .rb-figure { margin: 1.2rem 0 1.6rem; }
|
||||
|
||||
@@ -423,7 +423,7 @@ resolution.
|
||||
- `safe_extract_zip()` prevents zip-slip path traversal attacks
|
||||
- a pack copies each ZIP of the collection byte for byte, so every member
|
||||
hashes to the SHA1 the install list publishes
|
||||
- `core/crypto_verify.py` and `core/sect233r1.py` verify 3DS RSA-2048 signatures and AES-128-CBC integrity
|
||||
- `core/cryptoverify.py` and `core/sect233r1.py` verify 3DS RSA-2048 signatures and AES-128-CBC integrity
|
||||
- ZIP inner ROM verification via `checkInsideZip()` replicates Batocera's behavior
|
||||
- `md5_composite()` replicates Recalbox's composite ZIP hash
|
||||
|
||||
|
||||
+5
-5
@@ -585,7 +585,7 @@ is added, and commit it with the profiles. Every tree a run tries is recorded,
|
||||
read or not, so `check_freshness.py` reports a pinned tree the record lacks:
|
||||
|
||||
```bash
|
||||
python scripts/sitesources.py --fetch
|
||||
python scripts/site_sources.py --fetch
|
||||
```
|
||||
|
||||
A forge can also go for good. A 451, a 410 or a host that stops resolving
|
||||
@@ -752,7 +752,7 @@ its core lists at that release and never moves it, so a newer release is
|
||||
|
||||
The `profiles` area always checks `website/src/data/source-paths.json`
|
||||
against the profiles, offline: a recorded tree that no profile pins any more
|
||||
is `STALE` until `sitesources.py --fetch` runs again. It also reads each
|
||||
is `STALE` until `site_sources.py --fetch` runs again. It also reads each
|
||||
`pin_build` reference of a held pin: where the platform YAML was scraped at
|
||||
the reference's own revision the row is `OK` without network, otherwise the
|
||||
build file is fetched at the platform's new revision (or at the branch head
|
||||
@@ -1406,7 +1406,7 @@ before a release (wiki/release-process.md). Its lines stay in
|
||||
| `find_pinned_revision.py` | Walk the upstream commits that touched a file and return the revision whose bytes match a platform's pinned md5 (`--write` saves them) |
|
||||
| `generate_readme.py` | Generate README.md and CONTRIBUTING.md from database |
|
||||
| `generate_site.py` | Generate the site (this documentation) into the Starlight project in `website/` |
|
||||
| `sitesources.py` | Record which cited source paths each pinned upstream tree holds, for the site's source links (`--fetch` reads a tree no cache holds) |
|
||||
| `site_sources.py` | Record which cited source paths each pinned upstream tree holds, for the site's source links (`--fetch` reads a tree no cache holds) |
|
||||
| `site_markdown.py` | Write each built page as Markdown beside its HTML (`<page>/index.md`, named in every page's head) and `llms-full.txt`, the guides and every setup's page in one file, for the assistants that read the site. The Astro build runs it once the pages are written |
|
||||
| `site_insights.py` | What readers look for and do not find, from totals only, each section with its period: Google searches by page against the period of the same length before (anchors merged into their page), ranked by the clicks lost against the site's own click rate at each position, searches clicked less than half that rate, searched file names the collection does not hold, site searches that found nothing, broken addresses, "Did this page help?" answers, GitHub traffic (14 days) and release downloads since the previous run (`--days`, `--skip gsc,goatcounter,github`, `--output`, `--downloads-snapshot`, default `.cache/insights/downloads.json`). Reads Search Console, GoatCounter and GitHub with credentials kept outside the repository. A source it cannot read (rate limit, missing credential) is named at the top of the report instead of ending the run, which then exits 1. [What the site counts](privacy.md) |
|
||||
| `make_demo.py` | Record the installer demos of the README and the site into `docs_assets/demo/`. An ArkOS card with six games is built under `tmp/demo/` in a mount namespace of the user, this checkout is served on loopback, and VHS runs one tape per variant: `default` (`install.tape`, the one-line command in a terminal, the card at `/media/EASYROMS`, needs `unshare`) and `handheld` (`install-handheld.tape`, the full-screen interface at 640x480 on an ArkOS root made with `bwrap`, as its Tools menu starts it, driven by the keys gptokeyb sends for the buttons). `--variant NAME` records one (repeatable), every variant by default, the others kept. Each needs `vhs`, `ttyd` and `ffmpeg`. The default gets the README's GIF, each gets a WebM, an MP4 and a poster, held to their size targets, and an entry in `demo.json` with what it shows and its alt text. No Windows variant: under pwsh on Linux the installer's summary gives `--dest /mnt/e/bios` back. Never run by the build |
|
||||
@@ -1415,7 +1415,7 @@ before a release (wiki/release-process.md). Its lines stay in
|
||||
| `romset_recipes.py` | Identify which emulator version an arcade archive matches, rebuild a pinned archive from ROMs already held, record a recipe for every archive the collection holds and build any of them from the members it holds (see [Archive recipes](#archive-recipes)) |
|
||||
| `scraper/romset_dat_importer.py` | Fetch and import per-set recipes from MAME `-listxml` or FBNeo DATs into `recipes/`. `--fetch` alone takes the newest MAME release, and FBNeo DATs are refreshed by git blob sha. `--fetch <revision>` reads FBNeo at that tag, branch or commit |
|
||||
| `core/torrentzip.py` | Build TorrentZip archives for MAME/FBNeo ROM sets (archive bytes depend only on contents, with stock zlib), streaming one member at a time |
|
||||
| `core/crypto_verify.py` | 3DS RSA signature and AES crypto verification |
|
||||
| `core/cryptoverify.py` | 3DS RSA signature and AES crypto verification |
|
||||
| `core/sect233r1.py` | Pure Python ECDSA verification on sect233r1 curve (3DS OTP cert) |
|
||||
| `check_buildbot_system.py` | Detect stale data directories by comparing with buildbot |
|
||||
| `check_freshness.py` | One report on every upstream the repository transcribes (see above) |
|
||||
@@ -1728,7 +1728,7 @@ the GitHub and text fetches, and the shared CLI), `dat_parser.py` (clrmamepro DA
|
||||
`logiqx_parser.py` (Logiqx XML DAT parser, used by the dump catalogs),
|
||||
`mame_parser.py` (MAME C source BIOS root set parser),
|
||||
`fbneo_parser.py` (FBNeo C source BIOS set parser),
|
||||
`datfetch.py` (upstream MAME `-listxml` and FBNeo DATs, cached under `.cache/dats/`),
|
||||
`dat_fetch.py` (upstream MAME `-listxml` and FBNeo DATs, cached under `.cache/dats/`),
|
||||
`_hash_merge.py` (text-based YAML patching that preserves formatting).
|
||||
|
||||
Adding a scraper: inherit `BaseScraper`, implement `fetch_requirements()` and
|
||||
|
||||
Reference in new issue
Block a user