1
0
Fork 0

Fix tar tests

bishal-change
Lovepreet Singh 2022-11-17 08:53:46 +00:00
parent 5f89653f1b
commit ea9856079f
2 changed files with 14 additions and 13 deletions

View File

@ -149,17 +149,17 @@ test('zstd create tar', async () => {
`"${tarPath}"`,
[
'--posix',
'--use-compress-program',
IS_WINDOWS ? 'zstd -T0 --long=30' : 'zstdmt --long=30',
'-cf',
IS_WINDOWS ? CacheFilename.Zstd.replace(/\\/g, '/') : CacheFilename.Zstd,
'--exclude',
IS_WINDOWS ? CacheFilename.Zstd.replace(/\\/g, '/') : CacheFilename.Zstd,
'-P',
'-C',
IS_WINDOWS ? workspace?.replace(/\\/g, '/') : workspace,
'--files-from',
'manifest.txt'
'manifest.txt',
'--use-compress-program',
IS_WINDOWS ? 'zstd -T0 --long=30' : 'zstdmt --long=30',
'-cf',
IS_WINDOWS ? CacheFilename.Zstd.replace(/\\/g, '/') : CacheFilename.Zstd
]
.concat(IS_WINDOWS ? ['--force-local'] : [])
.concat(IS_MAC ? ['--delay-directory-restore'] : []),
@ -187,16 +187,16 @@ test('gzip create tar', async () => {
`"${tarPath}"`,
[
'--posix',
'-z',
'-cf',
IS_WINDOWS ? CacheFilename.Gzip.replace(/\\/g, '/') : CacheFilename.Gzip,
'--exclude',
IS_WINDOWS ? CacheFilename.Gzip.replace(/\\/g, '/') : CacheFilename.Gzip,
'-P',
'-C',
IS_WINDOWS ? workspace?.replace(/\\/g, '/') : workspace,
'--files-from',
'manifest.txt'
'manifest.txt',
'-z',
'-cf',
IS_WINDOWS ? CacheFilename.Gzip.replace(/\\/g, '/') : CacheFilename.Gzip,
]
.concat(IS_WINDOWS ? ['--force-local'] : [])
.concat(IS_MAC ? ['--delay-directory-restore'] : []),
@ -281,3 +281,4 @@ test('gzip list tar', async () => {
{cwd: undefined}
)
})

View File

@ -69,13 +69,12 @@ async function getCompressionProgram(compressionMethod: CompressionMethod): Prom
return [
'--use-compress-program',
IS_WINDOWS ? 'zstd -d --long=30' : 'unzstd --long=30',
'-tf'
]
case CompressionMethod.ZstdWithoutLong:
if (BSD_TAR_ZSTD) {
return ['a'] // auto-detect compression
}
return ['--use-compress-program', IS_WINDOWS ? 'zstd -d' : 'unzstd', '-tf']
return ['--use-compress-program', IS_WINDOWS ? 'zstd -d' : 'unzstd']
default:
return ['-z']
}
@ -87,6 +86,7 @@ export async function listTar(
): Promise<void> {
const args = [
...(await getCompressionProgram(compressionMethod)),
'-tf',
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
'-P'
]
@ -101,8 +101,8 @@ export async function extractTar(
const workingDirectory = getWorkingDirectory()
await io.mkdirP(workingDirectory)
const args = [
'-xf',
...(await getCompressionProgram(compressionMethod)),
'-xf',
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
'-P',
'-C',
@ -153,7 +153,7 @@ export async function createTar(
}
return ['--use-compress-program', IS_WINDOWS ? 'zstd -T0' : 'zstdmt', '-cf']
default:
return ['-z']
return ['-z', '-cf']
}
}
const args = [