URLFetchStrategy now contains exploding tarballs.
This commit is contained in:
parent
887c29ddc4
commit
37bdbdd990
1 changed files with 19 additions and 1 deletions
|
@ -45,7 +45,7 @@
|
|||
import shutil
|
||||
from functools import wraps
|
||||
import llnl.util.tty as tty
|
||||
|
||||
from llnl.util.filesystem import *
|
||||
import spack
|
||||
import spack.error
|
||||
import spack.util.crypto as crypto
|
||||
|
@ -205,8 +205,26 @@ def expand(self):
|
|||
"Failed on expand() for URL %s" % self.url)
|
||||
|
||||
decompress = decompressor_for(self.archive_file)
|
||||
|
||||
# Expand all tarballs in their own directory to contain
|
||||
# exploding tarballs.
|
||||
tarball_container = os.path.join(self.stage.path, "spack-expanded-archive")
|
||||
mkdirp(tarball_container)
|
||||
os.chdir(tarball_container)
|
||||
decompress(self.archive_file)
|
||||
|
||||
# If the tarball *didn't* explode, move
|
||||
# the expanded directory up & remove the protector directory.
|
||||
files = os.listdir(tarball_container)
|
||||
if len(files) == 1:
|
||||
expanded_dir = os.path.join(tarball_container, files[0])
|
||||
if os.path.isdir(expanded_dir):
|
||||
shutil.move(expanded_dir, self.stage.path)
|
||||
os.rmdir(tarball_container)
|
||||
|
||||
# Set the wd back to the stage when done.
|
||||
self.stage.chdir()
|
||||
|
||||
|
||||
def archive(self, destination):
|
||||
"""Just moves this archive to the destination."""
|
||||
|
|
Loading…
Reference in a new issue