diff --git a/src/utils/setup/setupAptPack.ts b/src/utils/setup/setupAptPack.ts index 196d9456..164246c2 100644 --- a/src/utils/setup/setupAptPack.ts +++ b/src/utils/setup/setupAptPack.ts @@ -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,11 +67,15 @@ async function getAptArg(name: string, version: string | undefined) { if (stdout.trim() !== "") { return `${name}-${version}` } else { - return `${name}=${version}` + // 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}` + } + warning(`Failed to install ${name} ${version} via apt, trying without version`) } - } else { - return name } + return name } function getApt() {