mirror of https://github.com/aminya/setup-cpp
fix: use nala on ubuntu instead of apt
This commit is contained in:
parent
96f1e1cf8c
commit
e4784c9adc
|
@ -75,9 +75,6 @@ inputs:
|
|||
sevenzip:
|
||||
description: "The 7z version to install."
|
||||
required: false
|
||||
nala:
|
||||
description: 'The nala version to install ("legacy" or "").'
|
||||
required: false
|
||||
|
||||
runs:
|
||||
using: "node12"
|
||||
|
|
|
@ -43,6 +43,7 @@ import { addEnv } from "./utils/env/addEnv"
|
|||
import { setupSevenZip } from "./sevenzip/sevenzip"
|
||||
import { setupGraphviz } from "./graphviz/graphviz"
|
||||
import { setupNala } from "./nala/nala"
|
||||
import { isUbuntu } from "./utils/env/isUbuntu"
|
||||
|
||||
/** The setup functions */
|
||||
const setups = {
|
||||
|
@ -154,6 +155,10 @@ export async function main(args: string[]): Promise<number> {
|
|||
return 1
|
||||
}
|
||||
|
||||
if (isUbuntu()) {
|
||||
setupNala(getVersion("nala", undefined, osVersion), "", arch)
|
||||
}
|
||||
|
||||
// loop over the tools and run their setup function
|
||||
for (const tool of tools) {
|
||||
// get the version or "true" or undefined for this tool from the options
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import { setupNala } from "../nala"
|
||||
import { testBin } from "../../utils/tests/test-helpers"
|
||||
import { isUbuntu } from "../../utils/env/isUbuntu"
|
||||
|
||||
jest.setTimeout(300000)
|
||||
describe("setup-nala", () => {
|
||||
it("should setup nala", async () => {
|
||||
if (process.platform !== "linux") {
|
||||
if (!isUbuntu()) {
|
||||
return
|
||||
}
|
||||
const installInfo = setupNala("", "", process.arch)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { dirname } from "path"
|
||||
import which from "which"
|
||||
import { isUbuntu } from "../utils/env/isUbuntu"
|
||||
import { execSudo } from "../utils/exec/sudo"
|
||||
import { setupAptPack } from "../utils/setup/setupAptPack"
|
||||
|
||||
|
@ -7,7 +8,7 @@ let binDir: string | undefined
|
|||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
export function setupNala(version: string, _setupDir: string, _arch: string) {
|
||||
if (process.platform !== "linux") {
|
||||
if (!isUbuntu()) {
|
||||
return undefined
|
||||
}
|
||||
if (typeof binDir === "string") {
|
||||
|
|
|
@ -6,6 +6,7 @@ import { warning } from "../io/io"
|
|||
import { isGitHubCI } from "../env/isCI"
|
||||
import { cpprc_path, setupCppInProfile } from "../env/addEnv"
|
||||
import { appendFileSync } from "fs"
|
||||
import which from "which"
|
||||
|
||||
let didUpdate: boolean = false
|
||||
let didInit: boolean = false
|
||||
|
@ -19,7 +20,12 @@ export function setupAptPack(
|
|||
): InstallationInfo {
|
||||
info(`Installing ${name} ${version ?? ""} via apt`)
|
||||
|
||||
const apt = "apt-get"
|
||||
let apt: string
|
||||
if (which.sync("nala", { nothrow: true }) !== null) {
|
||||
apt = "nala"
|
||||
} else {
|
||||
apt = "apt-get"
|
||||
}
|
||||
|
||||
process.env.DEBIAN_FRONTEND = "noninteractive"
|
||||
|
||||
|
|
Loading…
Reference in New Issue