Optimize language build order
This commit is contained in:
parent
ce72de4f6f
commit
bb924ca926
|
@ -92,71 +92,79 @@ async function planDebianPackages(opts) {
|
||||||
(await getLangs()).map(async (id) => [id, await readLangConfig(id)])
|
(await getLangs()).map(async (id) => [id, await readLangConfig(id)])
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
return await Promise.all(
|
return _.sortBy(
|
||||||
packages.map(async ({ lang, type, name, buildScriptPath, debPath }) => {
|
await Promise.all(
|
||||||
const desired = crypto
|
packages.map(async ({ lang, type, name, buildScriptPath, debPath }) => {
|
||||||
.createHash("sha1")
|
const desired = crypto
|
||||||
.update(await fs.readFile(buildScriptPath, "utf-8"))
|
.createHash("sha1")
|
||||||
.digest("hex");
|
.update(await fs.readFile(buildScriptPath, "utf-8"))
|
||||||
let debExists = true;
|
.digest("hex");
|
||||||
try {
|
let debExists = true;
|
||||||
await fs.access(debPath);
|
try {
|
||||||
} catch (err) {
|
await fs.access(debPath);
|
||||||
debExists = false;
|
} catch (err) {
|
||||||
}
|
debExists = false;
|
||||||
let local = null;
|
}
|
||||||
if (debExists) {
|
let local = null;
|
||||||
local =
|
if (debExists) {
|
||||||
(
|
local =
|
||||||
await runCommand(`dpkg-deb -f ${debPath} Riju-Script-Hash`, {
|
(
|
||||||
getStdout: true,
|
await runCommand(`dpkg-deb -f ${debPath} Riju-Script-Hash`, {
|
||||||
})
|
getStdout: true,
|
||||||
).stdout.trim() || null;
|
})
|
||||||
}
|
).stdout.trim() || null;
|
||||||
const remote = remoteHashes[name] || null;
|
}
|
||||||
let sharedDeps = [];
|
const remote = remoteHashes[name] || null;
|
||||||
if (type === "lang") {
|
let sharedDeps = [];
|
||||||
const cfg = langConfigs[lang];
|
if (type === "lang") {
|
||||||
sharedDeps = ((cfg.install && cfg.install.riju) || []).map(
|
const cfg = langConfigs[lang];
|
||||||
(id) => sharedUUIDs[id]
|
sharedDeps = ((cfg.install && cfg.install.riju) || []).map(
|
||||||
);
|
(id) => sharedUUIDs[id]
|
||||||
}
|
|
||||||
return {
|
|
||||||
id: uuids[name],
|
|
||||||
deps: [
|
|
||||||
...(deps || []),
|
|
||||||
...(type === "config" ? [langUUIDs[lang]] : []),
|
|
||||||
...sharedDeps,
|
|
||||||
],
|
|
||||||
artifact: "Debian package",
|
|
||||||
name,
|
|
||||||
desired,
|
|
||||||
local,
|
|
||||||
remote,
|
|
||||||
download: async () => {
|
|
||||||
await runCommand(`make download L=${lang} T=${type}`);
|
|
||||||
},
|
|
||||||
build: async () => {
|
|
||||||
await runCommand(
|
|
||||||
`make shell I=packaging CMD="make pkg L=${lang} T=${type}"`
|
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
upload: async () => {
|
return {
|
||||||
if (type === "config") {
|
id: uuids[name],
|
||||||
const clauses = [];
|
deps: [
|
||||||
for (const dep of (langConfigs[lang].install || {}).riju || []) {
|
...(deps || []),
|
||||||
clauses.push(`make install T=shared L=${dep}`);
|
...(type === "config" ? [langUUIDs[lang]] : []),
|
||||||
}
|
...sharedDeps,
|
||||||
clauses.push(`make installs L=${lang}`);
|
],
|
||||||
clauses.push("make test");
|
artifact: "Debian package",
|
||||||
|
name,
|
||||||
|
desired,
|
||||||
|
local,
|
||||||
|
remote,
|
||||||
|
download: async () => {
|
||||||
|
await runCommand(`make download L=${lang} T=${type}`);
|
||||||
|
},
|
||||||
|
build: async () => {
|
||||||
await runCommand(
|
await runCommand(
|
||||||
`make shell I=runtime CMD="${clauses.join(" && ")}"`
|
`make shell I=packaging CMD="make pkg L=${lang} T=${type}"`
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
await runCommand(`make upload L=${lang} T=${type}`);
|
upload: async () => {
|
||||||
},
|
if (type === "config") {
|
||||||
};
|
const clauses = [];
|
||||||
})
|
for (const dep of (langConfigs[lang].install || {}).riju || []) {
|
||||||
|
clauses.push(`make install T=shared L=${dep}`);
|
||||||
|
}
|
||||||
|
clauses.push(`make installs L=${lang}`);
|
||||||
|
clauses.push("make test");
|
||||||
|
await runCommand(
|
||||||
|
`make shell I=runtime CMD="${clauses.join(" && ")}"`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
await runCommand(`make upload L=${lang} T=${type}`);
|
||||||
|
},
|
||||||
|
type,
|
||||||
|
};
|
||||||
|
})
|
||||||
|
),
|
||||||
|
({ type, desired, local, remote }) => {
|
||||||
|
// If *not* a shared package, and all we have to do is download
|
||||||
|
// it, then sort to the end.
|
||||||
|
return type !== "shared" && local !== desired && remote === desired;
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue