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

+18
View File
@@ -3,8 +3,10 @@
from __future__ import annotations
import hashlib
from pathlib import Path
from model import measurements as mr
from probes.host import working_directory
def profile_digest(profile: dict) -> str:
@@ -17,6 +19,22 @@ def profile_digest(profile: dict) -> str:
return hashlib.sha1(mr.canonical(body)).hexdigest()
def held_file(entry: dict, db: dict, root: Path) -> Path | None:
"""The collection's copy of an entry in the checkout at root, by its
declared hashes or its name."""
from resolve.localfile import resolve_local_file
hint = entry.get("path") if isinstance(entry.get("path"), str) else ""
# The database names files relative to the checkout it describes.
with working_directory(root):
path, status = resolve_local_file(entry, db, dest_hint=hint or "")
if not path or status in ("not_found", "hash_mismatch"):
return None
local = Path(path)
local = local if local.is_absolute() else root / local
return local if local.is_file() else None
def entry_systems(entry: dict, profile: dict) -> list[str]:
if entry.get("systems"):
return list(entry["systems"])