mirror of https://github.com/aminya/setup-cpp.git
fix: rename isUbuntu to hasAptget
This commit is contained in:
parent
e10853e3f5
commit
00fe6df1cf
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
|
|
@ -3,9 +3,9 @@ import { hasApk, installApkPack } from "setup-alpine"
|
|||
import { addAptKeyViaURL, installAptPack } from "setup-apt"
|
||||
import { installBrewPack } from "setup-brew"
|
||||
import { getDebArch } from "../utils/env/arch.js"
|
||||
import { hasAptGet } from "../utils/env/hasAptGet.js"
|
||||
import { hasDnf } from "../utils/env/hasDnf.js"
|
||||
import { isArch } from "../utils/env/isArch.js"
|
||||
import { isUbuntu } from "../utils/env/isUbuntu.js"
|
||||
import { setupChocoPack } from "../utils/setup/setupChocoPack.js"
|
||||
import { setupDnfPack } from "../utils/setup/setupDnfPack.js"
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ export async function setupBazel(version: string, _setupDir: string, _arch: stri
|
|||
await setupDnfPack([{ name: "dnf-plugins-core" }])
|
||||
await execRoot("dnf", ["copr", "enable", "vbatts/bazel"])
|
||||
return setupDnfPack([{ name: "bazel4" }])
|
||||
} else if (isUbuntu()) {
|
||||
} else if (hasAptGet()) {
|
||||
// https://bazel.build/install/ubuntu
|
||||
const keyFileName = await addAptKeyViaURL({
|
||||
fileName: "bazel-archive-keyring.gpg",
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import { hasApk, installApkPack } from "setup-alpine"
|
||||
import { installAptPack } from "setup-apt"
|
||||
import { installBrewPack } from "setup-brew"
|
||||
import { hasAptGet } from "../utils/env/hasAptGet.js"
|
||||
import { hasDnf } from "../utils/env/hasDnf.js"
|
||||
import { isArch } from "../utils/env/isArch.js"
|
||||
import { isUbuntu } from "../utils/env/isUbuntu.js"
|
||||
import { setupChocoPack } from "../utils/setup/setupChocoPack.js"
|
||||
import { setupDnfPack } from "../utils/setup/setupDnfPack.js"
|
||||
import { setupPacmanPack } from "../utils/setup/setupPacmanPack.js"
|
||||
|
|
@ -22,7 +22,7 @@ export async function setupCcache(version: string, _setupDir: string, _arch: str
|
|||
return setupPacmanPack("ccache", version)
|
||||
} else if (hasDnf()) {
|
||||
return setupDnfPack([{ name: "ccache", version }])
|
||||
} else if (isUbuntu()) {
|
||||
} else if (hasAptGet()) {
|
||||
return installAptPack([{ name: "ccache", version }])
|
||||
} else if (await hasApk()) {
|
||||
return installApkPack([{ name: "ccache", version }])
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ import { hasApk, installApkPack } from "setup-alpine"
|
|||
import { installAptPack } from "setup-apt"
|
||||
import { installBrewPack } from "setup-brew"
|
||||
import { rcOptions } from "../options.js"
|
||||
import { hasAptGet } from "../utils/env/hasAptGet.js"
|
||||
import { hasDnf } from "../utils/env/hasDnf.js"
|
||||
import { isArch } from "../utils/env/isArch.js"
|
||||
import { isUbuntu } from "../utils/env/isUbuntu.js"
|
||||
import { setupChocoPack } from "../utils/setup/setupChocoPack.js"
|
||||
import { setupDnfPack } from "../utils/setup/setupDnfPack.js"
|
||||
import { setupPacmanPack } from "../utils/setup/setupPacmanPack.js"
|
||||
|
|
@ -26,7 +26,7 @@ export async function setupCppcheck(version: string | undefined, _setupDir: stri
|
|||
return setupPacmanPack("cppcheck", version)
|
||||
} else if (hasDnf()) {
|
||||
return setupDnfPack([{ name: "ccache", version }])
|
||||
} else if (isUbuntu()) {
|
||||
} else if (hasAptGet()) {
|
||||
return installAptPack([{ name: "cppcheck", version }])
|
||||
} else if (await hasApk()) {
|
||||
return installApkPack([{ name: "cppcheck", version }])
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ import { installBrewPack } from "setup-brew"
|
|||
import { setupGraphviz } from "../graphviz/graphviz.js"
|
||||
import { rcOptions } from "../options.js"
|
||||
import { arm64 } from "../utils/env/arch.js"
|
||||
import { hasAptGet } from "../utils/env/hasAptGet.js"
|
||||
import { hasDnf } from "../utils/env/hasDnf.js"
|
||||
import { isArch } from "../utils/env/isArch.js"
|
||||
import { isUbuntu } from "../utils/env/isUbuntu.js"
|
||||
import { macosVersion } from "../utils/env/macos_version.js"
|
||||
import { ubuntuVersion } from "../utils/env/ubuntu_version.js"
|
||||
import { type PackageInfo, setupBin } from "../utils/setup/setupBin.js"
|
||||
|
|
@ -109,7 +109,7 @@ async function setupLinuxDoxygen(version: string, setupDir: string, arch: string
|
|||
return await setupPacmanPack("doxygen", version)
|
||||
} else if (hasDnf()) {
|
||||
return setupDnfPack([{ name: "doxygen", version }])
|
||||
} else if (isUbuntu()) {
|
||||
} else if (hasAptGet()) {
|
||||
return await installAptPack([{ name: "doxygen", version, fallBackToLatest: arm64.includes(arch) }])
|
||||
} else if (await hasApk()) {
|
||||
return installApkPack([
|
||||
|
|
@ -125,7 +125,7 @@ async function setupLinuxDoxygen(version: string, setupDir: string, arch: string
|
|||
// fallback to setupBin if the installation failed
|
||||
try {
|
||||
const installationInfo = await setupBin("doxygen", version, getDoxygenPackageInfo, setupDir, arch)
|
||||
if (isUbuntu()) {
|
||||
if (hasAptGet()) {
|
||||
try {
|
||||
await installAptPack([{ name: "libclang-cpp-dev" }])
|
||||
} catch (err) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { fileURLToPath } from "url"
|
|||
import { execaSync } from "execa"
|
||||
import { chmod } from "fs/promises"
|
||||
import { addExeExt } from "patha"
|
||||
import { isUbuntu } from "../../utils/env/isUbuntu.js"
|
||||
import { hasAptGet } from "../../utils/env/hasAptGet.js"
|
||||
import { ubuntuVersion } from "../../utils/env/ubuntu_version.js"
|
||||
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers.js"
|
||||
import { getVersion } from "../../versions/versions.js"
|
||||
|
|
@ -24,7 +24,7 @@ describe("setup-gcc", () => {
|
|||
const installInfo = await setupGcc(version, directory, process.arch)
|
||||
|
||||
let gpp = "g++"
|
||||
if (isUbuntu()) {
|
||||
if (hasAptGet()) {
|
||||
const ubuntuMajorVersion = ubuntuVersionOutput?.[0]
|
||||
// https://packages.ubuntu.com/search?keywords=gcc
|
||||
switch (ubuntuMajorVersion) {
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ import { addUpdateAlternativesToRc, installAptPack } from "setup-apt"
|
|||
import { installBrewPack } from "setup-brew"
|
||||
import { setupMacOSSDK } from "../macos-sdk/macos-sdk.js"
|
||||
import { rcOptions } from "../options.js"
|
||||
import { hasAptGet } from "../utils/env/hasAptGet.js"
|
||||
import { hasDnf } from "../utils/env/hasDnf.js"
|
||||
import { isArch } from "../utils/env/isArch.js"
|
||||
import { isUbuntu } from "../utils/env/isUbuntu.js"
|
||||
import type { InstallationInfo } from "../utils/setup/setupBin.js"
|
||||
import { setupDnfPack } from "../utils/setup/setupDnfPack.js"
|
||||
import { setupPacmanPack } from "../utils/setup/setupPacmanPack.js"
|
||||
|
|
@ -49,7 +49,7 @@ export async function setupGcc(version: string, setupDir: string, arch: string,
|
|||
])
|
||||
} else if (await hasApk()) {
|
||||
installationInfo = await installApkPack([{ name: "gcc", version }, { name: "g++", version }])
|
||||
} else if (isUbuntu()) {
|
||||
} else if (hasAptGet()) {
|
||||
if (version === "") {
|
||||
// the default version
|
||||
installationInfo = await installAptPack([{ name: "gcc" }, { name: "g++" }])
|
||||
|
|
@ -156,7 +156,7 @@ async function activateGcc(givenVersion: string, binDir: string, priority: numbe
|
|||
addEnv("CXX", gxxPath, rcOptions),
|
||||
)
|
||||
|
||||
if (isUbuntu()) {
|
||||
if (hasAptGet()) {
|
||||
promises.push(
|
||||
addUpdateAlternativesToRc("cc", gccPath, rcOptions, priority),
|
||||
addUpdateAlternativesToRc("cxx", gxxPath, rcOptions, priority),
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ import { enableCommunityRepository, hasApk, installApkPack } from "setup-alpine"
|
|||
import { installAptPack } from "setup-apt"
|
||||
import { rcOptions } from "../options.js"
|
||||
import { loadAssetList, matchAsset } from "../utils/asset/load-assets.js"
|
||||
import { hasAptGet } from "../utils/env/hasAptGet.js"
|
||||
import { hasDnf } from "../utils/env/hasDnf.js"
|
||||
import { isArch } from "../utils/env/isArch.js"
|
||||
import { isUbuntu } from "../utils/env/isUbuntu.js"
|
||||
import { extract7Zip } from "../utils/setup/extract.js"
|
||||
import { type InstallationInfo, type PackageInfo, setupBin } from "../utils/setup/setupBin.js"
|
||||
import { setupChocoPack } from "../utils/setup/setupChocoPack.js"
|
||||
|
|
@ -44,7 +44,7 @@ export async function setupMingw(version: string, setupDir: string, arch: string
|
|||
installationInfo = await setupPacmanPack("mingw-w64-gcc", version)
|
||||
} else if (hasDnf()) {
|
||||
installationInfo = await setupDnfPack([{ name: "mingw64-gcc", version }])
|
||||
} else if (isUbuntu()) {
|
||||
} else if (hasAptGet()) {
|
||||
installationInfo = await installAptPack([{ name: "mingw-w64", version }])
|
||||
} else if (await hasApk()) {
|
||||
await enableCommunityRepository()
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ import { installAptPack } from "setup-apt"
|
|||
import { installBrewPack } from "setup-brew"
|
||||
import which from "which"
|
||||
import { rcOptions } from "../options.js"
|
||||
import { hasAptGet } from "../utils/env/hasAptGet.js"
|
||||
import { hasDnf } from "../utils/env/hasDnf.js"
|
||||
import { isArch } from "../utils/env/isArch.js"
|
||||
import { isUbuntu } from "../utils/env/isUbuntu.js"
|
||||
import { setupChocoPack } from "../utils/setup/setupChocoPack.js"
|
||||
import { setupDnfPack } from "../utils/setup/setupDnfPack.js"
|
||||
import { setupPacmanPack } from "../utils/setup/setupPacmanPack.js"
|
||||
|
|
@ -39,7 +39,7 @@ export async function setupGit(version: string, _setupDir: string, _arch: string
|
|||
return setupPacmanPack("git", version)
|
||||
} else if (hasDnf()) {
|
||||
return setupDnfPack([{ name: "git", version }])
|
||||
} else if (isUbuntu()) {
|
||||
} else if (hasAptGet()) {
|
||||
return installAptPack([{ name: "git", version }])
|
||||
} else if (await hasApk()) {
|
||||
return installApkPack([{ name: "git", version }])
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ import { hasApk, installApkPack } from "setup-alpine"
|
|||
import { installAptPack } from "setup-apt"
|
||||
import { installBrewPack } from "setup-brew"
|
||||
import { rcOptions } from "../options.js"
|
||||
import { hasAptGet } from "../utils/env/hasAptGet.js"
|
||||
import { hasDnf } from "../utils/env/hasDnf.js"
|
||||
import { isArch } from "../utils/env/isArch.js"
|
||||
import { isUbuntu } from "../utils/env/isUbuntu.js"
|
||||
import type { InstallationInfo } from "../utils/setup/setupBin.js"
|
||||
import { setupChocoPack } from "../utils/setup/setupChocoPack.js"
|
||||
import { setupDnfPack } from "../utils/setup/setupDnfPack.js"
|
||||
|
|
@ -26,7 +26,7 @@ export async function setupGraphviz(version: string, _setupDir: string, _arch: s
|
|||
return setupPacmanPack("graphviz", version)
|
||||
} else if (hasDnf()) {
|
||||
return setupDnfPack([{ name: "graphviz", version }])
|
||||
} else if (isUbuntu()) {
|
||||
} else if (hasAptGet()) {
|
||||
return installAptPack([{ name: "graphviz", version }])
|
||||
} else if (await hasApk()) {
|
||||
return installApkPack([{ name: "graphviz", version }])
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { info } from "ci-log"
|
||||
import { isUbuntu } from "../../utils/env/isUbuntu.js"
|
||||
import { hasAptGet } from "../../utils/env/hasAptGet.js"
|
||||
import { ubuntuVersion } from "../../utils/env/ubuntu_version.js"
|
||||
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers.js"
|
||||
import { getVersion } from "../../versions/versions.js"
|
||||
|
|
@ -23,7 +23,7 @@ describe("setup-infer", () => {
|
|||
|
||||
it("should setup infer", async () => {
|
||||
/* eslint-disable @typescript-eslint/no-non-null-asserted-optional-chain */
|
||||
if (isUbuntu() && (await ubuntuVersion())?.[0]! <= 20) {
|
||||
if (hasAptGet() && (await ubuntuVersion())?.[0]! <= 20) {
|
||||
info("Skipping infer test on ubuntu 20 and below")
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ import { untildifyUser } from "untildify-user"
|
|||
import which from "which"
|
||||
import { setupCmake } from "../cmake/cmake.js"
|
||||
import { setupNinja } from "../ninja/ninja.js"
|
||||
import { hasAptGet } from "../utils/env/hasAptGet.js"
|
||||
import { hasDnf } from "../utils/env/hasDnf.js"
|
||||
import { isArch } from "../utils/env/isArch.js"
|
||||
import { isUbuntu } from "../utils/env/isUbuntu.js"
|
||||
import { ubuntuVersion } from "../utils/env/ubuntu_version.js"
|
||||
import { extractTarByExe } from "../utils/setup/extract.js"
|
||||
import { type InstallationInfo, type PackageInfo, setupBin } from "../utils/setup/setupBin.js"
|
||||
|
|
@ -51,7 +51,7 @@ async function buildKcov(file: string, dest: string) {
|
|||
await Promise.all([setupPacmanPack("libdwarf"), setupPacmanPack("libcurl-openssl")])
|
||||
} else if (hasDnf()) {
|
||||
await setupDnfPack([{ name: "libdwarf-devel" }, { name: "libcurl-devel" }])
|
||||
} else if (isUbuntu()) {
|
||||
} else if (hasAptGet()) {
|
||||
await installAptPack([{ name: "libdw-dev" }, { name: "libcurl4-openssl-dev" }])
|
||||
}
|
||||
}
|
||||
|
|
@ -119,7 +119,7 @@ export async function setupKcov(versionGiven: string, setupDir: string, arch: st
|
|||
await setupPacmanPack("binutils")
|
||||
} else if (hasDnf()) {
|
||||
await setupDnfPack([{ name: "binutils" }])
|
||||
} else if (isUbuntu()) {
|
||||
} else if (hasAptGet()) {
|
||||
await installAptPack([{ name: "libbinutils" }])
|
||||
}
|
||||
return installationInfo
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import { addUpdateAlternativesToRc } from "setup-apt"
|
|||
import { setupGcc } from "../gcc/gcc.js"
|
||||
import { setupMacOSSDK } from "../macos-sdk/macos-sdk.js"
|
||||
import { rcOptions } from "../options.js"
|
||||
import { isUbuntu } from "../utils/env/isUbuntu.js"
|
||||
import { hasAptGet } from "../utils/env/hasAptGet.js"
|
||||
import { ubuntuVersion } from "../utils/env/ubuntu_version.js"
|
||||
import type { InstallationInfo } from "../utils/setup/setupBin.js"
|
||||
import { quoteIfHasSpace } from "../utils/std/index.js"
|
||||
|
|
@ -108,7 +108,7 @@ export async function activateLLVM(directory: string, version: string) {
|
|||
setupMacOSSDK(),
|
||||
]
|
||||
|
||||
if (isUbuntu()) {
|
||||
if (hasAptGet()) {
|
||||
const priority = 60
|
||||
actPromises.push(
|
||||
addUpdateAlternativesToRc("cc", `${directory}/bin/clang`, rcOptions, priority),
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import { DownloaderHelper } from "node-downloader-helper"
|
|||
import { aptTimeout, hasNala, installAddAptRepo, installAptPack, isAptPackRegexInstalled } from "setup-apt"
|
||||
import { DEFAULT_TIMEOUT } from "../installTool.js"
|
||||
import { rcOptions } from "../options.js"
|
||||
import { isUbuntu } from "../utils/env/isUbuntu.js"
|
||||
import { hasAptGet } from "../utils/env/hasAptGet.js"
|
||||
import type { InstallationInfo } from "../utils/setup/setupBin.js"
|
||||
import { majorLLVMVersion } from "./utils.js"
|
||||
const dirname = typeof __dirname === "string" ? __dirname : path.dirname(fileURLToPath(import.meta.url))
|
||||
|
|
@ -33,7 +33,7 @@ export async function trySetupLLVMApt(
|
|||
version: string,
|
||||
packages: LLVMPackages = LLVMPackages.All,
|
||||
): Promise<InstallationInfo | undefined> {
|
||||
if (!isUbuntu()) {
|
||||
if (!hasAptGet()) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ import memoize from "memoizee"
|
|||
import { DownloaderHelper } from "node-downloader-helper"
|
||||
import { installAptPack } from "setup-apt"
|
||||
import { getDebArch } from "../utils/env/arch.js"
|
||||
import { hasAptGet } from "../utils/env/hasAptGet.js"
|
||||
import { hasDnf } from "../utils/env/hasDnf.js"
|
||||
import { isArch } from "../utils/env/isArch.js"
|
||||
import { isUbuntu } from "../utils/env/isUbuntu.js"
|
||||
import { setupBin } from "../utils/setup/setupBin.js"
|
||||
import { setupDnfPack } from "../utils/setup/setupDnfPack.js"
|
||||
import { setupPacmanPack } from "../utils/setup/setupPacmanPack.js"
|
||||
|
|
@ -22,7 +22,7 @@ export async function setupLLVMBin(version: string, setupDir: string, arch: stri
|
|||
}
|
||||
|
||||
async function llvmBinaryDeps_(_majorVersion: number, arch: string) {
|
||||
if (isUbuntu()) {
|
||||
if (hasAptGet()) {
|
||||
for (const dep of ["libtinfo5", "libtinfo6"]) {
|
||||
/* eslint-disable no-await-in-loop */
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ import { info } from "ci-log"
|
|||
import { addExeExt } from "patha"
|
||||
import { loadAssetList, matchAsset } from "../utils/asset/load-assets.js"
|
||||
import { arm64, armv7, powerpc64le, sparc64, sparcv9, x86, x86_64 } from "../utils/env/arch.js"
|
||||
import { hasAptGet } from "../utils/env/hasAptGet.js"
|
||||
import { hasDnf } from "../utils/env/hasDnf.js"
|
||||
import { isUbuntu } from "../utils/env/isUbuntu.js"
|
||||
import { ubuntuVersion } from "../utils/env/ubuntu_version.js"
|
||||
import { extractTarByExe, getArchiveType, getExtractFunction } from "../utils/setup/extract.js"
|
||||
import type { PackageInfo } from "../utils/setup/setupBin.js"
|
||||
|
|
@ -105,7 +105,7 @@ async function getAssetKeywords(platform: string, arch: string) {
|
|||
case "linux": {
|
||||
const osKeywordsChoice = ["linux", "Linux"]
|
||||
|
||||
if (isUbuntu()) {
|
||||
if (hasAptGet()) {
|
||||
optionalKeywords.push("ubuntu")
|
||||
|
||||
const ubuntuVer = await ubuntuVersion()
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ import { hasApk, installApkPack } from "setup-alpine"
|
|||
import { installAptPack } from "setup-apt"
|
||||
import { getBrewDir, installBrewPack } from "setup-brew"
|
||||
import { rcOptions } from "../options.js"
|
||||
import { hasAptGet } from "../utils/env/hasAptGet.js"
|
||||
import { hasDnf } from "../utils/env/hasDnf.js"
|
||||
import { isArch } from "../utils/env/isArch.js"
|
||||
import { isUbuntu } from "../utils/env/isUbuntu.js"
|
||||
import { setupChocoPack } from "../utils/setup/setupChocoPack.js"
|
||||
import { setupDnfPack } from "../utils/setup/setupDnfPack.js"
|
||||
import { setupPacmanPack } from "../utils/setup/setupPacmanPack.js"
|
||||
|
|
@ -29,7 +29,7 @@ export async function setupMake(version: string, _setupDir: string, _arch: strin
|
|||
return setupPacmanPack("make", version)
|
||||
} else if (hasDnf()) {
|
||||
return setupDnfPack([{ name: "make", version }])
|
||||
} else if (isUbuntu()) {
|
||||
} else if (hasAptGet()) {
|
||||
return installAptPack([{ name: "make", version }])
|
||||
} else if (await hasApk()) {
|
||||
return installApkPack([{ name: "make", version }])
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import { execRootSync } from "admina"
|
||||
import { isUbuntu } from "../../utils/env/isUbuntu.js"
|
||||
import { hasAptGet } from "../../utils/env/hasAptGet.js"
|
||||
import { testBin } from "../../utils/tests/test-helpers.js"
|
||||
import { setupNala } from "../nala.js"
|
||||
|
||||
jest.setTimeout(300000)
|
||||
describe("setup-nala", () => {
|
||||
if (!isUbuntu()) {
|
||||
if (!hasAptGet()) {
|
||||
test.skip("should setup nala", () => {})
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@ import { readFile, writeFile } from "fs/promises"
|
|||
import { DownloaderHelper } from "node-downloader-helper"
|
||||
import { hasNala, installAptPack, qualifiedNeededAptPackage } from "setup-apt"
|
||||
import which from "which"
|
||||
import { isUbuntu } from "../utils/env/isUbuntu.js"
|
||||
import { hasAptGet } from "../utils/env/hasAptGet.js"
|
||||
|
||||
let binDir: string | undefined
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
export async function setupNala(version: string, _setupDir: string, _arch: string) {
|
||||
if (!isUbuntu()) {
|
||||
if (!hasAptGet()) {
|
||||
return undefined
|
||||
}
|
||||
if (typeof binDir === "string") {
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ import { hasApk, installApkPack } from "setup-alpine"
|
|||
import { installAptPack } from "setup-apt"
|
||||
import { installBrewPack } from "setup-brew"
|
||||
import { rcOptions } from "../options.js"
|
||||
import { hasAptGet } from "../utils/env/hasAptGet.js"
|
||||
import { hasDnf } from "../utils/env/hasDnf.js"
|
||||
import { isArch } from "../utils/env/isArch.js"
|
||||
import { isUbuntu } from "../utils/env/isUbuntu.js"
|
||||
import { ubuntuVersion } from "../utils/env/ubuntu_version.js"
|
||||
import { type PackageInfo, setupBin } from "../utils/setup/setupBin.js"
|
||||
import { setupChocoPack } from "../utils/setup/setupChocoPack.js"
|
||||
|
|
@ -96,7 +96,7 @@ export async function setupPowershellSystem(version: string | undefined, _setupD
|
|||
"curl https://packages.microsoft.com/config/rhel/8/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo",
|
||||
])
|
||||
return setupDnfPack([{ name: "powershell", version }])
|
||||
} else if (isUbuntu()) {
|
||||
} else if (hasAptGet()) {
|
||||
await installAptPack([{ name: "curl" }])
|
||||
const ubuntuVerSplitted = (await ubuntuVersion())!
|
||||
const ubuntuVersionString = `${ubuntuVerSplitted[0]}.0${ubuntuVerSplitted[1]}`
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ import { installAptPack, isAptPackInstalled } from "setup-apt"
|
|||
import { installBrewPack } from "setup-brew"
|
||||
import which from "which"
|
||||
import { rcOptions } from "../options.js"
|
||||
import { hasAptGet } from "../utils/env/hasAptGet.js"
|
||||
import { hasDnf } from "../utils/env/hasDnf.js"
|
||||
import { isArch } from "../utils/env/isArch.js"
|
||||
import { isUbuntu } from "../utils/env/isUbuntu.js"
|
||||
import type { InstallationInfo } from "../utils/setup/setupBin.js"
|
||||
import { setupChocoPack } from "../utils/setup/setupChocoPack.js"
|
||||
import { setupDnfPack } from "../utils/setup/setupDnfPack.js"
|
||||
|
|
@ -123,7 +123,7 @@ async function hasVenv(foundPython: string): Promise<boolean> {
|
|||
await execa(foundPython, ["-m", "venv", "-h"], { stdio: "ignore" })
|
||||
|
||||
// checking venv module is not enough on Ubuntu 20.04
|
||||
if (isUbuntu()) {
|
||||
if (hasAptGet()) {
|
||||
return isAptPackInstalled("python3-venv")
|
||||
}
|
||||
|
||||
|
|
@ -231,7 +231,7 @@ async function setupPythonSystem(setupDir: string, version: string) {
|
|||
installInfo = await setupPacmanPack("python", version)
|
||||
} else if (hasDnf()) {
|
||||
installInfo = await setupDnfPack([{ name: "python3", version }])
|
||||
} else if (isUbuntu()) {
|
||||
} else if (hasAptGet()) {
|
||||
installInfo = await installAptPack([{ name: "python3", version }, { name: "python-is-python3" }])
|
||||
} else if (await hasApk()) {
|
||||
installInfo = await installApkPack([{ name: "python3", version }])
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { getUbuntuVersion } from "ubuntu-version"
|
||||
import { isUbuntu } from "../../utils/env/isUbuntu.js"
|
||||
import { hasAptGet } from "../../utils/env/hasAptGet.js"
|
||||
import type { InstallationInfo } from "../../utils/setup/setupBin.js"
|
||||
import { testBin } from "../../utils/tests/test-helpers.js"
|
||||
import { setupSccache } from "../sccache.js"
|
||||
|
|
@ -7,7 +7,7 @@ import { setupSccache } from "../sccache.js"
|
|||
jest.setTimeout(300000)
|
||||
describe("setup-sccache", () => {
|
||||
it("should setup sccache", async () => {
|
||||
const ubuntuVersion = isUbuntu() ? await getUbuntuVersion() : undefined
|
||||
const ubuntuVersion = hasAptGet() ? await getUbuntuVersion() : undefined
|
||||
const ubuntuVersionMajor = ubuntuVersion?.[0] ?? 0
|
||||
if (process.platform === "linux" && process.arch === "arm64" && ubuntuVersionMajor < 24) {
|
||||
return
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { hasApk, installApkPack } from "setup-alpine"
|
|||
import { installAptPack } from "setup-apt"
|
||||
import { installBrewPack } from "setup-brew"
|
||||
import { getUbuntuVersion } from "ubuntu-version"
|
||||
import { isUbuntu } from "../utils/env/isUbuntu.js"
|
||||
import { hasAptGet } from "../utils/env/hasAptGet.js"
|
||||
import { setupChocoPack } from "../utils/setup/setupChocoPack.js"
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
|
|
@ -12,7 +12,7 @@ export async function setupSccache(version: string, _setupDir: string, _arch: st
|
|||
return setupChocoPack("sccache", version)
|
||||
}
|
||||
case "linux": {
|
||||
if (isUbuntu()) {
|
||||
if (hasAptGet()) {
|
||||
const ubuntuVersion = await getUbuntuVersion()
|
||||
if (ubuntuVersion[0] >= 24) {
|
||||
return installAptPack([{ name: "sccache", version }])
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import { hasApk, installApkPack } from "setup-alpine"
|
||||
import { installAptPack } from "setup-apt"
|
||||
import { installBrewPack } from "setup-brew"
|
||||
import { hasAptGet } from "../utils/env/hasAptGet.js"
|
||||
import { hasDnf } from "../utils/env/hasDnf.js"
|
||||
import { isArch } from "../utils/env/isArch.js"
|
||||
import { isUbuntu } from "../utils/env/isUbuntu.js"
|
||||
import { setupChocoPack } from "../utils/setup/setupChocoPack.js"
|
||||
import { setupDnfPack } from "../utils/setup/setupDnfPack.js"
|
||||
import { setupPacmanPack } from "../utils/setup/setupPacmanPack.js"
|
||||
|
|
@ -25,7 +25,7 @@ export async function setupSevenZip(version: string, _setupDir: string, _arch: s
|
|||
{ name: "p7zip", version },
|
||||
{ name: "p7zip-plugins", version },
|
||||
])
|
||||
} else if (isUbuntu()) {
|
||||
} else if (hasAptGet()) {
|
||||
return installAptPack([{ name: "p7zip-full", version }])
|
||||
} else if (await hasApk()) {
|
||||
return installApkPack([{ name: "p7zip", version }])
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
import memoize from "memoizee"
|
||||
import which from "which"
|
||||
|
||||
function hasAptGet_(): boolean {
|
||||
if (process.platform !== "linux") {
|
||||
return false
|
||||
}
|
||||
return which.sync("apt-get", { nothrow: true }) !== null
|
||||
}
|
||||
|
||||
export const hasAptGet = memoize(hasAptGet_)
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
import which from "which"
|
||||
|
||||
let isUbuntuCache: undefined | boolean = undefined
|
||||
|
||||
export function isUbuntu(): boolean {
|
||||
if (process.platform !== "linux") {
|
||||
return false
|
||||
}
|
||||
if (isUbuntuCache === undefined) {
|
||||
const apt = "apt-get"
|
||||
isUbuntuCache = which.sync(apt, { nothrow: true }) !== null
|
||||
}
|
||||
|
||||
return isUbuntuCache
|
||||
}
|
||||
|
|
@ -4,11 +4,11 @@ import memoize from "memoizee"
|
|||
import { installAptPack } from "setup-apt"
|
||||
import { getUbuntuVersion } from "ubuntu-version"
|
||||
import which from "which"
|
||||
import { isUbuntu } from "./isUbuntu.js"
|
||||
import { hasAptGet } from "./hasAptGet.js"
|
||||
|
||||
async function ubuntuVersion_(): Promise<number[] | null> {
|
||||
try {
|
||||
if (isUbuntu()) {
|
||||
if (hasAptGet()) {
|
||||
try {
|
||||
if (which.sync("lsb_release", { nothrow: true }) === null) {
|
||||
await installAptPack([{ name: "lsb-release" }])
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ import { hasApk, installApkPack } from "setup-alpine"
|
|||
import { installAptPack } from "setup-apt"
|
||||
import which from "which"
|
||||
import { setupSevenZip } from "../../sevenzip/sevenzip.js"
|
||||
import { hasAptGet } from "../env/hasAptGet.js"
|
||||
import { hasDnf } from "../env/hasDnf.js"
|
||||
import { isArch } from "../env/isArch.js"
|
||||
import { isUbuntu } from "../env/isUbuntu.js"
|
||||
import { setupDnfPack } from "./setupDnfPack.js"
|
||||
import { setupPacmanPack } from "./setupPacmanPack.js"
|
||||
export { extractTar, extractXar } from "@actions/tool-cache"
|
||||
|
|
@ -171,7 +171,7 @@ async function installTarDependencies(archiveType: ArchiveType) {
|
|||
await setupPacmanPack("tar")
|
||||
} else if (hasDnf()) {
|
||||
await setupDnfPack([{ name: "gzip" }, { name: "tar" }])
|
||||
} else if (isUbuntu()) {
|
||||
} else if (hasAptGet()) {
|
||||
await installAptPack([{ name: "gzip" }, { name: "tar" }])
|
||||
} else if (await hasApk()) {
|
||||
await installApkPack([{ name: "gzip" }, { name: "tar" }])
|
||||
|
|
@ -186,7 +186,7 @@ async function installTarDependencies(archiveType: ArchiveType) {
|
|||
await setupPacmanPack("tar")
|
||||
} else if (hasDnf()) {
|
||||
await setupDnfPack([{ name: "xz" }, { name: "tar" }])
|
||||
} else if (isUbuntu()) {
|
||||
} else if (hasAptGet()) {
|
||||
await installAptPack([{ name: "xz-utils" }, { name: "tar" }])
|
||||
} else if (await hasApk()) {
|
||||
await installApkPack([{ name: "xz" }, { name: "tar" }])
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@ import which from "which"
|
|||
import { rcOptions } from "../../options.js"
|
||||
import { setupPython } from "../../python/python.js"
|
||||
import { getVersion } from "../../versions/versions.js"
|
||||
import { hasAptGet } from "../env/hasAptGet.js"
|
||||
import { hasDnf } from "../env/hasDnf.js"
|
||||
import { isArch } from "../env/isArch.js"
|
||||
import { isUbuntu } from "../env/isUbuntu.js"
|
||||
import { ubuntuVersion } from "../env/ubuntu_version.js"
|
||||
import { unique } from "../std/index.js"
|
||||
import type { InstallationInfo } from "./setupBin.js"
|
||||
|
|
@ -292,7 +292,7 @@ export async function setupPipPackSystem(name: string, givenAddPythonPrefix?: bo
|
|||
return setupPacmanPack(addPythonPrefix ? `python-${name}` : name)
|
||||
} else if (hasDnf()) {
|
||||
return setupDnfPack([{ name: addPythonPrefix ? `python3-${name}` : name }])
|
||||
} else if (isUbuntu()) {
|
||||
} else if (hasAptGet()) {
|
||||
return installAptPack([{ name: addPythonPrefix ? `python3-${name}` : name }])
|
||||
} else if (await hasApk()) {
|
||||
return installApkPack([{ name: addPythonPrefix ? `py3-${name}` : name }])
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ import which from "which"
|
|||
import { setupGit } from "../git/git.js"
|
||||
import { rcOptions } from "../options.js"
|
||||
import { arm64 } from "../utils/env/arch.js"
|
||||
import { hasAptGet } from "../utils/env/hasAptGet.js"
|
||||
import { hasDnf } from "../utils/env/hasDnf.js"
|
||||
import { isArch } from "../utils/env/isArch.js"
|
||||
import { isUbuntu } from "../utils/env/isUbuntu.js"
|
||||
import type { InstallationInfo } from "../utils/setup/setupBin.js"
|
||||
import { setupDnfPack } from "../utils/setup/setupDnfPack.js"
|
||||
import { setupPacmanPack } from "../utils/setup/setupPacmanPack.js"
|
||||
|
|
@ -47,7 +47,7 @@ export async function setupVcpkg(version: string, setupDir: string, arch: string
|
|||
{ name: "tar" },
|
||||
{ name: "pkg-config" },
|
||||
])
|
||||
} else if (isUbuntu()) {
|
||||
} else if (hasAptGet()) {
|
||||
await installAptPack([
|
||||
{ name: "curl" },
|
||||
{ name: "zip" },
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ import { isAlpine } from "setup-alpine"
|
|||
import type { CompilerInfo } from "../compilers.js"
|
||||
import type { Opts } from "../options.js"
|
||||
import type { Inputs, ToolName } from "../tool.js"
|
||||
import { hasAptGet } from "../utils/env/hasAptGet.js"
|
||||
import { hasDnf } from "../utils/env/hasDnf.js"
|
||||
import { isArch } from "../utils/env/isArch.js"
|
||||
import { isUbuntu } from "../utils/env/isUbuntu.js"
|
||||
|
||||
export function getVersion(name: ToolName, version: string | undefined, distroVersion: number[] | null = null) {
|
||||
if (isVersionDefault(version)) {
|
||||
|
|
@ -67,7 +67,7 @@ export function getVersionDefault(
|
|||
const distroMap = distroMapOrVersion
|
||||
|
||||
// check for distro-specific versions
|
||||
const distro = isUbuntu()
|
||||
const distro = hasAptGet()
|
||||
? "ubuntu"
|
||||
: isArch()
|
||||
? "archlinux"
|
||||
|
|
|
|||
Loading…
Reference in New Issue