28 lines
982 B
Python
28 lines
982 B
Python
"""Refetch only the pinned textual originals; never import plugins or request media."""
|
|
|
|
import hashlib
|
|
import json
|
|
import urllib.request
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1] / "latent-reference"
|
|
|
|
|
|
def main():
|
|
sources = json.loads((ROOT / "sources.json").read_bytes())["sources"]
|
|
for e in sources:
|
|
assert len(e["commit"]) == 40 and e["commit"] in e["url"]
|
|
with urllib.request.urlopen(e["url"], timeout=30) as response:
|
|
raw = response.read()
|
|
assert hashlib.sha256(raw).hexdigest() == e["sha256"]
|
|
(ROOT / e["local_file"]).write_bytes(raw)
|
|
tree = json.loads((ROOT / "djz-tree.json").read_bytes())
|
|
assert tree["sha"] == "f6ca9376132600e6245d3d9d2f1e5d0ffa448d99"
|
|
assert not tree["truncated"]
|
|
assert not any("licen" in e["path"].lower() for e in tree["tree"])
|
|
print(f"PASS {len(sources)} exact textual originals; DJZ license remains unknown")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|