Skip to content

Commit 350b16f

Browse files
committed
fix: prefer apt-fast or apt over apt-get
1 parent 4c0bf0a commit 350b16f

File tree

28 files changed

+56
-51
lines changed

28 files changed

+56
-51
lines changed

dist/legacy/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/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.mjs

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

dist/modern/setup-cpp.mjs.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.

packages/setup-apt/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "setup-apt",
3-
"version": "3.0.3",
3+
"version": "3.1.0",
44
"description": "Setup apt packages and repositories in Debian/Ubuntu-based distributions",
55
"repository": "https://github.com/aminya/setup-cpp",
66
"homepage": "https://github.com/aminya/setup-cpp/tree/master/packages/setup-apt",

packages/setup-apt/src/get-apt.ts

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,41 @@ export function hasNala() {
77
return which.sync("nala", { nothrow: true }) !== null
88
}
99

10+
/**
11+
* Check if apt-fast is installed
12+
*/
13+
export function hasAptFast() {
14+
return which.sync("apt-fast", { nothrow: true }) !== null
15+
}
16+
17+
/**
18+
* Check if apt is installed
19+
*/
20+
export function hasApt() {
21+
return which.sync("apt", { nothrow: true }) !== null
22+
}
23+
24+
/**
25+
* Check if apt-get is installed
26+
*/
27+
export function hasAptGet() {
28+
return which.sync("apt-get", { nothrow: true }) !== null
29+
}
30+
1031
/**
1132
* Get the apt command to use
1233
* If nala is installed, use that, otherwise use apt-get
1334
*/
1435
export function getApt() {
15-
let apt: string
1636
if (hasNala()) {
17-
apt = "nala"
37+
return "nala"
38+
} else if (hasAptFast()) {
39+
return "apt-fast"
40+
} else if (hasApt()) {
41+
return "apt"
42+
} else if (hasAptGet()) {
43+
return "apt-get"
1844
} else {
19-
apt = "apt-get"
45+
throw new Error("No apt command found")
2046
}
21-
return apt
2247
}

src/apt-fast/apt-fast.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ import { execRootSync } from "admina"
44
import { error } from "ci-log"
55
import { readFile, writeFile } from "fs/promises"
66
import { DownloaderHelper } from "node-downloader-helper"
7-
import { installAptPack } from "setup-apt"
7+
import { hasAptGet, installAptPack } from "setup-apt"
88
import which from "which"
9-
import { hasAptGet } from "../utils/env/hasAptGet.js"
109

1110
let binDir: string | undefined
1211

src/bazel/bazel.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { execRoot } from "admina"
22
import { hasApk, installApkPack } from "setup-alpine"
3-
import { addAptKeyViaURL, installAptPack } from "setup-apt"
3+
import { addAptKeyViaURL, hasAptGet, installAptPack } from "setup-apt"
44
import { installBrewPack } from "setup-brew"
55
import { getDebArch } from "../utils/env/arch.js"
6-
import { hasAptGet } from "../utils/env/hasAptGet.js"
76
import { hasDnf } from "../utils/env/hasDnf.js"
87
import { isArch } from "../utils/env/isArch.js"
98
import { setupChocoPack } from "../utils/setup/setupChocoPack.js"

src/ccache/ccache.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { hasApk, installApkPack } from "setup-alpine"
2-
import { installAptPack } from "setup-apt"
2+
import { hasAptGet, installAptPack } from "setup-apt"
33
import { installBrewPack } from "setup-brew"
4-
import { hasAptGet } from "../utils/env/hasAptGet.js"
54
import { hasDnf } from "../utils/env/hasDnf.js"
65
import { isArch } from "../utils/env/isArch.js"
76
import { setupChocoPack } from "../utils/setup/setupChocoPack.js"

src/cppcheck/cppcheck.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { addPath } from "envosman"
22
import { hasApk, installApkPack } from "setup-alpine"
3-
import { installAptPack } from "setup-apt"
3+
import { hasAptGet, installAptPack } from "setup-apt"
44
import { installBrewPack } from "setup-brew"
55
import { rcOptions } from "../options.js"
6-
import { hasAptGet } from "../utils/env/hasAptGet.js"
76
import { hasDnf } from "../utils/env/hasDnf.js"
87
import { isArch } from "../utils/env/isArch.js"
98
import { setupChocoPack } from "../utils/setup/setupChocoPack.js"

