javadtaghia's picture
Publish frozen stateful memory artifact
9dec4dc verified
Raw History Blame Contribute Delete
487 Bytes
from pathlib import Path
import hashlib, json, sqlite3
root=Path(__file__).parent
m=json.loads((root/'publication-manifest.json').read_text())
for item in m['inventory']:
p=root/item['path']; h='sha256:'+hashlib.sha256(p.read_bytes()).hexdigest()
assert h==item['sha256'], (item['path'], h)
if p.suffix=='.sqlite3':
c=sqlite3.connect(f'file:{p}?mode=ro&immutable=1', uri=True); assert c.execute('PRAGMA quick_check').fetchone()[0]=='ok'; c.close()
print('ok', m['manifest_digest'])