@@ -15,6 +15,9 @@ class MirrorError(RuntimeError):
1515class Mirrors :
1616 """Manage the definition of mirrors in a recipe."""
1717
18+ KEY_STORE_DIR = 'key_store'
19+ MIRRORS_YAML = 'mirrors.yaml'
20+
1821 def __init__ (self , system_config_root : pathlib .Path , cmdline_cache : Optional [str ] = None ):
1922 """Configure mirrors from both the system 'mirror.yaml' file and the command line."""
2023
@@ -92,7 +95,14 @@ def _check_mirrors(self):
9295 f"Could not reach the mirror url '{ url } '. "
9396 f"Check the url listed in mirrors.yaml in system config. \n { e .reason } " )
9497
95- def create_spack_mirrors_yaml (self , dest : pathlib .Path ):
98+ def setup_configs (self , config_root : pathlib .Path ):
99+ """Setup all mirror configs in the given config_root."""
100+
101+ self ._key_setup (config_root / self .KEY_STORE_DIR )
102+ self ._create_spack_mirrors_yaml (config_root / self .MIRRORS_YAML )
103+ self ._create_bootstrap_configs (config_root )
104+
105+ def _create_spack_mirrors_yaml (self , dest : pathlib .Path ):
96106 """Generate the mirrors.yaml for our build directory."""
97107
98108 raw = {"mirrors" : {}}
@@ -109,7 +119,7 @@ def create_spack_mirrors_yaml(self, dest: pathlib.Path):
109119 with dest .open ("w" ) as file :
110120 yaml .dump (raw , file , default_flow_style = False )
111121
112- def create_bootstrap_configs (self , config_root : pathlib .Path ):
122+ def _create_bootstrap_configs (self , config_root : pathlib .Path ):
113123 """Create the bootstrap.yaml and bootstrap metadata dirs in our build dir."""
114124
115125 if not self .bootstrap_mirrors :
@@ -145,7 +155,7 @@ def create_bootstrap_configs(self, config_root: pathlib.Path):
145155 with (config_root / 'bootstrap.yaml' ).open ('w' ) as file :
146156 yaml .dump (bootstrap_yaml , file , default_flow_style = False )
147157
148- def key_setup (self , key_store : pathlib .Path ):
158+ def _key_setup (self , key_store : pathlib .Path ):
149159 """Validate mirror keys, relocate to key_store, and update mirror config with new key paths."""
150160
151161 for mirror in self .mirrors :
0 commit comments