src/doxygen/doxygen.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ import { pathExists } from "path-exists"
55
import { addExeExt } from "patha"
66
import retry from "retry-as-promised"
77
import { hasApk, installApkPack } from "setup-alpine"
8-
import { installAptPack } from "setup-apt"
8+
import { hasAptGet, installAptPack } from "setup-apt"
99
import { installBrewPack } from "setup-brew"
1010
import { setupGraphviz } from "../graphviz/graphviz.js"
1111
import { rcOptions } from "../options.js"
1212
import { arm64 } from "../utils/env/arch.js"
13-
import { hasAptGet } from "../utils/env/hasAptGet.js"
1413
import { hasDnf } from "../utils/env/hasDnf.js"
1514
import { isArch } from "../utils/env/isArch.js"
1615
import { macosVersion } from "../utils/env/macos_version.js"

src/gcc/gcc.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ import { pathExists } from "path-exists"
1111
import { addExeExt } from "patha"
1212
import semverMajor from "semver/functions/major"
1313
import { hasApk, installApkPack } from "setup-alpine"
14-
import { addUpdateAlternativesToRc, installAptPack } from "setup-apt"
14+
import { addUpdateAlternativesToRc, hasAptGet, installAptPack } from "setup-apt"
1515
import { installBrewPack } from "setup-brew"
1616
import { setupMacOSSDK } from "../macos-sdk/macos-sdk.js"
1717
import { rcOptions } from "../options.js"
18-
import { hasAptGet } from "../utils/env/hasAptGet.js"
1918
import { hasDnf } from "../utils/env/hasDnf.js"
2019
import { isArch } from "../utils/env/isArch.js"
2120
import type { InstallationInfo } from "../utils/setup/setupBin.js"

src/gcc/mingw.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@ import { addExeExt } from "patha"
99
import semverCoerce from "semver/functions/coerce.js"
1010
import semverSatisfies from "semver/functions/satisfies.js"
1111
import { enableCommunityRepository, hasApk, installApkPack } from "setup-alpine"
12-
import { installAptPack } from "setup-apt"
12+
import { hasAptGet, installAptPack } from "setup-apt"
1313
import { rcOptions } from "../options.js"
1414
import { loadAssetList, matchAsset } from "../utils/asset/load-assets.js"
15-
import { hasAptGet } from "../utils/env/hasAptGet.js"
1615
import { hasDnf } from "../utils/env/hasDnf.js"
1716
import { isArch } from "../utils/env/isArch.js"
1817
import { extract7Zip } from "../utils/setup/extract.js"

src/git/git.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ import { join } from "path"
33
import { info, warning } from "ci-log"
44
import { addPath } from "envosman"
55
import { hasApk, installApkPack } from "setup-alpine"
6-
import { installAptPack } from "setup-apt"
6+
import { hasAptGet, installAptPack } from "setup-apt"
77
import { installBrewPack } from "setup-brew"
88
import which from "which"
99
import { rcOptions } from "../options.js"
10-
import { hasAptGet } from "../utils/env/hasAptGet.js"
1110
import { hasDnf } from "../utils/env/hasDnf.js"
1211
import { isArch } from "../utils/env/isArch.js"
1312
import { setupChocoPack } from "../utils/setup/setupChocoPack.js"

src/graphviz/graphviz.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { addPath } from "envosman"
22
import { hasApk, installApkPack } from "setup-alpine"
3-
import { installAptPack } from "setup-apt"
3+
import { hasAptGet, installAptPack } from "setup-apt"
44
import { installBrewPack } from "setup-brew"
55
import { rcOptions } from "../options.js"
6-
import { hasAptGet } from "../utils/env/hasAptGet.js"
76
import { hasDnf } from "../utils/env/hasDnf.js"
87
import { isArch } from "../utils/env/isArch.js"
98
import type { InstallationInfo } from "../utils/setup/setupBin.js"

src/kcov/kcov.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ import { fileURLToPath } from "url"
33
import { info } from "ci-log"
44
import { execa } from "execa"
55
import { addExeExt } from "patha"
6-
import { installAptPack } from "setup-apt"
6+
import { hasAptGet, installAptPack } from "setup-apt"
77
import { untildifyUser } from "untildify-user"
88
import which from "which"
99
import { setupCmake } from "../cmake/cmake.js"
1010
import { setupNinja } from "../ninja/ninja.js"
11-
import { hasAptGet } from "../utils/env/hasAptGet.js"
1211
import { hasDnf } from "../utils/env/hasDnf.js"
1312
import { isArch } from "../utils/env/isArch.js"
1413
import { ubuntuVersion } from "../utils/env/ubuntu_version.js"

