@@ -298,24 +298,15 @@ def generate(self, recipe):
298298 # that are defined for the target cluster.
299299 config_path = self .path / "config"
300300 config_path .mkdir (exist_ok = True )
301- system_config_path = pathlib .Path (recipe .system_config_path )
302-
303- # Copy the yaml files to the spack config path
304- for f_config in system_config_path .iterdir ():
305- # print warning if mirrors.yaml is found
306- if f_config .name in ["mirrors.yaml" ]:
307- self ._logger .error (
308- "mirrors.yaml have been removed from cluster configurations,"
309- " use the --cache option on stack-config instead."
310- )
311- raise RuntimeError ("Unsupported mirrors.yaml file in cluster configuration." )
301+ packages_path = config_path / "packages.yaml"
312302
313- # construct full file path
314- src = system_config_path / f_config .name
315- dst = config_path / f_config .name
316- # copy only files
317- if src .is_file ():
318- shutil .copy (src , dst )
303+ # the packages.yaml configuration that will be used when building all environments
304+ # - the system packages.yaml with gcc removed
305+ # - plus additional packages provided by the recipe
306+ global_packages_yaml = yaml .dump (recipe .packages ["global" ])
307+ global_packages_path = config_path / "packages.yaml"
308+ with global_packages_path .open ("w" ) as fid :
309+ fid .write (global_packages_yaml )
319310
320311 # generate a mirrors.yaml file if build caches have been configured
321312 if recipe .mirror :
@@ -324,21 +315,6 @@ def generate(self, recipe):
324315 with dst .open ("w" ) as fid :
325316 fid .write (cache .generate_mirrors_yaml (recipe .mirror ))
326317
327- # append recipe packages to packages.yaml
328- if recipe .packages :
329- system_packages = system_config_path / "packages.yaml"
330- packages_data = {}
331- if system_packages .is_file ():
332- # load system yaml
333- with system_packages .open () as fid :
334- raw = yaml .load (fid , Loader = yaml .Loader )
335- packages_data = raw ["packages" ]
336- packages_data .update (recipe .packages ["packages" ])
337- packages_yaml = yaml .dump ({"packages" : packages_data })
338- packages_path = config_path / "packages.yaml"
339- with packages_path .open ("w" ) as fid :
340- fid .write (packages_yaml )
341-
342318 # Add custom spack package recipes, configured via Spack repos.
343319 # Step 1: copy Spack repos to store_path where they will be used to
344320 # build the stack, and then be part of the upstream provided
@@ -362,7 +338,7 @@ def generate(self, recipe):
362338 repos .append (recipe .spack_repo )
363339
364340 # look for repos.yaml file in the system configuration
365- repo_yaml = system_config_path / "repos.yaml"
341+ repo_yaml = recipe . system_config_path / "repos.yaml"
366342 if repo_yaml .exists () and repo_yaml .is_file ():
367343 # open repos.yaml file and reat the list of repos
368344 with repo_yaml .open () as fid :
@@ -373,7 +349,7 @@ def generate(self, recipe):
373349
374350 # test each path
375351 for rel_path in P :
376- repo_path = (system_config_path / rel_path ).resolve ()
352+ repo_path = (recipe . system_config_path / rel_path ).resolve ()
377353 if spack_util .is_repo (repo_path ):
378354 repos .append (repo_path )
379355 self ._logger .debug (f"adding site spack package repo: { repo_path } " )
@@ -453,11 +429,12 @@ def generate(self, recipe):
453429 with (compiler_path / "Makefile" ).open (mode = "w" ) as f :
454430 f .write (compiler_files ["makefile" ])
455431
456- for name , yml in compiler_files ["config" ].items ():
432+ for name , files in compiler_files ["config" ].items ():
457433 compiler_config_path = compiler_path / name
458434 compiler_config_path .mkdir (exist_ok = True )
459- with (compiler_config_path / "spack.yaml" ).open (mode = "w" ) as f :
460- f .write (yml )
435+ for file , raw in files .items ():
436+ with (compiler_config_path / file ).open (mode = "w" ) as f :
437+ f .write (raw )
461438
462439 # generate the makefile and spack.yaml files that describe the environments
463440 environment_files = recipe .environment_files
@@ -479,14 +456,17 @@ def generate(self, recipe):
479456 generate_config_path .mkdir (exist_ok = True )
480457
481458 # write generate-config/Makefile
459+ # TODO: we differentiate between all and release compilers in order to generate modules
460+ # we have to do better, no?
482461 all_compilers = [x for x in recipe .compilers .keys ()]
483- release_compilers = [x for x in all_compilers if x != "bootstrap" ]
462+ # release_compilers = [x for x in all_compilers if x != "bootstrap"]
484463 with (generate_config_path / "Makefile" ).open ("w" ) as f :
485464 f .write (
486465 make_config_template .render (
487466 build_path = self .path .as_posix (),
488467 all_compilers = all_compilers ,
489- release_compilers = release_compilers ,
468+ #release_compilers=release_compilers,
469+ release_compilers = all_compilers ,
490470 verbose = False ,
491471 )
492472 )
0 commit comments