fix: check isUbuntu before using apt - fixes pip packages

This commit is contained in:
Amin Yahyaabadi 2022-07-10 17:39:21 -07:00
parent 5ca7197035
commit 1103890904
14 changed files with 34 additions and 16 deletions

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

@ -5,6 +5,7 @@ import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { isArch } from "../utils/env/isArch" import { isArch } from "../utils/env/isArch"
import { hasDnf } from "../utils/env/hasDnf" import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack" import { setupDnfPack } from "../utils/setup/setupDnfPack"
import { isUbuntu } from "../utils/env/isUbuntu"
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
export function setupCcache(version: string, _setupDir: string, _arch: string) { export function setupCcache(version: string, _setupDir: string, _arch: string) {
@ -20,9 +21,11 @@ export function setupCcache(version: string, _setupDir: string, _arch: string) {
return setupPacmanPack("ccache", version) return setupPacmanPack("ccache", version)
} else if (hasDnf()) { } else if (hasDnf()) {
return setupDnfPack("ccache", version) return setupDnfPack("ccache", version)
} } else if (isUbuntu()) {
return setupAptPack("ccache", version) return setupAptPack("ccache", version)
} }
throw new Error(`Unsupported linux distribution`)
}
default: { default: {
throw new Error(`Unsupported platform`) throw new Error(`Unsupported platform`)
} }

View File

@ -6,6 +6,7 @@ import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { isArch } from "../utils/env/isArch" import { isArch } from "../utils/env/isArch"
import { hasDnf } from "../utils/env/hasDnf" import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack" import { setupDnfPack } from "../utils/setup/setupDnfPack"
import { isUbuntu } from "../utils/env/isUbuntu"
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
export async function setupCppcheck(version: string | undefined, _setupDir: string, _arch: string) { export async function setupCppcheck(version: string | undefined, _setupDir: string, _arch: string) {
@ -23,9 +24,11 @@ export async function setupCppcheck(version: string | undefined, _setupDir: stri
return setupPacmanPack("cppcheck", version) return setupPacmanPack("cppcheck", version)
} else if (hasDnf()) { } else if (hasDnf()) {
return setupDnfPack("ccache", version) return setupDnfPack("ccache", version)
} } else if (isUbuntu()) {
return setupAptPack("cppcheck", version) return setupAptPack("cppcheck", version)
} }
throw new Error(`Unsupported linux distribution`)
}
default: { default: {
throw new Error(`Unsupported platform`) throw new Error(`Unsupported platform`)
} }

View File

@ -88,7 +88,7 @@ export async function setupGcc(version: string, setupDir: string, arch: string)
installationInfo = setupPacmanPack("gcc", version) installationInfo = setupPacmanPack("gcc", version)
} else if (hasDnf()) { } else if (hasDnf()) {
installationInfo = setupDnfPack("gcc", version) installationInfo = setupDnfPack("gcc", version)
} else { } else if (isUbuntu()) {
setupAptPack("gcc", version, ["ppa:ubuntu-toolchain-r/test"]) setupAptPack("gcc", version, ["ppa:ubuntu-toolchain-r/test"])
installationInfo = setupAptPack("g++", version, []) installationInfo = setupAptPack("g++", version, [])
} }
@ -96,7 +96,7 @@ export async function setupGcc(version: string, setupDir: string, arch: string)
info(`Install g++-multilib because gcc for ${arch} was requested`) info(`Install g++-multilib because gcc for ${arch} was requested`)
if (isArch()) { if (isArch()) {
setupPacmanPack("gcc-multilib", version) setupPacmanPack("gcc-multilib", version)
} else { } else if (isUbuntu()) {
setupAptPack("gcc-multilib", version, ["ppa:ubuntu-toolchain-r/test"]) setupAptPack("gcc-multilib", version, ["ppa:ubuntu-toolchain-r/test"])
} }
} }

View File

@ -7,6 +7,7 @@ import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { isArch } from "../utils/env/isArch" import { isArch } from "../utils/env/isArch"
import { hasDnf } from "../utils/env/hasDnf" import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack" import { setupDnfPack } from "../utils/setup/setupDnfPack"
import { isUbuntu } from "../utils/env/isUbuntu"
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
export async function setupGraphviz(version: string, _setupDir: string, _arch: string) { export async function setupGraphviz(version: string, _setupDir: string, _arch: string) {
@ -23,9 +24,11 @@ export async function setupGraphviz(version: string, _setupDir: string, _arch: s
return setupPacmanPack("graphviz", version) return setupPacmanPack("graphviz", version)
} else if (hasDnf()) { } else if (hasDnf()) {
return setupDnfPack("graphviz", version) return setupDnfPack("graphviz", version)
} } else if (isUbuntu()) {
return setupAptPack("graphviz", version) return setupAptPack("graphviz", version)
} }
throw new Error(`Unsupported linux distribution`)
}
default: { default: {
throw new Error(`Unsupported platform`) throw new Error(`Unsupported platform`)
} }

View File

