diff options
author | Danny McClanahan <1305167+cosmicexplorer@users.noreply.github.com> | 2021-03-30 00:20:04 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-29 17:20:04 -0700 |
commit | f67d4774ea192810a60a642190a82a3583600569 (patch) | |
tree | 4853a780b3e6e0b184d2242f278100ae2045b268 /lib | |
parent | 79193dc37cd03d9b532683a78a3f3d2c54a9dd7a (diff) | |
download | spack-f67d4774ea192810a60a642190a82a3583600569.tar.gz spack-f67d4774ea192810a60a642190a82a3583600569.tar.bz2 spack-f67d4774ea192810a60a642190a82a3583600569.tar.xz spack-f67d4774ea192810a60a642190a82a3583600569.zip |
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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/binary_distribution.py | 21 | ||||
-rw-r--r-- | lib/spack/spack/caches.py | 12 |
2 files changed, 20 insertions, 13 deletions
diff --git a/lib/spack/spack/binary_distribution.py b/lib/spack/spack/binary_distribution.py index 99dfcd9292..c8477503b4 100644 --- a/lib/spack/spack/binary_distribution.py +++ b/lib/spack/spack/binary_distribution.py @@ -37,13 +37,11 @@ import spack.util.spack_yaml as syaml 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 @@ class BinaryCacheIndex(object): 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 diff --git a/lib/spack/spack/caches.py b/lib/spack/spack/caches.py index d06ce05525..9f99ab75ed 100644 --- a/lib/spack/spack/caches.py +++ b/lib/spack/spack/caches.py @@ -17,7 +17,7 @@ import spack.util.file_cache 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) |