move binary indices are stored into the misc_cache (#22500)
Remote buildcache indices need to be stored in a place that does not require writing to the Spack prefix. Move them from the install_tree to the misc_cache.
This commit is contained in:
parent
79193dc37c
commit
f67d4774ea
@ -37,13 +37,11 @@
|
||||
import spack.mirror
|
||||
import spack.util.url as url_util
|
||||
import spack.util.web as web_util
|
||||
from spack.caches import misc_cache_location
|
||||
from spack.spec import Spec
|
||||
from spack.stage import Stage
|
||||
|
||||
|
||||
#: default root, relative to the Spack install path
|
||||
default_binary_index_root = os.path.join(spack.paths.opt_path, 'spack')
|
||||
|
||||
_build_cache_relative_path = 'build_cache'
|
||||
_build_cache_keys_relative_path = '_pgp'
|
||||
|
||||
@ -67,9 +65,8 @@ class BinaryCacheIndex(object):
|
||||
mean we should have paid the price to update the cache earlier?
|
||||
"""
|
||||
|
||||
def __init__(self, cache_root=None):
|
||||
self._cache_root = cache_root or default_binary_index_root
|
||||
self._index_cache_root = os.path.join(self._cache_root, 'indices')
|
||||
def __init__(self, cache_root):
|
||||
self._index_cache_root = cache_root
|
||||
|
||||
# the key associated with the serialized _local_index_cache
|
||||
self._index_contents_key = 'contents.json'
|
||||
@ -440,13 +437,15 @@ def _fetch_and_cache_index(self, mirror_url, expect_hash=None):
|
||||
return True
|
||||
|
||||
|
||||
def binary_index_location():
|
||||
"""Set up a BinaryCacheIndex for remote buildcache dbs in the user's homedir."""
|
||||
cache_root = os.path.join(misc_cache_location(), 'indices')
|
||||
return spack.util.path.canonicalize_path(cache_root)
|
||||
|
||||
|
||||
def _binary_index():
|
||||
"""Get the singleton store instance."""
|
||||
cache_root = spack.config.get(
|
||||
'config:binary_index_root', default_binary_index_root)
|
||||
cache_root = spack.util.path.canonicalize_path(cache_root)
|
||||
|
||||
return BinaryCacheIndex(cache_root)
|
||||
return BinaryCacheIndex(binary_index_location())
|
||||
|
||||
|
||||
#: Singleton binary_index instance
|
||||
|
@ -17,7 +17,7 @@
|
||||
import spack.util.path
|
||||
|
||||
|
||||
def _misc_cache():
|
||||
def misc_cache_location():
|
||||
"""The ``misc_cache`` is Spack's cache for small data.
|
||||
|
||||
Currently the ``misc_cache`` stores indexes for virtual dependency
|
||||
@ -27,7 +27,11 @@ def _misc_cache():
|
||||
if not path:
|
||||
path = os.path.join(spack.paths.user_config_path, 'cache')
|
||||
path = spack.util.path.canonicalize_path(path)
|
||||
return path
|
||||
|
||||
|
||||
def _misc_cache():
|
||||
path = misc_cache_location()
|
||||
return spack.util.file_cache.FileCache(path)
|
||||
|
||||
|
||||
@ -35,7 +39,7 @@ def _misc_cache():
|
||||
misc_cache = llnl.util.lang.Singleton(_misc_cache)
|
||||
|
||||
|
||||
def _fetch_cache():
|
||||
def fetch_cache_location():
|
||||
"""Filesystem cache of downloaded archives.
|
||||
|
||||
This prevents Spack from repeatedly fetch the same files when
|
||||
@ -45,7 +49,11 @@ def _fetch_cache():
|
||||
if not path:
|
||||
path = os.path.join(spack.paths.var_path, "cache")
|
||||
path = spack.util.path.canonicalize_path(path)
|
||||
return path
|
||||
|
||||
|
||||
def _fetch_cache():
|
||||
path = fetch_cache_location()
|
||||
return spack.fetch_strategy.FsCache(path)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user