summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGreg Becker <becker33@llnl.gov>2018-11-09 00:59:28 -0800
committerTodd Gamblin <tgamblin@llnl.gov>2018-11-09 00:59:28 -0800
commit988d37757f70f8e580db9091f5c9cc2e32ba33d5 (patch)
tree296ff32b7d9a4b93cf2363db7bf3c3de21509cde /lib
parent423d3e75ab403378d8cea617ac7d4a804601b1b7 (diff)
downloadspack-988d37757f70f8e580db9091f5c9cc2e32ba33d5.tar.gz
spack-988d37757f70f8e580db9091f5c9cc2e32ba33d5.tar.bz2
spack-988d37757f70f8e580db9091f5c9cc2e32ba33d5.tar.xz
spack-988d37757f70f8e580db9091f5c9cc2e32ba33d5.zip
buildcache: update `spack install` to use build cache by default (#9772)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/binary_distribution.py11
-rw-r--r--lib/spack/spack/cmd/install.py2
-rw-r--r--lib/spack/spack/package.py2
-rw-r--r--lib/spack/spack/test/packaging.py3
4 files changed, 11 insertions, 7 deletions
diff --git a/lib/spack/spack/binary_distribution.py b/lib/spack/spack/binary_distribution.py
index 71e426346b..5f36677980 100644
--- a/lib/spack/spack/binary_distribution.py
+++ b/lib/spack/spack/binary_distribution.py
@@ -538,11 +538,12 @@ def get_specs(force=False):
if url.startswith('file'):
mirror = url.replace('file://', '') + '/build_cache'
tty.msg("Finding buildcaches in %s" % mirror)
- files = os.listdir(mirror)
- for file in files:
- if re.search('spec.yaml', file):
- link = 'file://' + mirror + '/' + file
- urls.add(link)
+ if os.path.exists(mirror):
+ files = os.listdir(mirror)
+ for file in files:
+ if re.search('spec.yaml', file):
+ link = 'file://' + mirror + '/' + file
+ urls.add(link)
else:
tty.msg("Finding buildcaches on %s" % url)
p, links = spider(url + "/build_cache")
diff --git a/lib/spack/spack/cmd/install.py b/lib/spack/spack/cmd/install.py
index d1aaf20f1b..26e77b474a 100644
--- a/lib/spack/spack/cmd/install.py
+++ b/lib/spack/spack/cmd/install.py
@@ -75,7 +75,7 @@ the dependencies"""
'--dont-restage', action='store_true',
help="if a partial install is detected, don't delete prior state")
subparser.add_argument(
- '--use-cache', action='store_true', dest='use_cache',
+ '--no-cache', action='store_false', dest='use_cache',
help="check for pre-built Spack packages in mirrors")
subparser.add_argument(
'--show-log-on-error', action='store_true',
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index d164f9e010..279ed89d04 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -1403,7 +1403,7 @@ class PackageBase(with_metaclass(PackageMeta, PackageViewMixin, object)):
tty.msg(colorize('@*{Installing} @*g{%s}' % self.name))
- if kwargs.get('use_cache', False):
+ if kwargs.get('use_cache', True):
if self.try_install_from_binary_cache(explicit):
tty.msg('Successfully installed %s from binary cache'
% self.name)
diff --git a/lib/spack/spack/test/packaging.py b/lib/spack/spack/test/packaging.py
index 2b673f217e..ae7d7678ae 100644
--- a/lib/spack/spack/test/packaging.py
+++ b/lib/spack/spack/test/packaging.py
@@ -198,6 +198,9 @@ echo $PATH"""
shutil.rmtree(mirror_path)
stage.destroy()
+ # Remove cached binary specs since we deleted the mirror
+ bindist._cached_specs = None
+
def test_relocate_text(tmpdir):
with tmpdir.as_cwd():