fix: allow parallel apt calls in the llvm installer

This commit is contained in:
Amin Yahyaabadi 2024-08-12 03:10:38 -07:00
parent a93caaa4ac
commit a65482651a
No known key found for this signature in database
GPG Key ID: F52AF77F636088F0
8 changed files with 15 additions and 12 deletions

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@ import { execa } from "execa"
import { chmod, readFile, writeFile } from "fs/promises" import { chmod, readFile, writeFile } from "fs/promises"
import { DEFAULT_TIMEOUT } from "../installTool" import { DEFAULT_TIMEOUT } from "../installTool"
import { addPath } from "../utils/env/addEnv" import { addPath } from "../utils/env/addEnv"
import { hasNala, isPackageRegexInstalled, setupAptPack } from "../utils/setup/setupAptPack" import { aptTimeout, hasNala, isPackageRegexInstalled, setupAptPack } from "../utils/setup/setupAptPack"
import type { InstallationInfo } from "../utils/setup/setupBin" import type { InstallationInfo } from "../utils/setup/setupBin"
export enum LLVMPackages { export enum LLVMPackages {
@ -70,8 +70,8 @@ function nonInteractiveScript(script: string) {
// make the scirpt non-interactive and fix broken packages // make the scirpt non-interactive and fix broken packages
return script.replace( return script.replace(
/add-apt-repository "\${REPO_NAME}"/g, /add-apt-repository "\${REPO_NAME}"/g,
// eslint-disable-next-line no-template-curly-in-string `add-apt-repository -y -n "\${REPO_NAME}"
"add-apt-repository -y \"${REPO_NAME}\"", apt-get update -o ${aptTimeout} -y`,
) )
} }
@ -79,7 +79,7 @@ async function removeConflictingPackages(givenScript: string) {
// fix conflicts between libclang-rt and libclang // fix conflicts between libclang-rt and libclang
let script = givenScript.replace( let script = givenScript.replace(
/apt-get install -y/g, /apt-get install -y/g,
"apt-get install -o Dpkg::Options::=\"--force-overwrite\" -y --fix-broken", `apt-get install -o Dpkg::Options::="--force-overwrite" -o ${aptTimeout} -y --fix-broken`,
) )
// check if these are installed and if so, remove them from the script as they conflict // check if these are installed and if so, remove them from the script as they conflict

View File

@ -14,7 +14,7 @@ let didUpdate: boolean = false
let didInit: boolean = false let didInit: boolean = false
// wait up to 300 seconds if the apt-get lock is held // wait up to 300 seconds if the apt-get lock is held
const aptTimeout = "DPkg::Lock::Timeout=300" export const aptTimeout = "DPkg::Lock::Timeout=300"
export type AptPackage = { export type AptPackage = {
name: string name: string
@ -177,7 +177,7 @@ export function hasNala() {
return which.sync("nala", { nothrow: true }) !== null return which.sync("nala", { nothrow: true }) !== null
} }
function getApt() { export function getApt() {
let apt: string let apt: string
if (hasNala()) { if (hasNala()) {
apt = "nala" apt = "nala"