src/llvm/llvm.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ import { addEnv } from "envosman"
77
import memoize from "memoizee"
88
import { pathExists } from "path-exists"
99
import { addExeExt } from "patha"
10-
import { addUpdateAlternativesToRc } from "setup-apt"
10+
import { addUpdateAlternativesToRc, hasAptGet } from "setup-apt"
1111
import { setupGcc } from "../gcc/gcc.js"
1212
import { setupMacOSSDK } from "../macos-sdk/macos-sdk.js"
1313
import { rcOptions } from "../options.js"
14-
import { hasAptGet } from "../utils/env/hasAptGet.js"
1514
import { ubuntuVersion } from "../utils/env/ubuntu_version.js"
1615
import type { InstallationInfo } from "../utils/setup/setupBin.js"
1716
import { quoteIfHasSpace } from "../utils/std/index.js"

src/llvm/llvm_apt_installer.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ import { execRoot, execRootSync } from "admina"
66
import { addPath } from "envosman"
77
import { chmod, readFile, writeFile } from "fs/promises"
88
import { DownloaderHelper } from "node-downloader-helper"
9-
import { aptTimeout, hasNala, installAddAptRepo, installAptPack, isAptPackRegexInstalled } from "setup-apt"
9+
import { aptTimeout, hasAptGet, hasNala, installAddAptRepo, installAptPack, isAptPackRegexInstalled } from "setup-apt"
1010
import { DEFAULT_TIMEOUT } from "../installTool.js"
1111
import { rcOptions } from "../options.js"
12-
import { hasAptGet } from "../utils/env/hasAptGet.js"
1312
import type { InstallationInfo } from "../utils/setup/setupBin.js"
1413
import { majorLLVMVersion } from "./utils.js"
1514
const dirname = typeof __dirname === "string" ? __dirname : path.dirname(fileURLToPath(import.meta.url))

src/llvm/llvm_bin.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ import { execRootSync } from "admina"
44
import { info } from "ci-log"
55
import memoize from "memoizee"
66
import { DownloaderHelper } from "node-downloader-helper"
7-
import { installAptPack } from "setup-apt"
7+
import { hasAptGet, installAptPack } from "setup-apt"
88
import { getDebArch } from "../utils/env/arch.js"
9-
import { hasAptGet } from "../utils/env/hasAptGet.js"
109
import { hasDnf } from "../utils/env/hasDnf.js"
1110
import { isArch } from "../utils/env/isArch.js"
1211
import { setupBin } from "../utils/setup/setupBin.js"

src/llvm/llvm_url.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import path, { join } from "path"
22
import { fileURLToPath } from "url"
33
import { info } from "ci-log"
44
import { addExeExt } from "patha"
5+
import { hasAptGet } from "setup-apt"
56
import { loadAssetList, matchAsset } from "../utils/asset/load-assets.js"
67
import { arm64, armv7, powerpc64le, sparc64, sparcv9, x86, x86_64 } from "../utils/env/arch.js"
7-
import { hasAptGet } from "../utils/env/hasAptGet.js"
88
import { hasDnf } from "../utils/env/hasDnf.js"
99
import { ubuntuVersion } from "../utils/env/ubuntu_version.js"
1010
import { extractTarByExe, getArchiveType, getExtractFunction } from "../utils/setup/extract.js"

src/make/make.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import { join } from "path"
22
import { addPath } from "envosman"
33
import { hasApk, installApkPack } from "setup-alpine"
4-
import { installAptPack } from "setup-apt"
4+
import { hasAptGet, installAptPack } from "setup-apt"
55
import { getBrewDir, installBrewPack } from "setup-brew"
66
import { rcOptions } from "../options.js"
7-
import { hasAptGet } from "../utils/env/hasAptGet.js"
87
import { hasDnf } from "../utils/env/hasDnf.js"
98
import { isArch } from "../utils/env/isArch.js"
109
import { setupChocoPack } from "../utils/setup/setupChocoPack.js"

