feat: support installing system packages using dnf package manager

This commit is contained in:
Amin Yahyaabadi 2022-07-10 16:34:56 -07:00
parent 50a814c62d
commit e8d2cb09a2
18 changed files with 68 additions and 21 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

2
dist/setup_cpp.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dist/setup_cpp.mjs vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -3,6 +3,8 @@ import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
import { setupBrewPack } from "../utils/setup/setupBrewPack"
import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { isArch } from "../utils/env/isArch"
import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack"
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function setupCcache(version: string, _setupDir: string, _arch: string) {
@ -16,6 +18,8 @@ export function setupCcache(version: string, _setupDir: string, _arch: string) {
case "linux": {
if (isArch()) {
return setupPacmanPack("ccache", version)
} else if (hasDnf()) {
return setupDnfPack("ccache", version)
}
return setupAptPack("ccache", version)
}

View File

@ -4,6 +4,8 @@ import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
import { setupBrewPack } from "../utils/setup/setupBrewPack"
import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { isArch } from "../utils/env/isArch"
import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack"
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export async function setupCppcheck(version: string | undefined, _setupDir: string, _arch: string) {
@ -19,6 +21,8 @@ export async function setupCppcheck(version: string | undefined, _setupDir: stri
case "linux": {
if (isArch()) {
return setupPacmanPack("cppcheck", version)
} else if (hasDnf()) {
return setupDnfPack("ccache", version)
}
return setupAptPack("cppcheck", version)
}

View File

@ -12,6 +12,8 @@ import { getVersion } from "../default_versions"
import { existsSync } from "fs"
import { join } from "path"
import { isArch } from "../utils/env/isArch"
import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack"
/** Get the platform data for cmake */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@ -61,6 +63,8 @@ export async function setupDoxygen(version: string, setupDir: string, arch: stri
if (version === "") {
if (isArch()) {
installationInfo = setupPacmanPack("doxygen", undefined)
} else if (hasDnf()) {
return setupDnfPack("doxygen", version)
} else {
installationInfo = setupAptPack("doxygen", undefined)
}

View File

@ -15,6 +15,8 @@ import { InstallationInfo, PackageInfo, setupBin } from "../utils/setup/setupBin
import { extract7Zip } from "../utils/setup/extract"
import { isArch } from "../utils/env/isArch"
import { isUbuntu } from "../utils/env/isUbuntu"
import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack"
interface MingwInfo {
releaseName: string
@ -84,6 +86,8 @@ export async function setupGcc(version: string, setupDir: string, arch: string)
if (arch === "x64") {
if (isArch()) {
installationInfo = setupPacmanPack("gcc", version)
} else if (hasDnf()) {
installationInfo = setupDnfPack("gcc", version)
} else {
setupAptPack("gcc", version, ["ppa:ubuntu-toolchain-r/test"])
installationInfo = setupAptPack("g++", version, [])

View File

@ -5,6 +5,8 @@ import { InstallationInfo } from "../utils/setup/setupBin"
import { setupBrewPack } from "../utils/setup/setupBrewPack"
import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { isArch } from "../utils/env/isArch"
import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack"
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export async function setupGraphviz(version: string, _setupDir: string, _arch: string) {
@ -19,6 +21,8 @@ export async function setupGraphviz(version: string, _setupDir: string, _arch: s
case "linux": {
if (isArch()) {
return setupPacmanPack("graphviz", version)
} else if (hasDnf()) {
return setupDnfPack("graphviz", version)
}
return setupAptPack("graphviz", version)
}

View File

@ -11,6 +11,8 @@ import { setupAptPack } from "../utils/setup/setupAptPack"
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
import { PackageInfo, setupBin } from "../utils/setup/setupBin"
import { isArch } from "../utils/env/isArch"
import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack"
function getKcovPackageInfo(version: string): PackageInfo {
const version_number = parseInt(version.replace(/^v/, ""), 10)
@ -47,6 +49,9 @@ async function buildKcov(file: string, dest: string) {
if (isArch()) {
setupPacmanPack("libdwarf")
setupPacmanPack("libcurl-openssl")
} else if (hasDnf()) {
setupDnfPack("libdwarf-devel")
setupDnfPack("libcurl-devel")
} else {
setupAptPack("libdw-dev")
setupAptPack("libcurl4-openssl-dev")
@ -61,14 +66,14 @@ async function buildKcov(file: string, dest: string) {
export async function setupKcov(version: string, setupDir: string, arch: string) {
switch (process.platform) {
case "linux": {
const installationInfo = await setupBin("kcov", version, getKcovPackageInfo, setupDir, arch)
if (isArch()) {
// TODO install kcov ? setupPacmanPack("kcov")
const installationInfo = await setupBin("kcov", version, getKcovPackageInfo, setupDir, arch)
setupPacmanPack("binutils")
return installationInfo
}
const installationInfo = await setupBin("kcov", version, getKcovPackageInfo, setupDir, arch)
} else if (hasDnf()) {
setupDnfPack("binutils")
} else {
setupAptPack("libbinutils")
}
return installationInfo
}
default: {

View File

@ -4,6 +4,8 @@ import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
import { setupBrewPack } from "../utils/setup/setupBrewPack"
import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { isArch } from "../utils/env/isArch"
import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack"
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export async function setupMake(version: string, _setupDir: string, _arch: string) {
@ -19,6 +21,8 @@ export async function setupMake(version: string, _setupDir: string, _arch: strin
case "linux": {
if (isArch()) {
return setupPacmanPack("make", version)
} else if (hasDnf()) {
return setupDnfPack("make", version)
}
return setupAptPack("make", version)
}

View File

@ -9,6 +9,8 @@ import { isArch } from "../utils/env/isArch"
import which from "which"
import { InstallationInfo } from "../utils/setup/setupBin"
import { dirname, join } from "path"
import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack"
export async function setupPython(version: string, setupDir: string, arch: string) {
if (!isGitHubCI()) {
@ -52,13 +54,16 @@ export async function setupPythonViaSystem(
return setupBrewPack("python3", version)
}
case "linux": {
let installInfo: InstallationInfo
if (isArch()) {
const installInfo = setupPacmanPack("python", version)
installInfo = setupPacmanPack("python", version)
setupPacmanPack("python-pip")
return installInfo
}
const installInfo = setupAptPack("python3", version)
} else if (hasDnf()) {
installInfo = setupDnfPack("python3", version)
} else {
installInfo = setupAptPack("python3", version)
setupAptPack("python3-pip")
}
return installInfo
}
default: {

View File

@ -3,6 +3,8 @@ import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
import { setupBrewPack } from "../utils/setup/setupBrewPack"
import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { isArch } from "../utils/env/isArch"
import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack"
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function setupSevenZip(version: string, _setupDir: string, _arch: string) {
@ -16,6 +18,8 @@ export function setupSevenZip(version: string, _setupDir: string, _arch: string)
case "linux": {
if (isArch()) {
return setupPacmanPack("p7zip", version)
} else if (hasDnf()) {
return setupDnfPack("p7zip", version)
}
return setupAptPack("p7zip-full", version)
}

View File

@ -11,6 +11,8 @@ import { setupAptPack } from "../utils/setup/setupAptPack"
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
import { InstallationInfo } from "../utils/setup/setupBin"
import { isArch } from "../utils/env/isArch"
import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack"
let hasVCPKG = false
@ -26,6 +28,13 @@ export async function setupVcpkg(_version: string, setupDir: string, _arch: stri
setupPacmanPack("tar")
setupPacmanPack("git")
setupPacmanPack("pkg-config")
} else if (hasDnf()) {
setupDnfPack("curl")
setupDnfPack("zip")
setupDnfPack("unzip")
setupDnfPack("tar")
setupDnfPack("git")
setupDnfPack("pkg-config")
} else {
setupAptPack("curl")
setupAptPack("zip")