Skip to content

Commit

Permalink
fix: allow parallel apt calls in the llvm installer
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Aug 12, 2024
1 parent a93caaa commit a654826
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 12 deletions.
3 changes: 2 additions & 1 deletion dist/actions/setup-cpp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/actions/setup-cpp.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion dist/legacy/setup-cpp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/legacy/setup-cpp.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion dist/modern/setup-cpp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/modern/setup-cpp.js.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/llvm/llvm_installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { execa } from "execa"
import { chmod, readFile, writeFile } from "fs/promises"
import { DEFAULT_TIMEOUT } from "../installTool"
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"

export enum LLVMPackages {
Expand Down Expand Up @@ -70,16 +70,16 @@ function nonInteractiveScript(script: string) {
// make the scirpt non-interactive and fix broken packages
return script.replace(
/add-apt-repository "\${REPO_NAME}"/g,
// eslint-disable-next-line no-template-curly-in-string
"add-apt-repository -y \"${REPO_NAME}\"",
`add-apt-repository -y -n "\${REPO_NAME}"
apt-get update -o ${aptTimeout} -y`,
)
}

async function removeConflictingPackages(givenScript: string) {
// fix conflicts between libclang-rt and libclang
let script = givenScript.replace(
/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
Expand Down
4 changes: 2 additions & 2 deletions src/utils/setup/setupAptPack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ let didUpdate: boolean = false
let didInit: boolean = false

// 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 = {
name: string
Expand Down Expand Up @@ -177,7 +177,7 @@ export function hasNala() {
return which.sync("nala", { nothrow: true }) !== null
}

function getApt() {
export function getApt() {
let apt: string
if (hasNala()) {
apt = "nala"
Expand Down

0 comments on commit a654826

Please sign in to comment.