5050HOST_INJECTIONS_LOCATION = "/cvmfs/software.eessi.io/host_injections/"
5151
5252# Make sure a single environment variable name is used for this throughout the hooks
53+ EESSI_IGNORE_A64FX_RUST1650_ENVVAR = "EESSI_IGNORE_LMOD_ERROR_A64FX_RUST1650"
5354EESSI_IGNORE_ZEN4_GCC1220_ENVVAR = "EESSI_IGNORE_LMOD_ERROR_ZEN4_GCC1220"
5455
5556STACK_REPROD_SUBDIR = 'reprod'
@@ -458,7 +459,14 @@ def parse_hook_bump_rust_version_in_2022b_for_a64fx(ec, eprefix):
458459 because version 1.65.0 has build issues.
459460 """
460461 cpu_target = get_eessi_envvar ('EESSI_SOFTWARE_SUBDIR' )
462+
461463 if cpu_target == CPU_TARGET_A64FX :
464+ # For Rust 1.65.0 itself we inject an error message in the module file
465+ if ec ['name' ] == 'Rust' and ec ['version' ] == '1.65.0' :
466+ errmsg = "Rust 1.65.0 is not supported on A64FX. Please use version 1.75.0 instead."
467+ ec ['modluafooter' ] = 'if (not os.getenv("%s")) then LmodError("%s") end' % (EESSI_IGNORE_A64FX_RUST1650_ENVVAR , errmsg )
468+
469+ # For any builds that have a build dependency on Rust 1.65.0, we bump the version to 1.75.0
462470 if is_gcccore_1220_based (ecname = ec ['name' ], ecversion = ec ['version' ],
463471 tcname = ec ['toolchain' ]['name' ], tcversion = ec ['toolchain' ]['version' ]):
464472
@@ -554,9 +562,7 @@ def pre_fetch_hook(self, *args, **kwargs):
554562 PRE_FETCH_HOOKS [ec .name ](self , * args , ** kwargs )
555563
556564 # Always trigger this one, regardless of self.name
557- cpu_target = get_eessi_envvar ('EESSI_SOFTWARE_SUBDIR' )
558- if cpu_target == CPU_TARGET_ZEN4 :
559- pre_fetch_hook_zen4_gcccore1220 (self , * args , ** kwargs )
565+ pre_fetch_hook_unsupported_modules (self , * args , ** kwargs )
560566
561567 # Always check the software installation path
562568 pre_fetch_hook_check_installation_path (self , * args , ** kwargs )
@@ -590,13 +596,28 @@ def pre_fetch_hook_check_installation_path(self, *args, **kwargs):
590596 )
591597
592598
593- def pre_fetch_hook_zen4_gcccore1220 (self , * args , ** kwargs ):
594- """Use --force --module-only if building a foss-2022b-based EasyConfig for Zen4.
595- This toolchain will not be supported on Zen4, so we will generate a modulefile
596- and have it print an LmodError.
599+ def is_unsupported_module (ec ):
597600 """
598- if is_gcccore_1220_based (ecname = self .name , ecversion = self .version , tcname = self .toolchain .name ,
599- tcversion = self .toolchain .version ):
601+ Determine if the given module is unsupported in EESSI, and hence if a dummy module needs to be built that just prints an LmodError.
602+ If true, this function returns the name of the environment variable that can be used to ignore that particular LmodError,
603+ as this is still required to actually build the module itself (EasyBuild will load/test the module).
604+ Otherwise, it returns False.
605+ """
606+ cpu_target = get_eessi_envvar ('EESSI_SOFTWARE_SUBDIR' )
607+
608+ if cpu_target == CPU_TARGET_A64FX and ec .name == 'Rust' and ec .version == '1.65.0' :
609+ return EESSI_IGNORE_A64FX_RUST1650_ENVVAR
610+ if cpu_target == CPU_TARGET_ZEN4 and is_gcccore_1220_based (ecname = ec .name , ecversion = ec .version , tcname = ec .toolchain .name , tcversion = ec .toolchain .version ):
611+ return EESSI_IGNORE_ZEN4_GCC1220_ENVVAR
612+ return False
613+
614+
615+ def pre_fetch_hook_unsupported_modules (self , * args , ** kwargs ):
616+ """Use --force --module-only if building a module for unsupported software,
617+ e.g. foss-2022b-based EasyConfigs for Zen4.
618+ We will generate a modulefile and have it print an LmodError.
619+ """
620+ if is_unsupported_module (self ):
600621 if hasattr (self , EESSI_MODULE_ONLY_ATTR ):
601622 raise EasyBuildError ("'self' already has attribute %s! Can't use pre_fetch hook." ,
602623 EESSI_MODULE_ONLY_ATTR )
@@ -612,20 +633,20 @@ def pre_fetch_hook_zen4_gcccore1220(self, *args, **kwargs):
612633 print_msg ("Updated build option 'force' to 'True'" )
613634
614635
615- def pre_module_hook_zen4_gcccore1220 (self , * args , ** kwargs ):
636+ def pre_module_hook_unsupported_module (self , * args , ** kwargs ):
616637 """Make module load-able during module step"""
617- if is_gcccore_1220_based ( ecname = self . name , ecversion = self . version , tcname = self . toolchain . name ,
618- tcversion = self . toolchain . version ) :
638+ ignore_lmoderror_envvar = is_unsupported_module ( self )
639+ if ignore_lmoderror_envvar :
619640 if hasattr (self , 'initial_environ' ):
620641 # Allow the module to be loaded in the module step (which uses initial environment)
621- print_msg (f"Setting { EESSI_IGNORE_ZEN4_GCC1220_ENVVAR } in initial environment" )
622- self .initial_environ [EESSI_IGNORE_ZEN4_GCC1220_ENVVAR ] = "1"
642+ print_msg (f"Setting { ignore_lmoderror_envvar } in initial environment" )
643+ self .initial_environ [ignore_lmoderror_envvar ] = "1"
623644
624645
625- def post_module_hook_zen4_gcccore1220 (self , * args , ** kwargs ):
626- """Revert changes from pre_fetch_hook_zen4_gcccore1220 """
627- if is_gcccore_1220_based ( ecname = self . name , ecversion = self . version , tcname = self . toolchain . name ,
628- tcversion = self . toolchain . version ) :
646+ def post_module_hook_unsupported_module (self , * args , ** kwargs ):
647+ """Revert changes from pre_fetch_hook_unsupported_modules """
648+ ignore_lmoderror_envvar = is_unsupported_module ( self )
649+ if ignore_lmoderror_envvar :
629650 if hasattr (self , EESSI_MODULE_ONLY_ATTR ):
630651 update_build_option ('module_only' , getattr (self , EESSI_MODULE_ONLY_ATTR ))
631652 print_msg ("Restored original build option 'module_only' to %s" % getattr (self , EESSI_MODULE_ONLY_ATTR ))
@@ -642,9 +663,9 @@ def post_module_hook_zen4_gcccore1220(self, *args, **kwargs):
642663
643664 # If the variable to allow loading is set, remove it
644665 if hasattr (self , 'initial_environ' ):
645- if self .initial_environ .get (EESSI_IGNORE_ZEN4_GCC1220_ENVVAR , False ):
646- print_msg (f"Removing { EESSI_IGNORE_ZEN4_GCC1220_ENVVAR } in initial environment" )
647- del self .initial_environ [EESSI_IGNORE_ZEN4_GCC1220_ENVVAR ]
666+ if self .initial_environ .get (ignore_lmoderror_envvar , False ):
667+ print_msg (f"Removing { ignore_lmoderror_envvar } in initial environment" )
668+ del self .initial_environ [ignore_lmoderror_envvar ]
648669
649670
650671def post_easyblock_hook_copy_easybuild_subdir (self , * args , ** kwargs ):
@@ -1532,9 +1553,7 @@ def pre_module_hook(self, *args, **kwargs):
15321553 PRE_MODULE_HOOKS [self .name ](self , * args , ** kwargs )
15331554
15341555 # Always trigger this one, regardless of self.name
1535- cpu_target = get_eessi_envvar ('EESSI_SOFTWARE_SUBDIR' )
1536- if cpu_target == CPU_TARGET_ZEN4 :
1537- pre_module_hook_zen4_gcccore1220 (self , * args , ** kwargs )
1556+ pre_module_hook_unsupported_module (self , * args , ** kwargs )
15381557
15391558
15401559def post_module_hook (self , * args , ** kwargs ):
@@ -1543,9 +1562,7 @@ def post_module_hook(self, *args, **kwargs):
15431562 POST_MODULE_HOOKS [self .name ](self , * args , ** kwargs )
15441563
15451564 # Always trigger this one, regardless of self.name
1546- cpu_target = get_eessi_envvar ('EESSI_SOFTWARE_SUBDIR' )
1547- if cpu_target == CPU_TARGET_ZEN4 :
1548- post_module_hook_zen4_gcccore1220 (self , * args , ** kwargs )
1565+ post_module_hook_unsupported_module (self , * args , ** kwargs )
15491566
15501567
15511568# The post_easyblock_hook was introduced in EasyBuild 5.1.1.
0 commit comments