Some checks failed
Android CI / build (push) Has been cancelled
Релиз v0.4.4: sing-box-extended v1.14.1-extended-2.7.2, встроенная Hysteria app/v2.12.3 (перегенерированы core-patches 0003–0005 по новому docs/CORE_UPDATE.md, работа параллельной сессии), Go 1.26.8 в пинах и CI, маскировка адресов серверов, фиксы IP rule-set и импорта VLESS type=http. Заморозка фиксирует singbox, hysteria и Amnezia (toolchain go1.26.8) из Windows-лока 1ab2727; check_core_release_freeze.py совпадает байт-в-байт. Хост: verify-project, 407 unit-тестов, instrumentation APK. На устройстве не проверялось.
61 lines
3.3 KiB
Python
61 lines
3.3 KiB
Python
#!/usr/bin/env python3
|
|
"""Offline validation of one coordinated Windows/Android core version freeze."""
|
|
from __future__ import annotations
|
|
import argparse
|
|
import hashlib
|
|
import json
|
|
from pathlib import Path
|
|
|
|
|
|
def digest(path: Path) -> str:
|
|
return hashlib.sha256(path.read_bytes()).hexdigest()
|
|
|
|
|
|
def verify(root: Path, platform: str, version: str) -> dict:
|
|
freeze = json.loads((root / "core-release-freeze.json").read_text(encoding="utf-8"))
|
|
if freeze["schema"] != 1 or freeze["releases"][platform] != version:
|
|
raise ValueError("Core freeze belongs to a different release; prepare this release first")
|
|
for name, expected in freeze["inputs"][platform].items():
|
|
path = root / name
|
|
if path.resolve().is_relative_to(root.resolve()) is False or digest(path) != expected:
|
|
raise ValueError(f"Frozen core input changed: {name}")
|
|
pin = freeze["amnezia"]
|
|
# Both platforms ship the one sing-box-extended release selected at freeze time.
|
|
core = freeze["singbox"]
|
|
# ...and the one official Hysteria release (older receipts predate this pin).
|
|
hysteria = freeze.get("hysteria")
|
|
if platform == "windows":
|
|
lock = json.loads((root / "scripts/core-lock.windows-x64.json").read_text(encoding="utf-8"))
|
|
if lock["amnezia"] != pin:
|
|
raise ValueError("Windows Amnezia differs from coordinated freeze")
|
|
if {key: lock["singbox_build"][key] for key in ("version", "commit")} != core:
|
|
raise ValueError("Windows sing-box differs from coordinated freeze")
|
|
if hysteria is not None:
|
|
source = next((item for item in lock["sources"] if item.get("id") == "hysteria"), {})
|
|
if source.get("version") != hysteria["version"]:
|
|
raise ValueError("Windows Hysteria differs from coordinated freeze")
|
|
else:
|
|
properties = dict(line.split("=", 1) for line in (root / "core.properties").read_text().splitlines() if "=" in line)
|
|
if (properties["CORE_TAG"], properties["CORE_COMMIT"]) != (core["version"], core["commit"]):
|
|
raise ValueError("Android sing-box differs from coordinated freeze")
|
|
expected = f'{pin["module"]}@{pin["version"]}'
|
|
if any(properties.get(key) != expected for key in ("ANDROID_WIREGUARD_GO", "ANDROID_AMNEZIAWG_GO")):
|
|
raise ValueError("Android Amnezia differs from coordinated freeze")
|
|
if properties["GO_VERSION"] != pin["toolchain"]["version"].removeprefix("go"):
|
|
raise ValueError("Android and Windows Go toolchains differ")
|
|
if hysteria is not None and properties.get("HYSTERIA_CORE_TAG") != hysteria["version"]:
|
|
raise ValueError(
|
|
"Android Hysteria differs from coordinated freeze: regenerate core-patches/0003 "
|
|
"for the Windows-selected release (docs/CORE_UPDATE.md)"
|
|
)
|
|
return freeze
|
|
|
|
|
|
if __name__ == "__main__":
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument("platform", choices=("windows", "android"))
|
|
parser.add_argument("version")
|
|
parser.add_argument("--root", type=Path, default=Path(__file__).resolve().parents[1])
|
|
args = parser.parse_args()
|
|
pin = verify(args.root, args.platform, args.version)["amnezia"]
|
|
print(f'Frozen official Amnezia: {pin["version"]} @ {pin["commit"]}')
|