fix: fix conflicts between clang apt packages

This commit is contained in:
Amin Yahyaabadi 2023-07-17 14:21:12 -07:00
parent dd2f1139ce
commit 2e790802d0
8 changed files with 25 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

@ -87,7 +87,8 @@ async function patchAptLLVMScript(path: string, target_path: string) {
// eslint-disable-next-line no-template-curly-in-string // eslint-disable-next-line no-template-curly-in-string
'add-apt-repository -y "${REPO_NAME}"' 'add-apt-repository -y "${REPO_NAME}"'
) )
.replace(/apt-get install -y/g, "apt-get install -y --fix-broken") // fix conflicts between libclang-rt and libclang
.replace(/apt-get install -y/g, 'apt-get install -o Dpkg::Options::="--force-overwrite" -y --fix-broken')
// use nala if it is available // use nala if it is available
if (hasNala()) { if (hasNala()) {
script = script.replace(/apt-get/g, "nala") script = script.replace(/apt-get/g, "nala")

View File

@ -5,7 +5,7 @@ import { addEnv, cpprc_path, setupCppInProfile } from "../env/addEnv"
import { pathExists } from "path-exists" import { pathExists } from "path-exists"
import { promises as fsPromises } from "fs" import { promises as fsPromises } from "fs"
const { appendFile } = fsPromises const { appendFile } = fsPromises
import { execa } from "execa" import { execa, ExecaError } from "execa"
import escapeRegex from "escape-string-regexp" import escapeRegex from "escape-string-regexp"
import { warning, info } from "ci-log" import { warning, info } from "ci-log"
import which from "which" import which from "which"
@ -52,7 +52,19 @@ export async function setupAptPack(packages: AptPackage[], update = false): Prom
} }
const aptArgs = await Promise.all(packages.map((pack) => getAptArg(pack.name, pack.version))) const aptArgs = await Promise.all(packages.map((pack) => getAptArg(pack.name, pack.version)))
execRootSync(apt, ["install", "--fix-broken", "-y", ...aptArgs]) try {
execRootSync(apt, ["install", "--fix-broken", "-y", ...aptArgs])
} catch (err) {
if ("stderr" in (err as ExecaError)) {
const stderr = (err as ExecaError).stderr
if (stderr.includes("E: Could not get lock") || stderr.includes("dpkg: error processing archive")) {
warning(`Failed to install packages ${aptArgs}. Retrying...`)
execRootSync(apt, ["install", "--fix-broken", "-y", ...aptArgs])
}
} else {
throw err
}
}
return { binDir: "/usr/bin/" } return { binDir: "/usr/bin/" }
} }