mirror of https://github.com/aminya/setup-cpp
fix: parallelize initApt
This commit is contained in:
parent
5528c08f49
commit
757782e485
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -59,7 +59,6 @@ export async function setupAptPack(packages: AptPackage[], update = false): Prom
|
||||||
|
|
||||||
async function getAptArg(name: string, version: string | undefined) {
|
async function getAptArg(name: string, version: string | undefined) {
|
||||||
if (version !== undefined && version !== "") {
|
if (version !== undefined && version !== "") {
|
||||||
console.log(`^${escapeRegex(`${name}-${version}`)}$`)
|
|
||||||
const { stdout } = await execa("apt-cache", [
|
const { stdout } = await execa("apt-cache", [
|
||||||
"search",
|
"search",
|
||||||
"--names-only",
|
"--names-only",
|
||||||
|
@ -100,13 +99,15 @@ async function initApt(apt: string) {
|
||||||
"ca-certificates",
|
"ca-certificates",
|
||||||
"gnupg",
|
"gnupg",
|
||||||
])
|
])
|
||||||
await addAptKeyViaServer(["3B4FE6ACC0B21F32", "40976EAF437D05B5"], "setup-cpp-ubuntu-archive.gpg")
|
const promises: Promise<any>[] = [
|
||||||
await addAptKeyViaServer(["1E9377A2BA9EF27F"], "launchpad-toolchain.gpg")
|
addAptKeyViaServer(["3B4FE6ACC0B21F32", "40976EAF437D05B5"], "setup-cpp-ubuntu-archive.gpg"),
|
||||||
|
addAptKeyViaServer(["1E9377A2BA9EF27F"], "launchpad-toolchain.gpg"),
|
||||||
|
]
|
||||||
if (apt === "nala") {
|
if (apt === "nala") {
|
||||||
// enable utf8 otherwise it fails because of the usage of ASCII encoding
|
// enable utf8 otherwise it fails because of the usage of ASCII encoding
|
||||||
await addEnv("LANG", "C.UTF-8")
|
promises.push(addEnv("LANG", "C.UTF-8"), addEnv("LC_ALL", "C.UTF-8"))
|
||||||
await addEnv("LC_ALL", "C.UTF-8")
|
|
||||||
}
|
}
|
||||||
|
await Promise.all(promises)
|
||||||
}
|
}
|
||||||
|
|
||||||
function initGpg() {
|
function initGpg() {
|
||||||
|
@ -117,8 +118,10 @@ export async function addAptKeyViaServer(keys: string[], name: string, server =
|
||||||
const fileName = `/etc/apt/trusted.gpg.d/${name}`
|
const fileName = `/etc/apt/trusted.gpg.d/${name}`
|
||||||
if (!(await pathExists(fileName))) {
|
if (!(await pathExists(fileName))) {
|
||||||
initGpg()
|
initGpg()
|
||||||
for (const key of keys) {
|
|
||||||
execRootSync("gpg", [
|
await Promise.all(
|
||||||
|
keys.map(async (key) => {
|
||||||
|
await execRoot("gpg", [
|
||||||
"--no-default-keyring",
|
"--no-default-keyring",
|
||||||
"--keyring",
|
"--keyring",
|
||||||
`gnupg-ring:${fileName}`,
|
`gnupg-ring:${fileName}`,
|
||||||
|
@ -127,8 +130,9 @@ export async function addAptKeyViaServer(keys: string[], name: string, server =
|
||||||
"--recv-keys",
|
"--recv-keys",
|
||||||
key,
|
key,
|
||||||
])
|
])
|
||||||
execRootSync("chmod", ["644", fileName])
|
await execRoot("chmod", ["644", fileName])
|
||||||
}
|
})
|
||||||
|
)
|
||||||
}
|
}
|
||||||
return fileName
|
return fileName
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue