Fix subtle hash calculation bugs

This commit is contained in:
Radon Rosborough 2020-12-31 23:07:00 -08:00
parent b4c5cf2763
commit 9860f8f07c
1 changed files with 16 additions and 11 deletions

View File

@ -4,7 +4,7 @@ import http from "http";
import express from "express";
import { getLangs, getPackages } from "./config.js";
import { getLocalImageDigest } from "./docker-util.js";
import { getLocalImageLabel } from "./docker-util.js";
import { hashDockerfile } from "./hash-dockerfile.js";
import { runCommand } from "./util.js";
@ -25,19 +25,24 @@ async function main() {
const hash = await hashDockerfile(
"composite",
{
"riju:runtime": await getLocalImageDigest("riju:runtime"),
"riju:runtime": await getLocalImageLabel(
"riju:runtime",
"riju.image-hash"
),
},
{
salt: {
packageHashes: await Promise.all(
(await getPackages()).map(async ({ debPath }) => {
return (
await runCommand(`dpkg-deb -f ${debPath} Riju-Script-Hash`, {
getStdout: true,
})
).stdout.trim();
})
),
packageHashes: (
await Promise.all(
(await getPackages()).map(async ({ debPath }) => {
return (
await runCommand(`dpkg-deb -f ${debPath} Riju-Script-Hash`, {
getStdout: true,
})
).stdout.trim();
})
)
).sort(),
},
}
);