summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/spack/fetch_strategy.py16
-rw-r--r--lib/spack/spack/stage.py2
2 files changed, 15 insertions, 3 deletions
diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py
index fde2a8805e..3221716b91 100644
--- a/lib/spack/spack/fetch_strategy.py
+++ b/lib/spack/spack/fetch_strategy.py
@@ -828,10 +828,22 @@ class FsCache(object):
def __init__(self, root):
self.root = os.path.abspath(root)
- def store(self, copyCmd, relativeDst):
+ def store(self, fetcher, relativeDst):
+ unique = False
+ uidGroups = [['tag', 'commit'], ['digest'], ['revision']]
+ for grp in uidGroups:
+ try:
+ unique |= any(getattr(fetcher, x) for x in grp)
+ except AttributeError:
+ pass
+ if unique:
+ break
+ if not unique:
+ return
+
dst = join_path(self.root, relativeDst)
mkdirp(os.path.dirname(dst))
- copyCmd(dst)
+ fetcher.archive(dst)
def fetcher(self, targetPath, digest):
url = "file://" + join_path(self.root, targetPath)
diff --git a/lib/spack/spack/stage.py b/lib/spack/spack/stage.py
index f28934d10a..b08cce43b8 100644
--- a/lib/spack/spack/stage.py
+++ b/lib/spack/spack/stage.py
@@ -337,7 +337,7 @@ class Stage(object):
def cache_local(self):
- spack.cache.store(self.fetcher.archive, self.mirror_path)
+ spack.cache.store(self.fetcher, self.mirror_path)
def expand_archive(self):