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.
This commit is contained in:
Abdessamad Derraz committed 2026-11-20 20:03:26 +01:00
1 parent 1165b910ed
commit 3a76cf48ba
7 files changed
+156 -170

No files matched your search

+3 -3
View File
@@ -185,7 +185,7 @@ class ContentList(unittest.TestCase):
import yaml
data = yaml.safe_load(regioncheck.CONTENT_FILE.read_text(encoding="utf-8"))
content = regioncheck.load_content()
content = regioncheck.load_content(regioncheck.CONTENT_FILE)
uncovered = data.get("uncovered") or {}
profiles = load_emulator_profiles(str(ROOT / "emulators"))
regional: set[str] = set()
@@ -197,10 +197,10 @@ class ContentList(unittest.TestCase):
for system in sorted(regional):
if system in uncovered:
continue
held = {item.get("region") for item in content.get(system, [])}
held = {item.region for item in content.get(system, [])}
missing = {"japan", "north-america", "europe"} - held
# One cartridge sold in two territories counts for both.
missing -= {r for item in content.get(system, []) for r in item.get("also_regions") or ()}
missing -= {r for item in content.get(system, []) for r in item.also_regions}
self.assertFalse(missing, f"{system}: no game for {sorted(missing)}")