From 27099cca40ef1d15b39ab69552c9a977d1bd23fc Mon Sep 17 00:00:00 2001 From: Radon Rosborough Date: Wed, 13 Jan 2021 21:02:08 -0800 Subject: [PATCH] Attempt to account for shared deps in CI --- tools/config.js | 22 +++++++++++----------- tools/plan-publish.js | 27 ++++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/tools/config.js b/tools/config.js index 9888df5..25e499d 100644 --- a/tools/config.js +++ b/tools/config.js @@ -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; } diff --git a/tools/plan-publish.js b/tools/plan-publish.js index 9ca4caf..a03812f 100644 --- a/tools/plan-publish.js +++ b/tools/plan-publish.js @@ -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,