src/nala/nala.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ import { execRootSync } from "admina"
44
import { error, info } from "ci-log"
55
import { readFile, writeFile } from "fs/promises"
66
import { DownloaderHelper } from "node-downloader-helper"
7-
import { hasNala, installAptPack, qualifiedNeededAptPackage } from "setup-apt"
7+
import { hasAptGet, hasNala, installAptPack, qualifiedNeededAptPackage } from "setup-apt"
88
import which from "which"
9-
import { hasAptGet } from "../utils/env/hasAptGet.js"
109

1110
let binDir: string | undefined
1211

src/powershell/powershell.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ import { error } from "ci-log"
33
import { addPath } from "envosman"
44
import { addExeExt } from "patha"
55
import { hasApk, installApkPack } from "setup-alpine"
6-
import { installAptPack } from "setup-apt"
6+
import { hasAptGet, installAptPack } from "setup-apt"
77
import { installBrewPack } from "setup-brew"
88
import { rcOptions } from "../options.js"
9-
import { hasAptGet } from "../utils/env/hasAptGet.js"
109
import { hasDnf } from "../utils/env/hasDnf.js"
1110
import { isArch } from "../utils/env/isArch.js"
1211
import { ubuntuVersion } from "../utils/env/ubuntu_version.js"

src/python/python.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ import { readdir } from "fs/promises"
1111
import { pathExists } from "path-exists"
1212
import { addExeExt } from "patha"
1313
import { hasApk, installApkPack } from "setup-alpine"
14-
import { installAptPack, isAptPackInstalled } from "setup-apt"
14+
import { hasAptGet, installAptPack, isAptPackInstalled } from "setup-apt"
1515
import { installBrewPack } from "setup-brew"
1616
import which from "which"
1717
import { rcOptions } from "../options.js"
18-
import { hasAptGet } from "../utils/env/hasAptGet.js"
1918
import { hasDnf } from "../utils/env/hasDnf.js"
2019
import { isArch } from "../utils/env/isArch.js"
2120
import type { InstallationInfo } from "../utils/setup/setupBin.js"

src/sccache/sccache.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { hasApk, installApkPack } from "setup-alpine"
2-
import { installAptPack } from "setup-apt"
2+
import { hasAptGet, installAptPack } from "setup-apt"
33
import { installBrewPack } from "setup-brew"
44
import { getUbuntuVersion } from "ubuntu-version"
5-
import { hasAptGet } from "../utils/env/hasAptGet.js"
65
import { setupChocoPack } from "../utils/setup/setupChocoPack.js"
76

87
// eslint-disable-next-line @typescript-eslint/no-unused-vars

src/sevenzip/sevenzip.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { hasApk, installApkPack } from "setup-alpine"
2-
import { installAptPack } from "setup-apt"
2+
import { hasAptGet, installAptPack } from "setup-apt"
33
import { installBrewPack } from "setup-brew"
4-
import { hasAptGet } from "../utils/env/hasAptGet.js"
54
import { hasDnf } from "../utils/env/hasDnf.js"
65
import { isArch } from "../utils/env/isArch.js"
76
import { setupChocoPack } from "../utils/setup/setupChocoPack.js"

src/vcpkg/vcpkg.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@ import { execa } from "execa"
66
import { pathExists } from "path-exists"
77
import { addShExt, addShRelativePrefix } from "patha"
88
import { hasApk, installApkPack } from "setup-alpine"
9-
import { installAptPack } from "setup-apt"
9+
import { hasAptGet, installAptPack } from "setup-apt"
1010
import which from "which"
1111
import { setupGit } from "../git/git.js"
1212
import { rcOptions } from "../options.js"
1313
import { arm64 } from "../utils/env/arch.js"
14-
import { hasAptGet } from "../utils/env/hasAptGet.js"
1514
import { hasDnf } from "../utils/env/hasDnf.js"
1615
import { isArch } from "../utils/env/isArch.js"
1716
import type { InstallationInfo } from "../utils/setup/setupBin.js"

src/versions/versions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import path from "path"
33
import { fileURLToPath } from "url"
44
import memoize from "memoizee"
55
import { isAlpine } from "setup-alpine"
6+
import { hasAptGet } from "setup-apt"
67
import type { CompilerInfo } from "../compilers.js"
78
import type { Opts } from "../options.js"
89
import type { Inputs, ToolName } from "../tool.js"
9-
import { hasAptGet } from "../utils/env/hasAptGet.js"
1010
import { hasDnf } from "../utils/env/hasDnf.js"
1111
import { isArch } from "../utils/env/isArch.js"
1212

0 commit comments

Comments
 (0)