buildcache: update spack install to use build cache by default (#9772)

This commit is contained in:
Greg Becker 2018-11-09 00:59:28 -08:00 committed by Todd Gamblin
parent 423d3e75ab
commit 988d37757f
4 changed files with 11 additions and 7 deletions

View File

@ -538,11 +538,12 @@ def get_specs(force=False):
if url.startswith('file'): if url.startswith('file'):
mirror = url.replace('file://', '') + '/build_cache' mirror = url.replace('file://', '') + '/build_cache'
tty.msg("Finding buildcaches in %s" % mirror) tty.msg("Finding buildcaches in %s" % mirror)
files = os.listdir(mirror) if os.path.exists(mirror):
for file in files: files = os.listdir(mirror)
if re.search('spec.yaml', file): for file in files:
link = 'file://' + mirror + '/' + file if re.search('spec.yaml', file):
urls.add(link) link = 'file://' + mirror + '/' + file
urls.add(link)
else: else:
tty.msg("Finding buildcaches on %s" % url) tty.msg("Finding buildcaches on %s" % url)
p, links = spider(url + "/build_cache") p, links = spider(url + "/build_cache")

View File

@ -75,7 +75,7 @@ def setup_parser(subparser):
'--dont-restage', action='store_true', '--dont-restage', action='store_true',
help="if a partial install is detected, don't delete prior state") help="if a partial install is detected, don't delete prior state")
subparser.add_argument( 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") help="check for pre-built Spack packages in mirrors")
subparser.add_argument( subparser.add_argument(
'--show-log-on-error', action='store_true', '--show-log-on-error', action='store_true',

View File

@ -1403,7 +1403,7 @@ def do_install(self,
tty.msg(colorize('@*{Installing} @*g{%s}' % self.name)) 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): if self.try_install_from_binary_cache(explicit):
tty.msg('Successfully installed %s from binary cache' tty.msg('Successfully installed %s from binary cache'
% self.name) % self.name)

View File

@ -198,6 +198,9 @@ def test_buildcache(mock_archive, tmpdir):
shutil.rmtree(mirror_path) shutil.rmtree(mirror_path)
stage.destroy() stage.destroy()
# Remove cached binary specs since we deleted the mirror
bindist._cached_specs = None
def test_relocate_text(tmpdir): def test_relocate_text(tmpdir):
with tmpdir.as_cwd(): with tmpdir.as_cwd():