mirror of https://github.com/aminya/setup-cpp
fix: use node-download-helper instead of actions/http-client and curl
This commit is contained in:
parent
a247573c5d
commit
ee265991bc
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
|
@ -126,7 +126,8 @@
|
|||
"untildify-user": "workspace:*",
|
||||
"util.types": "^0.0.2",
|
||||
"web-streams-polyfill": "^4.0.0",
|
||||
"which": "^4.0.0"
|
||||
"which": "^4.0.0",
|
||||
"node-downloader-helper": "2.1.9"
|
||||
},
|
||||
"productionDependencies": [
|
||||
"@actions/core",
|
||||
|
@ -148,6 +149,7 @@
|
|||
"micro-memoize",
|
||||
"mri",
|
||||
"msvc-dev-cmd",
|
||||
"node-downloader-helper",
|
||||
"numerous",
|
||||
"envosman",
|
||||
"path-exists",
|
||||
|
|
|
@ -23,7 +23,8 @@
|
|||
"envosman": "workspace:*",
|
||||
"which": "4.0.0",
|
||||
"execa": "^7.2.0",
|
||||
"escape-string-regexp": "^5.0.0"
|
||||
"escape-string-regexp": "^5.0.0",
|
||||
"node-downloader-helper": "2.1.9"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { tmpdir } from "os"
|
||||
import { execRoot, execRootSync } from "admina"
|
||||
import { warning } from "ci-log"
|
||||
import { execa } from "execa"
|
||||
import { DownloaderHelper } from "node-downloader-helper"
|
||||
import { pathExists } from "path-exists"
|
||||
import { installAptPack } from "./install.js"
|
||||
|
||||
function initGpg() {
|
||||
execRootSync("gpg", ["-k"])
|
||||
|
@ -53,8 +53,13 @@ export async function addAptKeyViaDownload(name: string, url: string) {
|
|||
const fileName = `/etc/apt/trusted.gpg.d/${name}`
|
||||
if (!(await pathExists(fileName))) {
|
||||
initGpg()
|
||||
await installAptPack([{ name: "curl" }, { name: "ca-certificates" }], undefined)
|
||||
await execa("curl", ["-s", url, "-o", `/tmp/${name}`])
|
||||
|
||||
const dl = new DownloaderHelper(url, tmpdir(), { fileName: name })
|
||||
dl.on("error", (err) => {
|
||||
throw new Error(`Failed to download ${url}: ${err}`)
|
||||
})
|
||||
await dl.start()
|
||||
|
||||
execRootSync("gpg", ["--no-default-keyring", "--keyring", `gnupg-ring:${fileName}`, "--import", `/tmp/${name}`])
|
||||
execRootSync("chmod", ["644", fileName])
|
||||
}
|
||||
|
|
|
@ -140,6 +140,9 @@ importers:
|
|||
msvc-dev-cmd:
|
||||
specifier: github:aminya/msvc-dev-cmd#c01f519bd995460228ed3dec4df51df92dc290fd
|
||||
version: https://codeload.github.com/aminya/msvc-dev-cmd/tar.gz/c01f519bd995460228ed3dec4df51df92dc290fd
|
||||
node-downloader-helper:
|
||||
specifier: 2.1.9
|
||||
version: 2.1.9
|
||||
npm-check-updates:
|
||||
specifier: ^17.0.6
|
||||
version: 17.0.6
|
||||
|
@ -306,6 +309,9 @@ importers:
|
|||
execa:
|
||||
specifier: ^7.2.0
|
||||
version: 7.2.0
|
||||
node-downloader-helper:
|
||||
specifier: 2.1.9
|
||||
version: 2.1.9
|
||||
path-exists:
|
||||
specifier: ^5.0.0
|
||||
version: 5.0.0
|
||||
|
@ -4176,6 +4182,11 @@ packages:
|
|||
node-addon-api@7.1.1:
|
||||
resolution: {integrity: sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==}
|
||||
|
||||
node-downloader-helper@2.1.9:
|
||||
resolution: {integrity: sha512-FSvAol2Z8UP191sZtsUZwHIN0eGoGue3uEXGdWIH5228e9KH1YHXT7fN8Oa33UGf+FbqGTQg3sJfrRGzmVCaJA==}
|
||||
engines: {node: '>=14.18'}
|
||||
hasBin: true
|
||||
|
||||
node-fetch@2.7.0:
|
||||
resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==}
|
||||
engines: {node: 4.x || >=6.0.0}
|
||||
|
@ -10343,6 +10354,8 @@ snapshots:
|
|||
|
||||
node-addon-api@7.1.1: {}
|
||||
|
||||
node-downloader-helper@2.1.9: {}
|
||||
|
||||
node-fetch@2.7.0(encoding@0.1.13):
|
||||
dependencies:
|
||||
whatwg-url: 5.0.0
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
import { tmpdir } from "os"
|
||||
import { join } from "path"
|
||||
import { HttpClient } from "@actions/http-client"
|
||||
import { addPath } from "envosman"
|
||||
import { execaSync } from "execa"
|
||||
import { writeFile } from "fs/promises"
|
||||
import { DownloaderHelper } from "node-downloader-helper"
|
||||
import { dirname } from "patha"
|
||||
import which from "which"
|
||||
import { rcOptions } from "../cli-options.js"
|
||||
|
@ -31,18 +29,16 @@ export async function setupBrew(_version: string, _setupDir: string, _arch: stri
|
|||
}
|
||||
|
||||
// download the installation script
|
||||
const installerPath = join(tmpdir(), "install-brew.sh")
|
||||
|
||||
const http = new HttpClient("setup-brew")
|
||||
const response = await http.get("https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh")
|
||||
if (response.message.statusCode !== 200) {
|
||||
throw new Error(`Failed to download brew installation script: ${response.message.statusCode}`)
|
||||
}
|
||||
|
||||
await writeFile(installerPath, await response.readBody())
|
||||
const dl = new DownloaderHelper("https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh", tmpdir(), {
|
||||
fileName: "install-brew.sh",
|
||||
})
|
||||
dl.on("error", (err) => {
|
||||
throw new Error(`Failed to download the brew installer script: ${err}`)
|
||||
})
|
||||
await dl.start()
|
||||
|
||||
// brew installation is not thread-safe
|
||||
execaSync("/bin/bash", [installerPath], {
|
||||
execaSync("/bin/bash", [dl.getDownloadPath()], {
|
||||
stdio: "inherit",
|
||||
env: {
|
||||
NONINTERACTIVE: "1",
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { info } from "console"
|
||||
import { tmpdir } from "os"
|
||||
import { join } from "path"
|
||||
import { HttpClient } from "@actions/http-client"
|
||||
import { execRoot } from "admina"
|
||||
import { addPath } from "envosman"
|
||||
import { chmod, writeFile } from "fs/promises"
|
||||
import { chmod, readFile, writeFile } from "fs/promises"
|
||||
import { DownloaderHelper } from "node-downloader-helper"
|
||||
import { aptTimeout, hasNala, installAptPack, isAptPackRegexInstalled } from "setup-apt"
|
||||
import { rcOptions } from "../cli-options.js"
|
||||
import { DEFAULT_TIMEOUT } from "../installTool.js"
|
||||
|
@ -24,12 +24,12 @@ export async function setupLLVMApt(
|
|||
const installationFolder = `/usr/lib/llvm-${majorVersion}`
|
||||
|
||||
// download the installation script
|
||||
const http = new HttpClient("setup-llvm")
|
||||
const response = await http.get("https://apt.llvm.org/llvm.sh")
|
||||
if (response.message.statusCode !== 200) {
|
||||
throw new Error(`Failed to download LLVM installation script: ${response.message.statusCode}`)
|
||||
}
|
||||
const installerScript = await response.readBody()
|
||||
const dl = new DownloaderHelper("https://apt.llvm.org/llvm.sh", tmpdir(), { fileName: "llvm.sh" })
|
||||
dl.on("error", (err) => {
|
||||
throw new Error(`Failed to download the LLVM installer script: ${err}`)
|
||||
})
|
||||
await dl.start()
|
||||
const installerScript = await readFile(dl.getDownloadPath(), "utf-8")
|
||||
|
||||
const installerPath = join(tmpdir(), "llvm-setup-cpp.sh")
|
||||
const neededPackages = await patchAptLLVMScript(
|
||||
|
|
Loading…
Reference in New Issue