mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2026-04-04 05:23:23 +08:00
Fix issue with using zstd long range mode on ubuntu-16.04
This commit is contained in:
32
packages/cache/src/internal/tar.ts
vendored
32
packages/cache/src/internal/tar.ts
vendored
@@ -41,10 +41,18 @@ export async function extractTar(
|
||||
// --d: Decompress.
|
||||
// --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
|
||||
// Using 30 here because we also support 32-bit self-hosted runners.
|
||||
function getProg(): string[] {
|
||||
switch (compressionMethod) {
|
||||
case CompressionMethod.Zstd:
|
||||
return ['--use-compress-program', 'zstd -d --long=30']
|
||||
case CompressionMethod.ZstdOld:
|
||||
return ['--use-compress-program', 'zstd -d']
|
||||
default:
|
||||
return ['-z']
|
||||
}
|
||||
}
|
||||
const args = [
|
||||
...(compressionMethod === CompressionMethod.Zstd
|
||||
? ['--use-compress-program', 'zstd -d --long=30']
|
||||
: ['-z']),
|
||||
...getProg(),
|
||||
'-xf',
|
||||
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
||||
'-P',
|
||||
@@ -66,14 +74,24 @@ export async function createTar(
|
||||
path.join(archiveFolder, manifestFilename),
|
||||
sourceDirectories.join('\n')
|
||||
)
|
||||
const workingDirectory = getWorkingDirectory()
|
||||
|
||||
// -T#: Compress using # working thread. If # is 0, attempt to detect and use the number of physical CPU cores.
|
||||
// --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
|
||||
// Using 30 here because we also support 32-bit self-hosted runners.
|
||||
const workingDirectory = getWorkingDirectory()
|
||||
// Long range mode is added to zstd in v1.3.2 release, so we will not use --long in older version of zstd.
|
||||
function getProg(): string[] {
|
||||
switch (compressionMethod) {
|
||||
case CompressionMethod.Zstd:
|
||||
return ['--use-compress-program', 'zstd -T0 --long=30']
|
||||
case CompressionMethod.ZstdOld:
|
||||
return ['--use-compress-program', 'zstd -T0']
|
||||
default:
|
||||
return ['-z']
|
||||
}
|
||||
}
|
||||
const args = [
|
||||
...(compressionMethod === CompressionMethod.Zstd
|
||||
? ['--use-compress-program', 'zstd -T0 --long=30']
|
||||
: ['-z']),
|
||||
...getProg(),
|
||||
'-cf',
|
||||
cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
||||
'-P',
|
||||
|
||||
Reference in New Issue
Block a user