mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-10 21:43:23 -05:00
fix: align pack checks with builder, purge stale packs
This commit is contained in:
1 parent
966c0e5b59
commit
792bad3fd5
4 files changed
+134
No files matched your search
@@ -1178,6 +1178,10 @@ def generate_pack(
|
||||
continue
|
||||
|
||||
if _has_path_conflict(full_dest, seen_destinations, seen_parents):
|
||||
# Content ships under the conflicting shape (file vs dir,
|
||||
# e.g. SGB1.sfc): count it so pack totals match verify.py,
|
||||
# which resolves each declaration independently
|
||||
file_status.setdefault(dedup_key, "ok")
|
||||
continue
|
||||
|
||||
storage = file_entry.get("storage", "embedded")
|
||||
@@ -2458,6 +2462,9 @@ def _run_verify_packs(args):
|
||||
"""Extract each pack and verify file paths + hashes."""
|
||||
import shutil
|
||||
|
||||
with open(args.db) as f:
|
||||
verify_db = json.load(f)
|
||||
|
||||
platforms = list_registered_platforms(args.platforms_dir)
|
||||
if args.platform:
|
||||
platforms = [args.platform]
|
||||
@@ -2532,6 +2539,19 @@ def _run_verify_packs(args):
|
||||
fp = os.path.join(parent, e)
|
||||
break
|
||||
if not os.path.exists(fp):
|
||||
# File-vs-directory conflict: upstream declares both
|
||||
# SGB1.sfc and SGB1.sfc/program.rom; the builder can
|
||||
# only ship one shape, the other was skipped
|
||||
ancestor = os.path.dirname(fp)
|
||||
conflicted = False
|
||||
while len(ancestor) > len(extract_dir):
|
||||
if os.path.isfile(ancestor):
|
||||
conflicted = True
|
||||
break
|
||||
ancestor = os.path.dirname(ancestor)
|
||||
if conflicted or os.path.isdir(fp):
|
||||
ok += 1
|
||||
continue
|
||||
missing.append(f"{sys_id}: {dest}")
|
||||
continue
|
||||
if mode == "existence":
|
||||
@@ -2582,6 +2602,11 @@ def _run_verify_packs(args):
|
||||
)
|
||||
if collision:
|
||||
ok += 1
|
||||
elif not _repo_satisfies_declaration([fe], verify_db, "md5"):
|
||||
# No repo file matches the declared hash: shipped file
|
||||
# is the best effort, the gap is a data issue reported
|
||||
# by verify.py, not a pack error
|
||||
ok += 1
|
||||
else:
|
||||
hash_fail.append(f"{sys_id}: {dest}")
|
||||
|
||||
@@ -3691,6 +3716,14 @@ def verify_pack_against_platform(
|
||||
baseline_checked = 0
|
||||
baseline_present = 0
|
||||
decl_by_member: dict[str, list[dict]] = {}
|
||||
# Mirror the builder's path-conflict logic: a declaration whose path
|
||||
# collides file-vs-directory with a packed member was skipped by the
|
||||
# builder (upstream declares e.g. both SGB1.sfc and SGB1.sfc/program.rom)
|
||||
zip_parents: set[str] = set()
|
||||
for n in zip_set:
|
||||
parts = n.split("/")
|
||||
for i in range(1, len(parts)):
|
||||
zip_parents.add("/".join(parts[:i]))
|
||||
for sys_id, system in config.get("systems", {}).items():
|
||||
for fe in system.get("files", []):
|
||||
dest = fe.get("destination", fe.get("name", ""))
|
||||
@@ -3703,6 +3736,10 @@ def verify_pack_against_platform(
|
||||
member = expected
|
||||
elif expected.lower() in zip_lower:
|
||||
member = zip_lower[expected.lower()]
|
||||
elif _has_path_conflict(expected, zip_set, zip_parents):
|
||||
# Skipped by the builder for the same reason: not an error
|
||||
baseline_present += 1
|
||||
continue
|
||||
else:
|
||||
errors.append(f"baseline missing: {expected}")
|
||||
continue
|
||||
|
||||
@@ -313,6 +313,23 @@ def main():
|
||||
# Step 4: Generate packs
|
||||
pack_output = ""
|
||||
if not args.skip_packs:
|
||||
# Purge stale packs: leftover ZIPs from previous builds would be
|
||||
# picked up by pack verification and shipped in releases.
|
||||
out_dir = Path(args.output_dir)
|
||||
if out_dir.is_dir():
|
||||
stale = [
|
||||
p for p in out_dir.iterdir()
|
||||
if p.is_file() and (
|
||||
p.suffix == ".zip"
|
||||
or ".zip." in p.name
|
||||
or p.name == "SHA256SUMS.txt"
|
||||
)
|
||||
]
|
||||
for p in stale:
|
||||
p.unlink()
|
||||
if stale:
|
||||
print(f"Purged {len(stale)} stale pack file(s) from {out_dir}/")
|
||||
|
||||
pack_cmd = [
|
||||
sys.executable,
|
||||
"scripts/generate_pack.py",
|
||||
|
||||
@@ -477,6 +477,11 @@ def find_undeclared_files(
|
||||
path_base, by_name, by_path_suffix, data_names,
|
||||
by_name_lower,
|
||||
)
|
||||
if not in_repo:
|
||||
# Hash fallback: the repo may hold the content under a
|
||||
# different filename (exos21.rom vs exos21.bin)
|
||||
_lp, _st = resolve_local_file(f, db, dest_hint=dest)
|
||||
in_repo = _st not in ("not_found",) and _lp is not None
|
||||
|
||||
checks = _parse_validation(f.get("validation"))
|
||||
undeclared.append(
|
||||
|
||||
Reference in new issue
Block a user