@ -13,6 +13,7 @@ import { PackageInfo, setupBin } from "../utils/setup/setupBin"
import { isArch } from "../utils/env/isArch" import { isArch } from "../utils/env/isArch"
import { hasDnf } from "../utils/env/hasDnf" import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack" import { setupDnfPack } from "../utils/setup/setupDnfPack"
import { isUbuntu } from "../utils/env/isUbuntu"
function getKcovPackageInfo(version: string): PackageInfo { function getKcovPackageInfo(version: string): PackageInfo {
const version_number = parseInt(version.replace(/^v/, ""), 10) const version_number = parseInt(version.replace(/^v/, ""), 10)
@ -52,7 +53,7 @@ async function buildKcov(file: string, dest: string) {
} else if (hasDnf()) { } else if (hasDnf()) {
setupDnfPack("libdwarf-devel") setupDnfPack("libdwarf-devel")
setupDnfPack("libcurl-devel") setupDnfPack("libcurl-devel")
} else { } else if (isUbuntu()) {
setupAptPack("libdw-dev") setupAptPack("libdw-dev")
setupAptPack("libcurl4-openssl-dev") setupAptPack("libcurl4-openssl-dev")
} }
@ -71,7 +72,7 @@ export async function setupKcov(version: string, setupDir: string, arch: string)
setupPacmanPack("binutils") setupPacmanPack("binutils")
} else if (hasDnf()) { } else if (hasDnf()) {
setupDnfPack("binutils") setupDnfPack("binutils")
} else { } else if (isUbuntu()) {
setupAptPack("libbinutils") setupAptPack("libbinutils")
} }
return installationInfo return installationInfo

View File

@ -290,7 +290,7 @@ async function _setupLLVM(version: string, setupDir: string, arch: string) {
if (isArch()) { if (isArch()) {
// setupPacmanPack("ncurses") // setupPacmanPack("ncurses")
// TODO: install libtinfo ? // TODO: install libtinfo ?
} else { } else if (isUbuntu()) {
setupAptPack("libtinfo-dev") setupAptPack("libtinfo-dev")
} }
} }

View File

@ -6,6 +6,7 @@ import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { isArch } from "../utils/env/isArch" import { isArch } from "../utils/env/isArch"
import { hasDnf } from "../utils/env/hasDnf" import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack" import { setupDnfPack } from "../utils/setup/setupDnfPack"
import { isUbuntu } from "../utils/env/isUbuntu"
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
export async function setupMake(version: string, _setupDir: string, _arch: string) { export async function setupMake(version: string, _setupDir: string, _arch: string) {
@ -23,9 +24,11 @@ export async function setupMake(version: string, _setupDir: string, _arch: strin
return setupPacmanPack("make", version) return setupPacmanPack("make", version)
} else if (hasDnf()) { } else if (hasDnf()) {
return setupDnfPack("make", version) return setupDnfPack("make", version)
} } else if (isUbuntu()) {
return setupAptPack("make", version) return setupAptPack("make", version)
} }
throw new Error(`Unsupported linux distribution`)
}
default: { default: {
throw new Error(`Unsupported platform`) throw new Error(`Unsupported platform`)
} }

View File

@ -5,6 +5,7 @@ import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { isArch } from "../utils/env/isArch" import { isArch } from "../utils/env/isArch"
import { hasDnf } from "../utils/env/hasDnf" import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack" import { setupDnfPack } from "../utils/setup/setupDnfPack"
import { isUbuntu } from "../utils/env/isUbuntu"
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
export function setupSevenZip(version: string, _setupDir: string, _arch: string) { export function setupSevenZip(version: string, _setupDir: string, _arch: string) {
@ -20,9 +21,11 @@ export function setupSevenZip(version: string, _setupDir: string, _arch: string)
return setupPacmanPack("p7zip", version) return setupPacmanPack("p7zip", version)
} else if (hasDnf()) { } else if (hasDnf()) {
return setupDnfPack("p7zip", version) return setupDnfPack("p7zip", version)
} } else if (isUbuntu()) {
return setupAptPack("p7zip-full", version) return setupAptPack("p7zip-full", version)
} }
throw new Error(`Unsupported linux distribution`)
}
default: { default: {
throw new Error(`Unsupported platform`) throw new Error(`Unsupported platform`)
} }

View File

@ -10,6 +10,7 @@ import { setupPacmanPack } from "./setupPacmanPack"
import { isArch } from "../env/isArch" import { isArch } from "../env/isArch"
import { hasDnf } from "../env/hasDnf" import { hasDnf } from "../env/hasDnf"
import { setupDnfPack } from "./setupDnfPack" import { setupDnfPack } from "./setupDnfPack"
import { isUbuntu } from "../env/isUbuntu"
/** A type that describes a package */ /** A type that describes a package */
export type PackageInfo = { export type PackageInfo = {
@ -100,7 +101,7 @@ export async function setupBin(
setupDnfPack("unzip") setupDnfPack("unzip")
setupDnfPack("tar") setupDnfPack("tar")
setupDnfPack("xz") setupDnfPack("xz")
} else { } else if (isUbuntu()) {
setupAptPack("unzip") setupAptPack("unzip")
setupAptPack("tar") setupAptPack("tar")
setupAptPack("xz-utils") setupAptPack("xz-utils")

View File

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