mirror of https://github.com/actions/toolkit
bsd + zstd fallback implementation
parent
6349c3ca3a
commit
db3517fe3b
|
@ -54,7 +54,7 @@ function getWorkingDirectory(): string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Common function for extractTar and listTar to get the compression method
|
// Common function for extractTar and listTar to get the compression method
|
||||||
async function getCompressionProgram(compressionMethod: CompressionMethod): string[] {
|
async function getCompressionProgram(compressionMethod: CompressionMethod): Promise<string[]> {
|
||||||
// -d: Decompress.
|
// -d: Decompress.
|
||||||
// unzstd is equivalent to 'zstd -d'
|
// unzstd is equivalent to 'zstd -d'
|
||||||
// --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
|
// --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
|
||||||
|
@ -90,7 +90,7 @@ export async function listTar(
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const args = [
|
const args = [
|
||||||
'-tf',
|
'-tf',
|
||||||
...getCompressionProgram(compressionMethod),
|
...(await getCompressionProgram(compressionMethod)),
|
||||||
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
||||||
'-P'
|
'-P'
|
||||||
]
|
]
|
||||||
|
@ -106,7 +106,7 @@ export async function extractTar(
|
||||||
await io.mkdirP(workingDirectory)
|
await io.mkdirP(workingDirectory)
|
||||||
const args = [
|
const args = [
|
||||||
'-xf',
|
'-xf',
|
||||||
...getCompressionProgram(compressionMethod),
|
...(await getCompressionProgram(compressionMethod)),
|
||||||
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
||||||
'-P',
|
'-P',
|
||||||
'-C',
|
'-C',
|
||||||
|
@ -134,7 +134,7 @@ export async function createTar(
|
||||||
// --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
|
// --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.
|
// Using 30 here because we also support 32-bit self-hosted runners.
|
||||||
// Long range mode is added to zstd in v1.3.2 release, so we will not use --long in older version of zstd.
|
// Long range mode is added to zstd in v1.3.2 release, so we will not use --long in older version of zstd.
|
||||||
async function getCompressionProgram(): string[] {
|
async function getCompressionProgram(): Promise<string[]> {
|
||||||
const tarPath = await getTarPath([])
|
const tarPath = await getTarPath([])
|
||||||
const BSD_TAR_ZSTD = IS_WINDOWS && tarPath === SystemTarPathOnWindows
|
const BSD_TAR_ZSTD = IS_WINDOWS && tarPath === SystemTarPathOnWindows
|
||||||
switch (compressionMethod) {
|
switch (compressionMethod) {
|
||||||
|
@ -168,7 +168,7 @@ export async function createTar(
|
||||||
workingDirectory.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
workingDirectory.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
||||||
'--files-from',
|
'--files-from',
|
||||||
manifestFilename,
|
manifestFilename,
|
||||||
...getCompressionProgram(),
|
...(await getCompressionProgram()),
|
||||||
cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue