summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2015-06-01 09:58:52 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2015-06-01 10:25:58 -0700
commitd19538af07daca3359e0f5f22f554691f0a4ec71 (patch)
tree4bae5f95e5ff1f664df814ccf3b0b3c98eebff46 /lib
parent123778dec253d7a1e6bd03e26708a92320ce612a (diff)
downloadspack-d19538af07daca3359e0f5f22f554691f0a4ec71.tar.gz
spack-d19538af07daca3359e0f5f22f554691f0a4ec71.tar.bz2
spack-d19538af07daca3359e0f5f22f554691f0a4ec71.tar.xz
spack-d19538af07daca3359e0f5f22f554691f0a4ec71.zip
Fix #48: Ignore hidden files when deciding how to stage.
- Expanding archvies like MAGMA 1.6.2 creates extra hidden files that confuse Spack's staging mechanism. - Added a special case to ignore hidden files when checking whether the tarball exploded.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/fetch_strategy.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py
index c892e9ea26..e46ec74e09 100644
--- a/lib/spack/spack/fetch_strategy.py
+++ b/lib/spack/spack/fetch_strategy.py
@@ -220,13 +220,22 @@ class URLFetchStrategy(FetchStrategy):
os.chdir(tarball_container)
decompress(self.archive_file)
- # If the tarball *didn't* explode, move
- # the expanded directory up & remove the protector directory.
+ # Check for an exploding tarball, i.e. one that doesn't expand
+ # to a single directory. If the tarball *didn't* explode,
+ # move contents up & remove the container directory.
+ #
+ # NOTE: The tar program on Mac OS X will encode HFS metadata
+ # in hidden files, which can end up *alongside* a single
+ # top-level directory. We ignore hidden files to accomodate
+ # these "semi-exploding" tarballs.
files = os.listdir(tarball_container)
- if len(files) == 1:
- expanded_dir = os.path.join(tarball_container, files[0])
+ non_hidden = filter(lambda f: not f.startswith('.'), files)
+ if len(non_hidden) == 1:
+ expanded_dir = os.path.join(tarball_container, non_hidden[0])
if os.path.isdir(expanded_dir):
- shutil.move(expanded_dir, self.stage.path)
+ for f in files:
+ shutil.move(os.path.join(tarball_container, f),
+ os.path.join(self.stage.path, f))
os.rmdir(tarball_container)
# Set the wd back to the stage when done.