tar: add compress deps (#30641)

* remove spack dependency from package

* tar: fix compression programs, use pigz by default instead of gzip on -z
This commit is contained in:
Harmen Stoppels 2022-05-19 17:15:13 +02:00 committed by GitHub
parent 8fe39be3df
commit c3be777ea8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 3 deletions

View File

@ -16,7 +16,5 @@ class Gzip(AutotoolsPackage):
version('1.11', sha256='3e8a0e0c45bad3009341dce17d71536c4c655d9313039021ce7554a26cd50ed9')
version('1.10', sha256='c91f74430bf7bc20402e1f657d0b252cb80aa66ba333a25704512af346633c68')
depends_on('gmake', type='build')
# Gzip makes a recursive symlink if built in-source
build_directory = 'spack-build'

View File

@ -26,8 +26,18 @@ class Tar(AutotoolsPackage, GNUMirrorPackage):
version('1.29', sha256='cae466e6e58c7292355e7080248f244db3a4cf755f33f4fa25ca7f9a7ed09af0')
version('1.28', sha256='6a6b65bac00a127a508533c604d5bf1a3d40f82707d56f20cefd38a05e8237de')
# A saner default than gzip?
variant('zip', default='pigz', values=('gzip', 'pigz'), description='Default compression program for tar -z')
depends_on('iconv')
# Compression
depends_on('gzip', type='run', when='zip=gzip')
depends_on('pigz', type='run', when='zip=pigz')
depends_on('zstd+programs', type='run', when='@1.31:')
depends_on('xz', type='run') # for xz/lzma
depends_on('bzip2', type='run')
patch('tar-pgi.patch', when='@1.29')
patch('config-pgi.patch', when='@:1.29')
patch('se-selinux.patch', when='@:1.29')
@ -47,6 +57,23 @@ def determine_version(cls, exe):
return match.group(1) if match else None
def configure_args(self):
return [
# Note: compression programs are passed by abs path,
# so that tar can locate them when invoked without spack load.
args = [
'--with-libiconv-prefix={0}'.format(self.spec['iconv'].prefix),
'--with-xz={0}'.format(self.spec['xz'].prefix.bin.xz),
'--with-lzma={0}'.format(self.spec['xz'].prefix.bin.lzma),
'--with-bzip2={0}'.format(self.spec['bzip2'].prefix.bin.bzip2),
]
if '^zstd' in self.spec:
args.append('--with-zstd={0}'.format(self.spec['zstd'].prefix.bin.zstd))
# Choose gzip/pigz
zip = self.spec.variants['zip'].value
if zip == 'gzip':
gzip_path = self.spec['gzip'].prefix.bin.gzip
elif zip == 'pigz':
gzip_path = self.spec['pigz'].prefix.bin.pigz
args.append('--with-gzip={}'.format(gzip_path))
return args