52 lines
1.3 KiB
Python
52 lines
1.3 KiB
Python
"""Explicit batch172 log records; never discover logs through a cross-batch glob."""
|
|
|
|
import hashlib
|
|
import json
|
|
import shutil
|
|
from pathlib import Path
|
|
|
|
REPO = Path(__file__).resolve().parents[3]
|
|
LOCAL = REPO / ".local-evidence/batch172-mh4r"
|
|
KEYS = (
|
|
"definition",
|
|
"repeat",
|
|
"source",
|
|
"format-write",
|
|
"pytest",
|
|
"lint",
|
|
"format-check",
|
|
"js",
|
|
"frontend-build",
|
|
"backend-build",
|
|
"recompute",
|
|
"freeze",
|
|
"browser",
|
|
"finalize",
|
|
"diff-check",
|
|
"repair-format",
|
|
"lint-final",
|
|
"format-final",
|
|
)
|
|
|
|
|
|
def collect(out):
|
|
records = []
|
|
for key in KEYS:
|
|
record = json.loads((LOCAL / "records" / (key + ".json")).read_bytes())
|
|
assert record["key"] == key
|
|
assert record["returncode"] == 0 or (key == "lint" and record["returncode"] == 1)
|
|
for row in record["logs"]:
|
|
p = LOCAL / "logs" / row["name"]
|
|
assert p.parent == LOCAL / "logs" and p.stat().st_size == row["bytes"]
|
|
assert hashlib.sha256(p.read_bytes()).hexdigest() == row["sha256"]
|
|
shutil.copyfile(p, out / p.name)
|
|
records.append(record)
|
|
(out / "completed-log-records.json").write_text(
|
|
json.dumps(
|
|
dict(explicit_keys=list(KEYS), no_glob=True, records=records),
|
|
ensure_ascii=False,
|
|
indent=2,
|
|
)
|
|
+ "\n"
|
|
)
|