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,39 +633,37 @@ 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 ):
619- if hasattr (self , 'initial_environ' ):
620- # 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"
623-
624-
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 ):
629- if hasattr (self , EESSI_MODULE_ONLY_ATTR ):
630- update_build_option ('module_only' , getattr (self , EESSI_MODULE_ONLY_ATTR ))
631- print_msg ("Restored original build option 'module_only' to %s" % getattr (self , EESSI_MODULE_ONLY_ATTR ))
632- else :
633- raise EasyBuildError ("Cannot restore module_only to it's original value: 'self' is missing attribute %s." ,
634- EESSI_MODULE_ONLY_ATTR )
638+ ignore_lmoderror_envvar = is_unsupported_module (self )
639+ if ignore_lmoderror_envvar and hasattr (self , 'initial_environ' ):
640+ # Allow the module to be loaded in the module step (which uses initial environment)
641+ print_msg (f"Setting { ignore_lmoderror_envvar } in initial environment" )
642+ self .initial_environ [ignore_lmoderror_envvar ] = "1"
643+
644+
645+ def post_module_hook_unsupported_module (self , * args , ** kwargs ):
646+ """Revert changes from pre_fetch_hook_unsupported_modules"""
647+ ignore_lmoderror_envvar = is_unsupported_module (self )
648+ if hasattr (self , EESSI_MODULE_ONLY_ATTR ):
649+ update_build_option ('module_only' , getattr (self , EESSI_MODULE_ONLY_ATTR ))
650+ print_msg ("Restored original build option 'module_only' to %s" % getattr (self , EESSI_MODULE_ONLY_ATTR ))
651+ else :
652+ raise EasyBuildError ("Cannot restore module_only to it's original value: 'self' is missing attribute %s." ,
653+ EESSI_MODULE_ONLY_ATTR )
635654
636- if hasattr (self , EESSI_FORCE_ATTR ):
637- update_build_option ('force' , getattr (self , EESSI_FORCE_ATTR ))
638- print_msg ("Restored original build option 'force' to %s" % getattr (self , EESSI_FORCE_ATTR ))
639- else :
640- raise EasyBuildError ("Cannot restore force to it's original value: 'self' is misisng attribute %s." ,
641- EESSI_FORCE_ATTR )
655+ if hasattr (self , EESSI_FORCE_ATTR ):
656+ update_build_option ('force' , getattr (self , EESSI_FORCE_ATTR ))
657+ print_msg ("Restored original build option 'force' to %s" % getattr (self , EESSI_FORCE_ATTR ))
658+ else :
659+ raise EasyBuildError ("Cannot restore force to it's original value: 'self' is misisng attribute %s." ,
660+ EESSI_FORCE_ATTR )
642661
643- # If the variable to allow loading is set, remove it
644- 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 ]
662+ # If the variable to allow loading is set, remove it
663+ if ignore_lmoderror_envvar and hasattr (self , 'initial_environ' ):
664+ if self .initial_environ .get (ignore_lmoderror_envvar , False ):
665+ print_msg (f"Removing { ignore_lmoderror_envvar } in initial environment" )
666+ del self .initial_environ [ignore_lmoderror_envvar ]
648667
649668
650669def post_easyblock_hook_copy_easybuild_subdir (self , * args , ** kwargs ):
@@ -1507,9 +1526,8 @@ def pre_module_hook(self, *args, **kwargs):
15071526 PRE_MODULE_HOOKS [self .name ](self , * args , ** kwargs )
15081527
15091528 # Always trigger this one, regardless of self.name
1510- cpu_target = get_eessi_envvar ('EESSI_SOFTWARE_SUBDIR' )
1511- if cpu_target == CPU_TARGET_ZEN4 :
1512- pre_module_hook_zen4_gcccore1220 (self , * args , ** kwargs )
1529+ if is_unsupported_module (self ):
1530+ pre_module_hook_unsupported_module (self , * args , ** kwargs )
15131531
15141532
15151533def post_module_hook (self , * args , ** kwargs ):
@@ -1518,9 +1536,8 @@ def post_module_hook(self, *args, **kwargs):
15181536 POST_MODULE_HOOKS [self .name ](self , * args , ** kwargs )
15191537
15201538 # Always trigger this one, regardless of self.name
1521- cpu_target = get_eessi_envvar ('EESSI_SOFTWARE_SUBDIR' )
1522- if cpu_target == CPU_TARGET_ZEN4 :
1523- post_module_hook_zen4_gcccore1220 (self , * args , ** kwargs )
1539+ if is_unsupported_module (self ):
1540+ post_module_hook_unsupported_module (self , * args , ** kwargs )
15241541
15251542
15261543# The post_easyblock_hook was introduced in EasyBuild 5.1.1.
0 commit comments