-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
35309f1
commit f0d261f
Showing
1 changed file
with
35 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53551,6 +53551,12 @@ var tool_cache = __nccwpck_require__(5561); | |
var exec = __nccwpck_require__(7775); | ||
// EXTERNAL MODULE: ./node_modules/.pnpm/[email protected]/node_modules/undici/index.js | ||
var undici = __nccwpck_require__(968); | ||
;// CONCATENATED MODULE: external "stream/promises" | ||
const promises_namespaceObject = require("stream/promises"); | ||
;// CONCATENATED MODULE: external "fs/promises" | ||
const external_fs_promises_namespaceObject = require("fs/promises"); | ||
// EXTERNAL MODULE: external "crypto" | ||
var external_crypto_ = __nccwpck_require__(6113); | ||
// EXTERNAL MODULE: ./node_modules/.pnpm/[email protected]/node_modules/uuid/dist/index.js | ||
var dist = __nccwpck_require__(711); | ||
;// CONCATENATED MODULE: ./node_modules/.pnpm/[email protected]/node_modules/uuid/wrapper.mjs | ||
|
@@ -53565,12 +53571,6 @@ const validate = dist/* validate */.Gu; | |
const stringify = dist/* stringify */.Pz; | ||
const parse = dist/* parse */.Qc; | ||
|
||
;// CONCATENATED MODULE: external "stream/promises" | ||
const promises_namespaceObject = require("stream/promises"); | ||
;// CONCATENATED MODULE: external "fs/promises" | ||
const external_fs_promises_namespaceObject = require("fs/promises"); | ||
// EXTERNAL MODULE: external "crypto" | ||
var external_crypto_ = __nccwpck_require__(6113); | ||
;// CONCATENATED MODULE: ./src/integrity.js | ||
|
||
|
||
|
@@ -53582,10 +53582,13 @@ var external_crypto_ = __nccwpck_require__(6113); | |
|
||
|
||
|
||
function temp() { | ||
/** | ||
* @returns A unique path in the temporary directory | ||
*/ | ||
function getTempPath() { | ||
const tempDirectory = process.env['RUNNER_TEMP'] || ''; | ||
external_assert_default().ok(tempDirectory, 'Expected RUNNER_TEMP to be defined'); | ||
return tempDirectory; | ||
return external_path_default().join(tempDirectory, v4()); | ||
} | ||
|
||
/** | ||
|
@@ -53622,7 +53625,7 @@ async function sha256sum(file) { | |
*/ | ||
async function verifyGpgSig(keyFile, sig, file) { | ||
// Create a temporary keyring to avoid polluting the default keyring | ||
const keyring = external_path_default().join(temp(), v4() + '.gpg'); | ||
const keyring = getTempPath() + '.gpg'; | ||
await (0,external_fs_promises_namespaceObject.mkdir)(external_path_default().join(process.env['HOME'], '.gnupg'), { recursive: true, mode: '700' }); | ||
external_assert_default().ok( | ||
await (0,exec.exec)('gpg --no-default-keyring --keyring', [keyring, '--import', keyFile]) === 0, | ||
|
@@ -53679,7 +53682,6 @@ async function downloadToFile(url, file) { | |
} | ||
|
||
/** | ||
* | ||
* @param {string} version | ||
*/ | ||
function cleanVersion(version) { | ||
|
@@ -53694,21 +53696,21 @@ function cleanVersion(version) { | |
} | ||
|
||
/** | ||
* Returns the latest version of ffmpeg depending on wanted release type. | ||
* | ||
* @param {'git' | 'release'} version | ||
* @param {'git' | 'release'} releaseType | ||
* @returns {Promise<string>} | ||
*/ | ||
async function getToolVersion(version) { | ||
const prefix = version === 'git' ? '0.0.0-' : ''; | ||
async function getToolVersion(releaseType) { | ||
const platform = external_os_.platform(); | ||
if (platform === 'linux') { | ||
const readme = await downloadText(`https://johnvansickle.com/ffmpeg/${version}-readme.txt`); | ||
const readme = await downloadText(`https://johnvansickle.com/ffmpeg/${releaseType}-readme.txt`); | ||
return cleanVersion(readme.match(/version\: (.+)\n/)[1].trim()); | ||
} else if (platform === 'win32') { | ||
const ver = await downloadText(`https://www.gyan.dev/ffmpeg/builds/${version}-version`); | ||
const ver = await downloadText(`https://www.gyan.dev/ffmpeg/builds/${releaseType}-version`); | ||
return cleanVersion(ver.trim()); | ||
} else if (platform === 'darwin') { | ||
const res = await undici/* request */.WY(`https://evermeet.cx/ffmpeg/info/ffmpeg/${version === 'git' ? 'snapshot' : 'release'}`, { | ||
const res = await undici/* request */.WY(`https://evermeet.cx/ffmpeg/info/ffmpeg/${releaseType === 'git' ? 'snapshot' : 'release'}`, { | ||
maxRedirections: 5, | ||
}); | ||
const body = await res.body.json(); | ||
|
@@ -53727,7 +53729,7 @@ async function downloadLinux({ version, toolVersion, skipVerify }) { | |
const downloadPath = await tool_cache.downloadTool(tool); | ||
if (!skipVerify) { | ||
const hash = (await downloadText(sig)).trimStart().split(' ')[0].trim(); | ||
external_assert_default().strictEqual(await md5sum(downloadPath), hash, VERIFICATION_FAIL); | ||
external_assert_default().strictEqual(await md5sum(downloadPath), hash.toLowerCase(), VERIFICATION_FAIL); | ||
} | ||
const extractPath = await tool_cache.extractTar(downloadPath, void 0, 'x'); | ||
// Extract path contains a single directory | ||
|
@@ -53748,23 +53750,16 @@ async function downloadWindows({ version, toolVersion, skipVerify }) { | |
} else { | ||
tool = `https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-${version}-full_build.7z`; | ||
} | ||
const sig = tool + '.sha256'; | ||
const downloadPath = await tool_cache.downloadTool(tool); | ||
if (!skipVerify) { | ||
const hash = await downloadText(sig); | ||
external_assert_default().strictEqual(await sha256sum(downloadPath), hash, VERIFICATION_FAIL); | ||
const hash = await downloadText(tool + '.sha256'); | ||
external_assert_default().strictEqual(await sha256sum(downloadPath), hash.toLowerCase(), VERIFICATION_FAIL); | ||
} | ||
const extractPath = await tool_cache.extract7z(downloadPath, void 0, __nccwpck_require__.ab + "7zr.exe"); | ||
// Extract path contains a single directory | ||
const dirs = await (0,external_fs_promises_namespaceObject.readdir)(extractPath); | ||
const dir = external_path_default().join(extractPath, dirs.filter((name) => name.startsWith('ffmpeg-'))[0]); | ||
|
||
// Report the correct version (or git commit) so that caching can be effective | ||
if (version === 'git' || version === 'release') { | ||
const readme = await (0,external_fs_promises_namespaceObject.readFile)(external_path_default().join(dir, 'README.txt'), 'utf8'); | ||
version = readme.match(/Version\: (.+)\n/)[1].trim().replace(/-full_build-www\.gyan\.dev$/) || version; | ||
} | ||
|
||
return await tool_cache.cacheDir(external_path_default().join(dir, 'bin'), 'ffmpeg', toolVersion); | ||
} | ||
|
||
|
@@ -53773,6 +53768,9 @@ async function downloadWindows({ version, toolVersion, skipVerify }) { | |
*/ | ||
async function downloadMac({ version, toolVersion, skipVerify }) { | ||
external_assert_default().strictEqual(external_os_.arch(), 'x64', UNSUPPORTED_PLATFORM); | ||
// Mac ffmpeg and ffprobe binaries are in different archives that need to be | ||
// downloaded separately. We use .zip files because 7zip is not available on | ||
// macos runners. | ||
let ffmpeg; | ||
let ffprobe; | ||
if (version === 'git' || version === 'release') { | ||
|
@@ -53782,19 +53780,21 @@ async function downloadMac({ version, toolVersion, skipVerify }) { | |
ffmpeg = `https://evermeet.cx/ffmpeg/ffmpeg-${version}.zip`; | ||
ffprobe = `https://evermeet.cx/ffmpeg/ffprobe-${version}.zip`; | ||
} | ||
const ext = version === 'git' || version === 'release' ? '/sig' : '.sig'; | ||
const ffmpegSig = ffmpeg + ext; | ||
const ffprobeSig = ffprobe + ext; | ||
const ffmpegPath = external_path_default().join(temp(), `ffmpeg-${version}.zip`); | ||
const ffprobePath = external_path_default().join(temp(), `ffprobe-${version}.zip`); | ||
const ffmpegPath = getTempPath(); | ||
const ffprobePath = getTempPath(); | ||
// tc.downloadTool() is bugged and chokes on redirects | ||
await downloadToFile(ffmpeg, ffmpegPath); | ||
await downloadToFile(ffprobe, ffprobePath); | ||
if (!skipVerify) { | ||
const ffmpegSigFile = external_path_default().join(temp(), v4()); | ||
const ffprobeSigFile = external_path_default().join(temp(), v4()); | ||
const ext = version === 'git' || version === 'release' ? '/sig' : '.sig'; | ||
const ffmpegSig = ffmpeg + ext; | ||
const ffprobeSig = ffprobe + ext; | ||
const ffmpegSigFile = getTempPath(); | ||
const ffprobeSigFile = getTempPath(); | ||
await downloadToFile(ffmpegSig, ffmpegSigFile); | ||
await downloadToFile(ffprobeSig, ffprobeSigFile); | ||
const keyFile = external_path_default().join(temp(), v4()); | ||
const keyFile = getTempPath(); | ||
// Download the key to check the files' signatures | ||
await downloadToFile('https://evermeet.cx/ffmpeg/0x1A660874.asc', keyFile); | ||
external_assert_default().ok(await verifyGpgSig(keyFile, ffmpegSigFile, ffmpegPath), VERIFICATION_FAIL); | ||
external_assert_default().ok(await verifyGpgSig(keyFile, ffprobeSigFile, ffprobePath), VERIFICATION_FAIL); | ||
|
@@ -53804,7 +53804,7 @@ async function downloadMac({ version, toolVersion, skipVerify }) { | |
} | ||
const ffmpegExtractPath = await tool_cache.extractZip(ffmpegPath); | ||
const ffprobeExtractPath = await tool_cache.extractZip(ffprobePath); | ||
const combinedPath = external_path_default().join(temp(), v4()); | ||
const combinedPath = getTempPath(); | ||
await (0,external_fs_promises_namespaceObject.mkdir)(combinedPath); | ||
await (0,external_fs_promises_namespaceObject.rename)(external_path_default().join(ffmpegExtractPath, 'ffmpeg'), external_path_default().join(combinedPath, 'ffmpeg')); | ||
await (0,external_fs_promises_namespaceObject.rename)(external_path_default().join(ffprobeExtractPath, 'ffprobe'), external_path_default().join(combinedPath, 'ffprobe')); | ||
|