Skip to content

Commit 2e79080

Browse files
committed
fix: fix conflicts between clang apt packages
1 parent dd2f113 commit 2e79080

File tree

8 files changed

+25
-12
lines changed

8 files changed

+25
-12
lines changed

dist/actions/setup-cpp.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/actions/setup-cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/legacy/setup-cpp.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/legacy/setup-cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/modern/setup-cpp.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/modern/setup-cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/llvm/llvm.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ async function patchAptLLVMScript(path: string, target_path: string) {
8787
// eslint-disable-next-line no-template-curly-in-string
8888
'add-apt-repository -y "${REPO_NAME}"'
8989
)
90-
.replace(/apt-get install -y/g, "apt-get install -y --fix-broken")
90+
// fix conflicts between libclang-rt and libclang
91+
.replace(/apt-get install -y/g, 'apt-get install -o Dpkg::Options::="--force-overwrite" -y --fix-broken')
9192
// use nala if it is available
9293
if (hasNala()) {
9394
script = script.replace(/apt-get/g, "nala")

src/utils/setup/setupAptPack.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { addEnv, cpprc_path, setupCppInProfile } from "../env/addEnv"
55
import { pathExists } from "path-exists"
66
import { promises as fsPromises } from "fs"
77
const { appendFile } = fsPromises
8-
import { execa } from "execa"
8+
import { execa, ExecaError } from "execa"
99
import escapeRegex from "escape-string-regexp"
1010
import { warning, info } from "ci-log"
1111
import which from "which"
@@ -52,7 +52,19 @@ export async function setupAptPack(packages: AptPackage[], update = false): Prom
5252
}
5353

5454
const aptArgs = await Promise.all(packages.map((pack) => getAptArg(pack.name, pack.version)))
55-
execRootSync(apt, ["install", "--fix-broken", "-y", ...aptArgs])
55+
try {
56+
execRootSync(apt, ["install", "--fix-broken", "-y", ...aptArgs])
57+
} catch (err) {
58+
if ("stderr" in (err as ExecaError)) {
59+
const stderr = (err as ExecaError).stderr
60+
if (stderr.includes("E: Could not get lock") || stderr.includes("dpkg: error processing archive")) {
61+
warning(`Failed to install packages ${aptArgs}. Retrying...`)
62+
execRootSync(apt, ["install", "--fix-broken", "-y", ...aptArgs])
63+
}
64+
} else {
65+
throw err
66+
}
67+
}
5668

5769
return { binDir: "/usr/bin/" }
5870
}

0 commit comments

Comments
 (0)