Files
workinf_Blender_Wasm/tools/web/check-offline-reproducibility.mjs
2026-08-12 04:47:48 -04:00

16 lines
959 B
JavaScript

import assert from "node:assert/strict";
import crypto from "node:crypto";
import fs from "node:fs";
import { execFileSync } from "node:child_process";
const creator = new URL("./create-offline-release.mjs", import.meta.url);
const archive = new URL("../../release/blender-web-offline.tar.gz", import.meta.url);
const sourceArchive = new URL("../../release/blender-web-corresponding-source.tar.gz", import.meta.url);
const digest = (file) => crypto.createHash("sha256").update(fs.readFileSync(file)).digest("hex");
execFileSync(process.execPath, [creator.pathname], { stdio: "inherit" });
const first = [digest(archive), digest(sourceArchive)];
execFileSync(process.execPath, [creator.pathname], { stdio: "inherit" });
const second = [digest(archive), digest(sourceArchive)];
assert.deepEqual(second, first, "offline binary/source archives are not reproducible");
process.stdout.write(`offline-reproducibility-ok binary=${second[0]} source=${second[1]}\n`);