From fa86314967582f438486092f6cf5c2733cef146c Mon Sep 17 00:00:00 2001 From: crivella Date: Tue, 27 May 2025 13:45:09 +0200 Subject: [PATCH 1/2] WIP adding general way to handle filtered deps --- eb_hooks.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/eb_hooks.py b/eb_hooks.py index d92f457e41..8226d5b81b 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -14,6 +14,7 @@ from easybuild.tools.systemtools import AARCH64, POWER, X86_64, get_cpu_architecture, get_cpu_features from easybuild.tools.toolchain.compiler import OPTARCH_GENERIC from easybuild.tools.version import VERSION as EASYBUILD_VERSION +from easybuild.tools.modules import get_software_root_env_var_name # prefer importing LooseVersion from easybuild.tools, but fall back to distuils in case EasyBuild <= 4.7.0 is used try: @@ -519,6 +520,12 @@ def post_prepare_hook_highway_handle_test_compilation_issues(self, *args, **kwar def pre_configure_hook(self, *args, **kwargs): """Main pre-configure hook: trigger custom functions based on software name.""" + eprefix = get_eessi_envvar('EPREFIX') + + for filter_dep_spec in build_option('filter_deps') or []: + var_name = get_software_root_env_var_name(filter_dep_spec) + env.setvar(var_name, os.path.join(eprefix, 'usr')) + if self.name in PRE_CONFIGURE_HOOKS: PRE_CONFIGURE_HOOKS[self.name](self, *args, **kwargs) @@ -654,6 +661,27 @@ def pre_configure_hook_gromacs(self, *args, **kwargs): raise EasyBuildError("GROMACS-specific hook triggered for non-GROMACS easyconfig?!") +def pre_configure_hook_llvm(self, *args, **kwargs): + """Adjust internal configure options for the LLVM EasyBlock to reinstate filtered out dependencies. + In the LLVM EasyBlock, most checks concerning loaded modules are performed at the configure_step. + The EB uses a global `general_opts` dict to keep track of options that needs to be reused across stages. + The way the EB is structured does allow to inject a CMAKE option through `self._cfgopts` which is a splitted list + of the `configure_opts` passed through the EC, but does not allow to override as the `general_opts` dict will + take precedence over the `self._cfgopts` list. + + We can instead set the environment variable that EasyBuild uses for `get_software_root` to trick the EB into + into pointing to the compat layer. + """ + if self.name == 'LLVM': + eprefix = get_eessi_envvar('EPREFIX') + + for software in ('zlib', 'ncurses'): + var_name = get_software_root_env_var_name(software) + env.setvar(var_name, os.path.join(eprefix, 'usr')) + else: + raise EasyBuildError("LLVM-specific hook triggered for non-LLVM easyconfig?!") + + def pre_configure_hook_openblas_optarch_generic(self, *args, **kwargs): """ Pre-configure hook for OpenBLAS: add DYNAMIC_ARCH=1 to build/test/install options when using --optarch=GENERIC From aa7deac655bb12af363b79707f898347a7713884 Mon Sep 17 00:00:00 2001 From: crivella Date: Tue, 27 May 2025 13:48:24 +0200 Subject: [PATCH 2/2] Removed llvm hook --- eb_hooks.py | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/eb_hooks.py b/eb_hooks.py index 8226d5b81b..d2aa6e1803 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -661,27 +661,6 @@ def pre_configure_hook_gromacs(self, *args, **kwargs): raise EasyBuildError("GROMACS-specific hook triggered for non-GROMACS easyconfig?!") -def pre_configure_hook_llvm(self, *args, **kwargs): - """Adjust internal configure options for the LLVM EasyBlock to reinstate filtered out dependencies. - In the LLVM EasyBlock, most checks concerning loaded modules are performed at the configure_step. - The EB uses a global `general_opts` dict to keep track of options that needs to be reused across stages. - The way the EB is structured does allow to inject a CMAKE option through `self._cfgopts` which is a splitted list - of the `configure_opts` passed through the EC, but does not allow to override as the `general_opts` dict will - take precedence over the `self._cfgopts` list. - - We can instead set the environment variable that EasyBuild uses for `get_software_root` to trick the EB into - into pointing to the compat layer. - """ - if self.name == 'LLVM': - eprefix = get_eessi_envvar('EPREFIX') - - for software in ('zlib', 'ncurses'): - var_name = get_software_root_env_var_name(software) - env.setvar(var_name, os.path.join(eprefix, 'usr')) - else: - raise EasyBuildError("LLVM-specific hook triggered for non-LLVM easyconfig?!") - - def pre_configure_hook_openblas_optarch_generic(self, *args, **kwargs): """ Pre-configure hook for OpenBLAS: add DYNAMIC_ARCH=1 to build/test/install options when using --optarch=GENERIC