Revert to gzip as the default buildcache compression as bzip2 is not always available. (#15412)
* Revert to gzip as the default buildcache compression as bzip2 is not always available. * Flake8
This commit is contained in:
parent
fd69994c68
commit
c7dda38826
@ -308,7 +308,7 @@ def build_tarball(spec, outdir, force=False, rel=False, unsigned=False,
|
|||||||
tmpdir = tempfile.mkdtemp()
|
tmpdir = tempfile.mkdtemp()
|
||||||
cache_prefix = build_cache_prefix(tmpdir)
|
cache_prefix = build_cache_prefix(tmpdir)
|
||||||
|
|
||||||
tarfile_name = tarball_name(spec, '.tar.bz2')
|
tarfile_name = tarball_name(spec, '.tar.gz')
|
||||||
tarfile_dir = os.path.join(cache_prefix, tarball_directory_name(spec))
|
tarfile_dir = os.path.join(cache_prefix, tarball_directory_name(spec))
|
||||||
tarfile_path = os.path.join(tarfile_dir, tarfile_name)
|
tarfile_path = os.path.join(tarfile_dir, tarfile_name)
|
||||||
spackfile_path = os.path.join(
|
spackfile_path = os.path.join(
|
||||||
@ -377,8 +377,8 @@ def build_tarball(spec, outdir, force=False, rel=False, unsigned=False,
|
|||||||
shutil.rmtree(tmpdir)
|
shutil.rmtree(tmpdir)
|
||||||
tty.die(e)
|
tty.die(e)
|
||||||
|
|
||||||
# create compressed tarball of the install prefix
|
# create gzip compressed tarball of the install prefix
|
||||||
with closing(tarfile.open(tarfile_path, 'w:bz2')) as tar:
|
with closing(tarfile.open(tarfile_path, 'w:gz')) as tar:
|
||||||
tar.add(name='%s' % workdir,
|
tar.add(name='%s' % workdir,
|
||||||
arcname='%s' % os.path.basename(spec.prefix))
|
arcname='%s' % os.path.basename(spec.prefix))
|
||||||
# remove copy of install directory
|
# remove copy of install directory
|
||||||
@ -592,16 +592,16 @@ def extract_tarball(spec, filename, allow_root=False, unsigned=False,
|
|||||||
stagepath = os.path.dirname(filename)
|
stagepath = os.path.dirname(filename)
|
||||||
spackfile_name = tarball_name(spec, '.spack')
|
spackfile_name = tarball_name(spec, '.spack')
|
||||||
spackfile_path = os.path.join(stagepath, spackfile_name)
|
spackfile_path = os.path.join(stagepath, spackfile_name)
|
||||||
tarfile_name = tarball_name(spec, '.tar.bz2')
|
tarfile_name = tarball_name(spec, '.tar.gz')
|
||||||
tarfile_path = os.path.join(tmpdir, tarfile_name)
|
tarfile_path = os.path.join(tmpdir, tarfile_name)
|
||||||
specfile_name = tarball_name(spec, '.spec.yaml')
|
specfile_name = tarball_name(spec, '.spec.yaml')
|
||||||
specfile_path = os.path.join(tmpdir, specfile_name)
|
specfile_path = os.path.join(tmpdir, specfile_name)
|
||||||
|
|
||||||
with closing(tarfile.open(spackfile_path, 'r')) as tar:
|
with closing(tarfile.open(spackfile_path, 'r')) as tar:
|
||||||
tar.extractall(tmpdir)
|
tar.extractall(tmpdir)
|
||||||
# older buildcache tarfiles use gzip compression
|
# some buildcache tarfiles use bzip2 compression
|
||||||
if not os.path.exists(tarfile_path):
|
if not os.path.exists(tarfile_path):
|
||||||
tarfile_name = tarball_name(spec, '.tar.gz')
|
tarfile_name = tarball_name(spec, '.tar.bz2')
|
||||||
tarfile_path = os.path.join(tmpdir, tarfile_name)
|
tarfile_path = os.path.join(tmpdir, tarfile_name)
|
||||||
if not unsigned:
|
if not unsigned:
|
||||||
if os.path.exists('%s.asc' % specfile_path):
|
if os.path.exists('%s.asc' % specfile_path):
|
||||||
|
Loading…
Reference in New Issue
Block a user