mirror of https://github.com/aminya/setup-cpp
fix: parallelize apt update alternatives
This commit is contained in:
parent
5505d67258
commit
5528c08f49
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
|
@ -152,7 +152,7 @@ async function setupChocoMingw(version: string, arch: string): Promise<Installat
|
|||
}
|
||||
|
||||
async function activateGcc(version: string, binDir: string) {
|
||||
const promises: Promise<void>[] = []
|
||||
const promises: Promise<any>[] = []
|
||||
// Setup gcc as the compiler
|
||||
|
||||
// TODO
|
||||
|
@ -174,19 +174,23 @@ async function activateGcc(version: string, binDir: string) {
|
|||
promises.push(addEnv("CC", `${binDir}/gcc-${majorVersion}`), addEnv("CXX", `${binDir}/g++-${majorVersion}`))
|
||||
|
||||
if (isUbuntu()) {
|
||||
await updateAptAlternatives("cc", `${binDir}/gcc-${majorVersion}`)
|
||||
await updateAptAlternatives("cxx", `${binDir}/g++-${majorVersion}`)
|
||||
await updateAptAlternatives("gcc", `${binDir}/gcc-${majorVersion}`)
|
||||
await updateAptAlternatives("g++", `${binDir}/g++-${majorVersion}`)
|
||||
promises.push(
|
||||
updateAptAlternatives("cc", `${binDir}/gcc-${majorVersion}`),
|
||||
updateAptAlternatives("cxx", `${binDir}/g++-${majorVersion}`),
|
||||
updateAptAlternatives("gcc", `${binDir}/gcc-${majorVersion}`),
|
||||
updateAptAlternatives("g++", `${binDir}/g++-${majorVersion}`)
|
||||
)
|
||||
}
|
||||
} else {
|
||||
promises.push(addEnv("CC", `${binDir}/gcc-${version}`), addEnv("CXX", `${binDir}/g++-${version}`))
|
||||
|
||||
if (isUbuntu()) {
|
||||
await updateAptAlternatives("cc", `${binDir}/gcc-${version}`)
|
||||
await updateAptAlternatives("cxx", `${binDir}/g++-${version}`)
|
||||
await updateAptAlternatives("gcc", `${binDir}/gcc-${version}`)
|
||||
await updateAptAlternatives("g++", `${binDir}/g++-${version}`)
|
||||
promises.push(
|
||||
updateAptAlternatives("cc", `${binDir}/gcc-${version}`),
|
||||
updateAptAlternatives("cxx", `${binDir}/g++-${version}`),
|
||||
updateAptAlternatives("gcc", `${binDir}/gcc-${version}`),
|
||||
updateAptAlternatives("g++", `${binDir}/g++-${version}`)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ export async function activateLLVM(directory: string, versionGiven: string) {
|
|||
const ld = process.env.LD_LIBRARY_PATH ?? ""
|
||||
const dyld = process.env.DYLD_LIBRARY_PATH ?? ""
|
||||
|
||||
const promises = [
|
||||
const promises: Promise<any>[] = [
|
||||
// the output of this action
|
||||
addEnv("LLVM_PATH", directory),
|
||||
|
||||
|
@ -103,13 +103,15 @@ export async function activateLLVM(directory: string, versionGiven: string) {
|
|||
}
|
||||
|
||||
if (isUbuntu()) {
|
||||
await updateAptAlternatives("cc", `${directory}/bin/clang`)
|
||||
await updateAptAlternatives("cxx", `${directory}/bin/clang++`)
|
||||
await updateAptAlternatives("clang", `${directory}/bin/clang`)
|
||||
await updateAptAlternatives("clang++", `${directory}/bin/clang++`)
|
||||
await updateAptAlternatives("lld", `${directory}/bin/lld`)
|
||||
await updateAptAlternatives("ld.lld", `${directory}/bin/ld.lld`)
|
||||
await updateAptAlternatives("llvm-ar", `${directory}/bin/llvm-ar`)
|
||||
promises.push(
|
||||
updateAptAlternatives("cc", `${directory}/bin/clang`),
|
||||
updateAptAlternatives("cxx", `${directory}/bin/clang++`),
|
||||
updateAptAlternatives("clang", `${directory}/bin/clang`),
|
||||
updateAptAlternatives("clang++", `${directory}/bin/clang++`),
|
||||
updateAptAlternatives("lld", `${directory}/bin/lld`),
|
||||
updateAptAlternatives("ld.lld", `${directory}/bin/ld.lld`),
|
||||
updateAptAlternatives("llvm-ar", `${directory}/bin/llvm-ar`)
|
||||
)
|
||||
}
|
||||
|
||||
if (ciDetect() === "github-actions") {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* eslint-disable require-atomic-updates */
|
||||
import { InstallationInfo } from "./setupBin"
|
||||
import { execRootSync } from "admina"
|
||||
import { execRoot, execRootSync } from "admina"
|
||||
import { info } from "@actions/core"
|
||||
import ciDetect from "@npmcli/ci-detect"
|
||||
import { addEnv, cpprc_path, setupCppInProfile } from "../env/addEnv"
|
||||
|
@ -146,7 +146,7 @@ export async function addAptKeyViaDownload(name: string, url: string) {
|
|||
|
||||
export async function updateAptAlternatives(name: string, path: string) {
|
||||
if (ciDetect() === "github-actions") {
|
||||
return execRootSync("update-alternatives", ["--install", `/usr/bin/${name}`, name, path, "40"])
|
||||
return execRoot("update-alternatives", ["--install", `/usr/bin/${name}`, name, path, "40"])
|
||||
} else {
|
||||
await setupCppInProfile()
|
||||
return appendFile(
|
||||
|
|
Loading…
Reference in New Issue