From f23764edee4c210bece7fefe9c8e1199075aa6be Mon Sep 17 00:00:00 2001 From: Damian Alvarez <swmanage@jrlogin12.jureca> Date: Thu, 10 Jun 2021 20:55:31 +0200 Subject: [PATCH] Let's do the check at parsing time, and fix a couple of format issues and oopsies --- Custom_Hooks/eb_hooks.py | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/Custom_Hooks/eb_hooks.py b/Custom_Hooks/eb_hooks.py index b771bf8b0..a8ee9578b 100644 --- a/Custom_Hooks/eb_hooks.py +++ b/Custom_Hooks/eb_hooks.py @@ -46,7 +46,7 @@ VETOED_INSTALLATIONS = { 'juwelsbooster': ['impi'], 'juwels': [], 'jurecadc': [], - 'jurecabooster': ['OpenMPI', 'CUDA', 'nvidia-driver', 'UCX', 'NVHPC'] + 'jurecabooster': ['OpenMPI', 'CUDA', 'nvidia-driver', 'UCX', 'NVHPC'], 'jusuf': ['impi'], 'hdfml': [], } @@ -64,10 +64,26 @@ REQUIRE_MODALTSOFTNAME = { "intel-compilers": "Intel", } +def installation_vetoer(ec): + "Check whether this package is NOT supposed to be installed in this system, and abort if necessary" + name = ec['name'] + system_name = os.getenv('LMOD_SYSTEM_NAME') + if name in VETOED_INSTALLATIONS[system_name]: + print_warning( + "\nYou are attempting to install software that should not be installed in this system.\n" + "Please double check the list of packages that you are attempting to install. The following\n" + f"packages can't be installed in {system_name}:\n" + ) + for package in VETOED_INSTALLATIONS[system_name]: + print(f"- {package}") + exit(1) def parse_hook(ec, *args, **kwargs): """Custom parse hook to manage installations intended for JSC systems.""" + # First of all check if this should be installed + installation_vetoer(ec) + ec_dict = ec.asdict() # Compilers are are a family (in the Lmod sense) if ec.name in SUPPORTED_COMPILERS: @@ -193,28 +209,10 @@ family("mpi") " eb --robot=$EASYBUILD_ROBOT:$EBROOTEASYBUILD/easybuild/easyconfigs --try-update-deps ...." ) -def installation_vetoer(self): - "Check whether this package is NOT supposed to be installed in this system, and abort if necessary" - ec = self.cfg - name = ec['name'] - system_name = os.getenv('SYSTEMNAME') - if name in VETOED_INSTALLATIONS[system_name]: - print_warning( - "\nYou are attempting to install software that should not be installed in this system.\n" - "\nPlease double check the list of packages that you are attempting to install. The following\n" - f"\npackages can't be installed in {system_name}:\n" - ) - for package in VETOED_INSTALLATIONS[system_name]: - print_warning(f"- {package}\n") - exit(1) - def pre_ready_hook(self, *args, **kwargs): "When we are building something, do some checks for bad behaviour" ec = self.cfg - # First of all check if this should be installed - installation_vetoer(ec) - # Grab name, path, toolchain, install path and check if we are installing # GCCcore/MPI name = ec["name"] -- GitLab