DSH-Arch-Setup/test/editor-runtime.test.py
Шурупов Илья Викторович cf9443753e Add one-command Arch DSH setup
Package the portable DSH profiles, local plugins, desktop integration, Firefox wrapper, and ownership-aware installer lifecycle. Bundle checksum-pinned OpenVSCode, editor extensions, translation assets, and cloudflared so unreliable upstream artifact downloads cannot break a clean installation.
2026-09-12 19:13:36 +03:00

25 lines
1.1 KiB
Python

import hashlib
import json
import tarfile
from pathlib import Path
repository = Path(__file__).resolve().parent.parent
version, relative, expected_hash = (repository / "manifests" / "editor-runtime.tsv").read_text().strip().split("\t")
archive = repository / relative
license_file = repository / "editor-runtime" / "LICENSE.openvscode-server.txt"
if "MIT License" not in license_file.read_text():
raise RuntimeError("OpenVSCode license missing")
actual_hash = hashlib.sha256(archive.read_bytes()).hexdigest()
if actual_hash != expected_hash:
raise RuntimeError("OpenVSCode runtime checksum mismatch")
with tarfile.open(archive, "r:gz") as package:
binary = package.getmember("current/bin/openvscode-server")
if binary.mode & 0o111 == 0:
raise RuntimeError("OpenVSCode launcher is not executable")
product_file = package.extractfile("current/product.json")
if product_file is None:
raise RuntimeError("OpenVSCode product metadata missing")
product = json.load(product_file)
if product.get("version") != version:
raise RuntimeError("OpenVSCode runtime version mismatch")
print("editor runtime artifact test passed")