Skip to content

Commit c8cec57

Browse files
committed
fix: handle the promises in setupAptPack
1 parent a9e484f commit c8cec57

File tree

16 files changed

+45
-45
lines changed

16 files changed

+45
-45
lines changed

dist/setup_cpp.js

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/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/setup_cpp.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

dist/setup_cpp.mjs.map

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/doxygen/doxygen.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,18 @@ export async function setupDoxygen(version: string, setupDir: string, arch: stri
6767
} else if (hasDnf()) {
6868
return setupDnfPack("doxygen", version)
6969
} else if (isUbuntu()) {
70-
installationInfo = setupAptPack("doxygen", version)
70+
installationInfo = await setupAptPack("doxygen", version)
7171
} else {
7272
throw new Error(`Unsupported linux distributions`)
7373
}
7474
} else if (isUbuntu()) {
7575
try {
7676
// doxygen on stable Ubuntu repositories is very old. So, we use get the binary from the website itself
7777
installationInfo = await setupBin("doxygen", version, getDoxygenPackageInfo, setupDir, arch)
78-
setupAptPack("libclang-cpp9")
78+
await setupAptPack("libclang-cpp9")
7979
} catch (err) {
8080
notice(`Failed to download doxygen binary. ${err}. Falling back to apt-get.`)
81-
installationInfo = setupAptPack("doxygen", undefined)
81+
installationInfo = await setupAptPack("doxygen", undefined)
8282
}
8383
} else {
8484
throw new Error(`Unsupported linux distributions`)

src/gcc/gcc.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,15 @@ export async function setupGcc(version: string, setupDir: string, arch: string)
9191
setupDnfPack("gcc-c++", version)
9292
setupDnfPack("libstdc++-devel", undefined)
9393
} else if (isUbuntu()) {
94-
setupAptPack("gcc", version, ["ppa:ubuntu-toolchain-r/test"])
95-
installationInfo = setupAptPack("g++", version, [])
94+
await setupAptPack("gcc", version, ["ppa:ubuntu-toolchain-r/test"])
95+
installationInfo = await setupAptPack("g++", version, [])
9696
}
9797
} else {
9898
info(`Install g++-multilib because gcc for ${arch} was requested`)
9999
if (isArch()) {
100100
setupPacmanPack("gcc-multilib", version)
101101
} else if (isUbuntu()) {
102-
setupAptPack("gcc-multilib", version, ["ppa:ubuntu-toolchain-r/test"])
102+
await setupAptPack("gcc-multilib", version, ["ppa:ubuntu-toolchain-r/test"])
103103
}
104104
}
105105
break

src/kcov/kcov.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async function buildKcov(file: string, dest: string) {
4141
const out = await extractTarByExe(file, dest, ["--strip-components=1"])
4242

4343
// build after extraction using CMake
44-
let cmake = await getCmake()
44+
const cmake = await getCmake()
4545

4646
if (process.platform === "linux") {
4747
if (isArch()) {
@@ -51,8 +51,8 @@ async function buildKcov(file: string, dest: string) {
5151
setupDnfPack("libdwarf-devel")
5252
setupDnfPack("libcurl-devel")
5353
} else if (isUbuntu()) {
54-
setupAptPack("libdw-dev")
55-
setupAptPack("libcurl4-openssl-dev")
54+
await setupAptPack("libdw-dev")
55+
await setupAptPack("libcurl4-openssl-dev")
5656
}
5757
}
5858
const buildDir = join(out, "build")
@@ -72,7 +72,7 @@ async function getCmake() {
7272
const { binDir } = await setupCmake(getVersion("cmake", undefined), join(untildify_user(""), "cmake"), "")
7373
cmake = join(binDir, "cmake")
7474
}
75-
let ninja = which.sync("ninja", { nothrow: true })
75+
const ninja = which.sync("ninja", { nothrow: true })
7676
if (ninja === null) {
7777
await setupNinja(getVersion("ninja", undefined), join(untildify_user(""), "ninja"), "")
7878
}
@@ -103,7 +103,7 @@ export async function setupKcov(versionGiven: string, setupDir: string, arch: st
103103
} else if (hasDnf()) {
104104
setupDnfPack("binutils")
105105
} else if (isUbuntu()) {
106-
setupAptPack("libbinutils")
106+
await setupAptPack("libbinutils")
107107
}
108108
return installationInfo
109109
} else {

src/llvm/llvm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ async function _setupLLVM(version: string, setupDir: string, arch: string) {
294294
// setupPacmanPack("ncurses")
295295
// TODO: install libtinfo ?
296296
} else if (isUbuntu()) {
297-
setupAptPack("libtinfo-dev")
297+
await setupAptPack("libtinfo-dev")
298298
}
299299
}
300300
// eslint-disable-next-line require-atomic-updates

src/nala/__tests__/nala.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe("setup-nala", () => {
88
if (!isUbuntu()) {
99
return
1010
}
11-
const installInfo = setupNala("", "", process.arch)
11+
const installInfo = await setupNala("", "", process.arch)
1212
await testBin("nala", ["--version"], installInfo?.binDir)
1313
})
1414
})

src/nala/nala.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { setupAptPack } from "../utils/setup/setupAptPack"
77
let binDir: string | undefined
88

99
// eslint-disable-next-line @typescript-eslint/no-unused-vars
10-
export function setupNala(version: string, _setupDir: string, _arch: string) {
10+
export async function setupNala(version: string, _setupDir: string, _arch: string) {
1111
if (!isUbuntu()) {
1212
return undefined
1313
}
@@ -22,7 +22,7 @@ export function setupNala(version: string, _setupDir: string, _arch: string) {
2222
}
2323

2424
// https://github.com/volitank/nala#-installation
25-
setupAptPack("wget")
25+
await setupAptPack("wget")
2626
execSudo("/bin/bash", [
2727
"-c",
2828
`wget -qO - https://deb.volian.org/volian/scar.key | tee /etc/apt/trusted.gpg.d/volian-archive-scar-unstable.gpg > /dev/null`,
@@ -34,15 +34,15 @@ export function setupNala(version: string, _setupDir: string, _arch: string) {
3434

3535
try {
3636
if (version !== "legacy") {
37-
setupAptPack("nala", undefined, [], true)
37+
await setupAptPack("nala", undefined, [], true)
3838
} else {
39-
setupAptPack("nala-legacy", undefined, [], true)
39+
await setupAptPack("nala-legacy", undefined, [], true)
4040
}
4141
} catch (err) {
42-
setupAptPack("nala-legacy", undefined, [], true)
42+
await setupAptPack("nala-legacy", undefined, [], true)
4343
}
4444

45-
binDir = "/usr/bin"
45+
binDir = "/usr/bin" // eslint-disable-line require-atomic-updates
4646

4747
return { binDir }
4848
}

0 commit comments

Comments
 (0)