mirror of https://github.com/aminya/setup-cpp
fix: fix: dnf search
This commit is contained in:
parent
41b2cf629a
commit
9fa897444d
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
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -3,7 +3,7 @@ import { execRootSync } from "admina"
|
||||||
import { info, warning } from "ci-log"
|
import { info, warning } from "ci-log"
|
||||||
import { execa } from "execa"
|
import { execa } from "execa"
|
||||||
|
|
||||||
export type DnfPackage = {
|
type DnfPackage = {
|
||||||
name: string
|
name: string
|
||||||
version?: string
|
version?: string
|
||||||
}
|
}
|
||||||
|
@ -23,11 +23,18 @@ export async function setupDnfPack(packages: DnfPackage[]): Promise<Installation
|
||||||
async function getDnfArg(name: string, version: string | undefined) {
|
async function getDnfArg(name: string, version: string | undefined) {
|
||||||
if (version !== undefined && version !== "") {
|
if (version !== undefined && version !== "") {
|
||||||
// check if name-version is available
|
// check if name-version is available
|
||||||
const { stdout } = await execa("dnf", ["search", `${name}-${version}`, "--exact", "--quiet"])
|
const { stdout } = await execa("dnf", ["search", "-q", `${name}-${version}`])
|
||||||
|
|
||||||
if (stdout.trim() !== "") {
|
if (stdout.trim() !== "") {
|
||||||
return `${name}-${version}`
|
return `${name}-${version}`
|
||||||
} else {
|
} else {
|
||||||
|
// try with ${name}${version}
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
||||||
|
const { stdout } = await execa("dnf", ["search", "-q", `${name}${version}`])
|
||||||
|
if (stdout.trim() !== "") {
|
||||||
|
return `${name}${version}`
|
||||||
|
}
|
||||||
|
|
||||||
warning(`Failed to install ${name} ${version} via dnf, trying without version`)
|
warning(`Failed to install ${name} ${version} via dnf, trying without version`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue