Attempt to account for shared deps in CI

This commit is contained in:
Radon Rosborough 2021-01-13 21:02:08 -08:00
parent 65c5403b6f
commit 27099cca40
2 changed files with 35 additions and 14 deletions

View File

@ -32,6 +32,17 @@ export async function getSharedDeps() {
// the function implementation for the full list of keys.
export async function getPackages() {
const packages = [];
for (const dep of await getSharedDeps()) {
const type = "shared";
const name = `riju-${type}-${lang}`;
packages.push({
lang,
type,
name,
buildScriptPath: `build/${type}/${lang}/build.bash`,
debPath: `build/${type}/${lang}/${name}.deb`,
});
}
for (const lang of await getLangs()) {
for (const type of ["lang", "config"]) {
const name = `riju-${type}-${lang}`;
@ -44,17 +55,6 @@ export async function getPackages() {
});
}
}
for (const dep of await getSharedDeps()) {
const type = "shared";
const name = `riju-${type}-${lang}`;
packages.push({
lang,
type,
name,
buildScriptPath: `build/${type}/${lang}/build.bash`,
debPath: `build/${type}/${lang}/${name}.deb`,
});
}
return packages;
}

View File

@ -74,10 +74,23 @@ async function planDebianPackages(opts) {
})
);
const packages = await getPackages();
const uuids = Object.fromEntries(
packages.map(({ name }) => [name, getUUID()])
);
const langUUIDs = Object.fromEntries(
packages
.filter(({ type }) => type === "lang")
.map(({ lang }) => ["lang", getUUID()])
.map(({ lang, name }) => [lang, uuids[name]])
);
const sharedUUIDs = Object.fromEntries(
packages
.filter(({ type }) => type === "shared")
.map(({ lang }) => [lang, uuids[name]])
);
const langConfigs = Object.fromEntries(
await Promise.all(
(await getLangs()).map(async (id) => [id, await readLangConfig(id)])
)
);
return await Promise.all(
packages.map(async ({ lang, type, name, buildScriptPath, debPath }) => {
@ -101,11 +114,19 @@ async function planDebianPackages(opts) {
).stdout.trim() || null;
}
const remote = remoteHashes[name] || null;
let sharedDeps = [];
if (type === "lang") {
const cfg = langConfigs[lang];
sharedDeps = ((cfg.install && cfg.install.riju) || []).map(
(id) => sharedUUIDs[id]
);
}
return {
id: getUUID(),
id: uuids[name],
deps: [
...(deps || []),
type === "config" ? langUUIDs[lang] : getUUID(),
...(type === "config" ? [langUUIDs[lang]] : []),
...sharedDeps,
],
artifact: "Debian package",
name,