DOWNLOAD_IOMATEX_APP/scripts/check-platform-mirrors.py

16 lines
782 B
Python

#!/usr/bin/env python3
"""Verify physical download folders against legacy updater paths without changing feeds."""
from pathlib import Path
import hashlib
root = Path(__file__).resolve().parents[1]
for platform, folder in (("android", "Android_Releases"), ("windows", "Windows_Releases"), ("debian", "Debian_Releases")):
def inventory(directory):
return {str(p.relative_to(directory)): hashlib.sha256(p.read_bytes()).hexdigest()
for p in directory.rglob("*") if p.is_file()}
legacy = inventory(root / "edge-client" / platform)
mirror = inventory(root / folder)
if not legacy or legacy != mirror:
raise SystemExit(f"Mirror differs: {folder}; synchronize files before publication")
print(f"{folder}: {len(mirror)} files verified")