Files
aigc-home/docs/hel-892/zimage-document-evidence/bind_sources.py
T
2026-10-31 08:35:25 +08:00

38 lines
1.5 KiB
Python

"Bind exact Git text plus already archived locked package members; no execution."
import hashlib
import json
import os
from pathlib import Path
REF = Path(__file__).resolve().parent.parent / "zimage-reference"
def main():
rows = json.loads((REF / "new-sources.json").read_bytes())["sources"]
for e in rows:
e.update(identity_root=".", identity_key=e["id"])
if e["id"] == "tt":
e["license_file"] = "未知:准确完整树无LICENSE;不推定授权"
origin = REF.parent / "flux2-lineart-reference"
for old in json.loads((origin / "sources.json").read_bytes())["sources"]:
if old["id"] != "litegraph":
continue
e = dict(old)
e["local_file"] = os.path.relpath(origin / old["local_file"], REF)
e["license_file"] = os.path.relpath(origin / "litegraph__package__LICENSE", REF)
e["identity_root"] = os.path.relpath(origin, REF)
e["identity_key"] = "litegraph"
e["transport"] = "复用既有准确锁定包成员;本批重算成员SHA,不声称重算完整包摘要或Git身份"
rows.append(e)
for e in rows:
e["applicability"] = "本Z-Image图声明准确版本;LG/0246/UE恢复与目标安装未知"
assert hashlib.sha256((REF / e["local_file"]).read_bytes()).hexdigest() == e["sha256"]
(REF / "sources.json").write_text(
json.dumps(dict(sources=rows, upstream_executed=False), ensure_ascii=False, indent=2) + "\n"
)
if __name__ == "__main__":
main()