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'):
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")

View File

@ -75,7 +75,7 @@ def setup_parser(subparser):
'--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',

View File

@ -1403,7 +1403,7 @@ def do_install(self,
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)

View File

@ -198,6 +198,9 @@ def test_buildcache(mock_archive, tmpdir):
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():