Fix dependency error in plan-publish.js
This commit is contained in:
parent
a29329f71c
commit
36a0a86bd3
|
@ -31,6 +31,8 @@ export async function getSharedDeps() {
|
|||
// Return a list of objects representing the packages to be built. See
|
||||
// the function implementation for the full list of keys.
|
||||
export async function getPackages() {
|
||||
// The order (shared, lang, config) is important to get dependencies
|
||||
// correct due to poor abstractions in plan-publish.js.
|
||||
const packages = [];
|
||||
for (const lang of await getSharedDeps()) {
|
||||
const type = "shared";
|
||||
|
|
|
@ -92,8 +92,7 @@ async function planDebianPackages(opts) {
|
|||
(await getLangs()).map(async (id) => [id, await readLangConfig(id)])
|
||||
)
|
||||
);
|
||||
return _.sortBy(
|
||||
await Promise.all(
|
||||
const plan = await Promise.all(
|
||||
packages.map(async ({ lang, type, name, buildScriptPath, debPath }) => {
|
||||
const desired = crypto
|
||||
.createHash("sha1")
|
||||
|
@ -159,13 +158,26 @@ async function planDebianPackages(opts) {
|
|||
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;
|
||||
}
|
||||
);
|
||||
const lazilyDownloadedLanguages = new Set();
|
||||
for (const { type, lang, desired, local, remote } of plan) {
|
||||
if (type === "shared") {
|
||||
continue;
|
||||
}
|
||||
// If *not* a shared package, and all we have to do is download
|
||||
// it, then sort to the end. Unless of course this is the lang
|
||||
// package, and we need to rebuild the config package, in which
|
||||
// case the config package (which comes later) will remove that
|
||||
// lang from the set again.
|
||||
if (local !== desired && remote === desired) {
|
||||
lazilyDownloadedLanguages.add(lang);
|
||||
} else {
|
||||
lazilyDownloadedLanguages.delete(lang);
|
||||
}
|
||||
}
|
||||
return _.sortBy(plan, ({ type, lang }) => {
|
||||
return type !== "shared" && lazilyDownloadedLanguages.has(lang);
|
||||
});
|
||||
}
|
||||
|
||||
async function computePlan() {
|
||||
|
|
Loading…
Reference in New Issue