summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2021-03-23 20:29:13 +0100
committerTodd Gamblin <tgamblin@llnl.gov>2021-05-22 11:51:20 -0700
commitf1c7402c64c0e3b7049517ee2d8f8be7fda9679b (patch)
treeb9d15523d106e9353a546142e6d2ae50b4ae4935 /lib
parent16f7a02654095801dfd67cd647136c6466a9f73c (diff)
downloadspack-f1c7402c64c0e3b7049517ee2d8f8be7fda9679b.tar.gz
spack-f1c7402c64c0e3b7049517ee2d8f8be7fda9679b.tar.bz2
spack-f1c7402c64c0e3b7049517ee2d8f8be7fda9679b.tar.xz
spack-f1c7402c64c0e3b7049517ee2d8f8be7fda9679b.zip
bootstrap: account for platform specific configuration scopes (#22489)
This change accounts for platform specific configuration scopes, like ~/.spack/linux, during bootstrapping. These scopes were previously not accounted for and that was causing issues e.g. when searching for compilers. (cherry picked from commit 413c422e53843a9e33d7b77a8c44dcfd4bf701be)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/bootstrap.py25
1 files changed, 18 insertions, 7 deletions
diff --git a/lib/spack/spack/bootstrap.py b/lib/spack/spack/bootstrap.py
index 93e79fbe71..52bd810e89 100644
--- a/lib/spack/spack/bootstrap.py
+++ b/lib/spack/spack/bootstrap.py
@@ -171,16 +171,27 @@ def get_executable(exe, spec=None, install=False):
_raise_error(exe, spec)
+def _bootstrap_config_scopes():
+ config_scopes = []
+ for name, path in spack.config.configuration_paths:
+ platform = spack.architecture.platform().name
+ platform_scope = spack.config.ConfigScope(
+ '/'.join([name, platform]), os.path.join(path, platform)
+ )
+ generic_scope = spack.config.ConfigScope(name, path)
+ config_scopes.extend([generic_scope, platform_scope])
+ msg = '[BOOSTRAP CONFIG SCOPE] name={0}, path={1}'
+ tty.debug(msg.format(generic_scope.name, generic_scope.path))
+ tty.debug(msg.format(platform_scope.name, platform_scope.path))
+ return config_scopes
+
+
@contextlib.contextmanager
def ensure_bootstrap_configuration():
- # Default configuration scopes excluding command
- # line and builtin
- config_scopes = [
- spack.config.ConfigScope(name, path)
- for name, path in spack.config.configuration_paths
- ]
-
with spack.architecture.use_platform(spack.architecture.real_platform()):
+ # Default configuration scopes excluding command line and builtin
+ # but accounting for platform specific scopes
+ config_scopes = _bootstrap_config_scopes()
with spack.config.use_configuration(*config_scopes):
with spack.repo.use_repositories(spack.paths.packages_path):
with spack.store.use_store(spack.paths.user_bootstrap_store):