Archive MaleCNS research sources, provenance, bibliography and immutable data inventory

This commit is contained in:
Digital Drosophila Archive
2026-09-29 03:38:32 +08:00
commit 3981628ff8
682 changed files with 161475 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
#!/usr/bin/env python3
"""Seal currently staged file bytes into a new SHA-256 file; no scientific writes."""
import hashlib
from pathlib import Path
import subprocess
root = Path.cwd()
target = root/"registry/repository-files.sha256"
if target.exists():
raise RuntimeError("Refusing to overwrite repository seal")
lines = []
for name in sorted(filter(None, subprocess.check_output(["git","ls-files","-z"]).decode().split("\0"))):
blob = subprocess.check_output(["git","show",":"+name])
actual = (root/name).read_bytes()
if blob != actual:
raise RuntimeError("Staged/worktree bytes differ: "+name)
lines.append(hashlib.sha256(blob).hexdigest()+" "+name+"\n")
with target.open("x",encoding="utf-8",newline="\n") as f:
f.writelines(lines)
print("sealed files:",len(lines))