fix: review findings — hoist constants, cache emu profiles, renumber steps

- Hoist sev_order/sev_prio dicts to module-level constants (was rebuilt
  every loop iteration)
- Cache emulator profiles across platforms in verify main() (was loading
  260 YAMLs per platform, now loaded once)
- Renumber resolve_local_file steps 1-5 (was 1,2,3,5,6 after removal)
- Pass emu_profiles through verify_platform → find_undeclared_files
This commit is contained in:
Abdessamad Derraz
2026-03-19 11:22:58 +01:00
parent b9cdda07ee
commit 6d9edc5110
2 changed files with 19 additions and 10 deletions

View File

@@ -198,7 +198,7 @@ def resolve_local_file(
if primary or candidates:
return (primary[0] if primary else candidates[0]), "exact"
# 5. Name + alias fallback with md5_composite + direct MD5 per candidate
# 4. Name + alias fallback with md5_composite + direct MD5 per candidate
md5_set = set(md5_list)
candidates = []
seen_paths = set()
@@ -228,7 +228,7 @@ def resolve_local_file(
primary = [p for p, _ in candidates if "/.variants/" not in p]
return (primary[0] if primary else candidates[0][0]), "hash_mismatch"
# 6. zipped_file content match via pre-built index (last resort:
# 5. zipped_file content match via pre-built index (last resort:
# matches inner ROM MD5 across ALL ZIPs in the repo, so only use
# when name-based resolution failed entirely)
if zipped_file and md5_list and zip_contents: