Fix misc GBS errors
This commit is contained in:
parent
d41d8cb55e
commit
3299bd2ddb
7
Makefile
7
Makefile
|
@ -101,12 +101,17 @@ repkg: script # L=<lang> T=<type> : Build fresh .deb and install into live conta
|
||||||
|
|
||||||
script: # L=<lang> T=<type> : Generate a packaging script
|
script: # L=<lang> T=<type> : Generate a packaging script
|
||||||
@: $${L} $${T}
|
@: $${L} $${T}
|
||||||
|
ifeq ($(T),install)
|
||||||
|
@echo >&2 "use 'make script L=$(L) T=lang' instead"
|
||||||
|
@exit 1
|
||||||
|
endif
|
||||||
mkdir -p $(BUILD)
|
mkdir -p $(BUILD)
|
||||||
node tools/generate-build-script.js --lang $(L) --type $(T) > $(BUILD)/build.bash
|
node tools/generate-build-script.js --lang $(L) --type $(T) > $(BUILD)/build.bash
|
||||||
|
chmod +x $(BUILD)/build.bash
|
||||||
ifeq ($(T),lang)
|
ifeq ($(T),lang)
|
||||||
node tools/generate-build-script.js --lang $(L) --type install > $(BUILD)/install.bash
|
node tools/generate-build-script.js --lang $(L) --type install > $(BUILD)/install.bash
|
||||||
|
chmod +x $(BUILD)/install.bash
|
||||||
endif
|
endif
|
||||||
chmod +x $(BUILD)/build.bash
|
|
||||||
|
|
||||||
all-scripts: # Generate packaging scripts for all languages
|
all-scripts: # Generate packaging scripts for all languages
|
||||||
node tools/write-all-build-scripts.js
|
node tools/write-all-build-scripts.js
|
||||||
|
|
|
@ -22,31 +22,27 @@ function makeLangScript(langConfig, isShared) {
|
||||||
let parts = [];
|
let parts = [];
|
||||||
let depends = [];
|
let depends = [];
|
||||||
const dependsCfg = (install && install.depends) || {};
|
const dependsCfg = (install && install.depends) || {};
|
||||||
let needsAptGetUpdate = false;
|
let prefaceNeedsAptGetUpdate = false;
|
||||||
|
let prepareNeedsAptGetUpdate = false;
|
||||||
if (
|
if (
|
||||||
install &&
|
install &&
|
||||||
((install.prepare &&
|
((install.prepare &&
|
||||||
((install.prepare.manual && install.prepare.manual.includes("apt-get")) ||
|
|
||||||
(install.prepare.apt && install.prepare.apt.length > 0))) ||
|
|
||||||
(install.apt &&
|
|
||||||
install.apt.filter((pkg) => pkg.includes("$")).length > 0))
|
|
||||||
) {
|
|
||||||
parts.push(`\
|
|
||||||
export DEBIAN_FRONTEND=noninteractive`);
|
|
||||||
if (
|
|
||||||
install.prepare &&
|
|
||||||
((install.prepare.manual &&
|
((install.prepare.manual &&
|
||||||
install.prepare.manual.includes("apt-get") &&
|
install.prepare.manual.includes("apt-get") &&
|
||||||
install.prepare.manual.includes(":i386")) ||
|
install.prepare.manual.includes(":i386")) ||
|
||||||
(install.prepare.apt &&
|
(install.prepare.apt &&
|
||||||
install.prepare.apt.filter((pkg) => pkg.includes(":i386")).length >
|
install.prepare.apt.filter((pkg) => pkg.includes(":i386")).length >
|
||||||
0))
|
0))) ||
|
||||||
) {
|
(install.preface &&
|
||||||
parts.push(`\
|
((install.preface.manual &&
|
||||||
|
install.preface.manual.includes("apt-get") &&
|
||||||
|
install.preface.manual.includes(":i386")) ||
|
||||||
|
(install.preface.apt &&
|
||||||
|
install.preface.apt.filter((pkg) => pkg.includes(":i386")).length >
|
||||||
|
0))))
|
||||||
|
) {
|
||||||
|
prefaceParts.push(`\
|
||||||
dpkg --add-architecture i386`);
|
dpkg --add-architecture i386`);
|
||||||
}
|
|
||||||
parts.push(`\
|
|
||||||
sudo --preserve-env=DEBIAN_FRONTEND apt-get update`);
|
|
||||||
}
|
}
|
||||||
if (install) {
|
if (install) {
|
||||||
const {
|
const {
|
||||||
|
@ -109,7 +105,7 @@ ${aptRepo.join("\n")}
|
||||||
EOF`);
|
EOF`);
|
||||||
}
|
}
|
||||||
if (apt && apt.length > 0) {
|
if (apt && apt.length > 0) {
|
||||||
needsAptGetUpdate = true;
|
prefaceNeedsAptGetUpdate = true;
|
||||||
prefaceParts.push(`\
|
prefaceParts.push(`\
|
||||||
sudo --preserve-env=DEBIAN_FRONTEND apt-get install -y ${apt.join(" ")}`);
|
sudo --preserve-env=DEBIAN_FRONTEND apt-get install -y ${apt.join(" ")}`);
|
||||||
}
|
}
|
||||||
|
@ -286,7 +282,7 @@ chmod +x "${path}"`);
|
||||||
}
|
}
|
||||||
if (apt) {
|
if (apt) {
|
||||||
if (apt.filter((pkg) => pkg.includes("$")).length > 0) {
|
if (apt.filter((pkg) => pkg.includes("$")).length > 0) {
|
||||||
needsAptGetUpdate = true;
|
prepareNeedsAptGetUpdate = true;
|
||||||
}
|
}
|
||||||
depends = depends.concat(apt);
|
depends = depends.concat(apt);
|
||||||
}
|
}
|
||||||
|
@ -302,10 +298,12 @@ chmod +x "${path}"`);
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (needsAptGetUpdate) {
|
if (prefaceNeedsAptGetUpdate) {
|
||||||
prefaceParts.unshift(`\
|
prefaceParts.unshift(`\
|
||||||
export DEBIAN_FRONTEND=noninteractive`);
|
sudo --preserve-env=DEBIAN_FRONTEND apt-get update`);
|
||||||
prefaceParts.push(`\
|
}
|
||||||
|
if (prepareNeedsAptGetUpdate) {
|
||||||
|
parts.unshift(`\
|
||||||
sudo --preserve-env=DEBIAN_FRONTEND apt-get update`);
|
sudo --preserve-env=DEBIAN_FRONTEND apt-get update`);
|
||||||
}
|
}
|
||||||
parts = prefaceParts.concat(parts);
|
parts = prefaceParts.concat(parts);
|
||||||
|
@ -348,7 +346,9 @@ fi`);
|
||||||
parts.unshift(`\
|
parts.unshift(`\
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -euxo pipefail`);
|
set -euxo pipefail
|
||||||
|
|
||||||
|
export DEBIAN_FRONTEND=noninteractive`);
|
||||||
return parts.join("\n\n");
|
return parts.join("\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,7 +366,7 @@ function makeSharedScript(langConfig) {
|
||||||
// with its shared dependencies, if any).
|
// with its shared dependencies, if any).
|
||||||
function makeInstallScript(langConfig) {
|
function makeInstallScript(langConfig) {
|
||||||
let parts = [];
|
let parts = [];
|
||||||
const { install } = langConfig;
|
const { id, install } = langConfig;
|
||||||
if (install) {
|
if (install) {
|
||||||
const { apt, cert, aptKey, aptRepo } = install;
|
const { apt, cert, aptKey, aptRepo } = install;
|
||||||
if (apt && apt.filter((pkg) => pkg.includes(":i386")).length > 0) {
|
if (apt && apt.filter((pkg) => pkg.includes(":i386")).length > 0) {
|
||||||
|
@ -390,7 +390,7 @@ dpkg --add-architecture i386`);
|
||||||
.map((src) => {
|
.map((src) => {
|
||||||
if (src.startsWith("http://") || src.startsWith("https://")) {
|
if (src.startsWith("http://") || src.startsWith("https://")) {
|
||||||
return `curl -fsSL "${src}" | sudo apt-key add -`;
|
return `curl -fsSL "${src}" | sudo apt-key add -`;
|
||||||
} else if (/^[0-9A-F]+$/.match(src)) {
|
} else if (src.match(/^[0-9A-F]+$/)) {
|
||||||
return `sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys "${src}"`;
|
return `sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys "${src}"`;
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`unknown aptKey format: ${src}`);
|
throw new Error(`unknown aptKey format: ${src}`);
|
||||||
|
@ -416,7 +416,7 @@ export async function generateBuildScript({ lang, type }) {
|
||||||
const scriptMaker = {
|
const scriptMaker = {
|
||||||
lang: async () => makeLangScript(await readLangConfig(lang)),
|
lang: async () => makeLangScript(await readLangConfig(lang)),
|
||||||
shared: async () => makeSharedScript(await readSharedDepConfig(lang)),
|
shared: async () => makeSharedScript(await readSharedDepConfig(lang)),
|
||||||
install: async () => await makeInstallScript(lang),
|
install: async () => makeInstallScript(await readLangConfig(lang)),
|
||||||
}[type];
|
}[type];
|
||||||
if (!scriptMaker) {
|
if (!scriptMaker) {
|
||||||
throw new Error(`unsupported script type ${type}`);
|
throw new Error(`unsupported script type ${type}`);
|
||||||
|
|
Loading…
Reference in New Issue