mirror of https://github.com/aminya/setup-cpp
feat: fallback to version-less package on apt if not found
This commit is contained in:
parent
455be30e8f
commit
a0488f7712
|
@ -1,7 +1,5 @@
|
|||
/* eslint-disable require-atomic-updates */
|
||||
import { InstallationInfo } from "./setupBin"
|
||||
import { execRoot, execRootSync } from "admina"
|
||||
import { info } from "@actions/core"
|
||||
import { GITHUB_ACTIONS } from "ci-info"
|
||||
import { addEnv, cpprc_path, setupCppInProfile } from "../env/addEnv"
|
||||
import which from "which"
|
||||
|
@ -10,7 +8,9 @@ import { promises as fsPromises } from "fs"
|
|||
const { appendFile } = fsPromises
|
||||
import { execa } from "execa"
|
||||
import escapeRegex from "escape-string-regexp"
|
||||
import { warning, info } from "ci-log"
|
||||
|
||||
/* eslint-disable require-atomic-updates */
|
||||
let didUpdate: boolean = false
|
||||
let didInit: boolean = false
|
||||
|
||||
|
@ -67,12 +67,16 @@ async function getAptArg(name: string, version: string | undefined) {
|
|||
if (stdout.trim() !== "") {
|
||||
return `${name}-${version}`
|
||||
} else {
|
||||
// check if apt-get show can find the version
|
||||
const { stdout: showStdout } = await execa("apt-get", ["show", `${name}=${version}`])
|
||||
if (showStdout.trim() === "") {
|
||||
return `${name}=${version}`
|
||||
}
|
||||
} else {
|
||||
return name
|
||||
warning(`Failed to install ${name} ${version} via apt, trying without version`)
|
||||
}
|
||||
}
|
||||
return name
|
||||
}
|
||||
|
||||
function getApt() {
|
||||
let apt: string
|
||||
|
|
Loading…
Reference in New Issue