Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion eb_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from easybuild.framework.easyconfig.constants import EASYCONFIG_CONSTANTS
from easybuild.tools.build_log import EasyBuildError, print_msg
from easybuild.tools.config import build_option, update_build_option
from easybuild.tools.filetools import apply_regex_substitutions, copy_file, remove_file, symlink, which
from easybuild.tools.filetools import apply_regex_substitutions, copy_file, dir_contains_files, remove_file, symlink, which
from easybuild.tools.run import run_cmd
from easybuild.tools.systemtools import AARCH64, POWER, X86_64, get_cpu_architecture, get_cpu_features
from easybuild.tools.toolchain.compiler import OPTARCH_GENERIC
Expand Down Expand Up @@ -450,6 +450,22 @@ def pre_fetch_hook_zen4_gcccore1220(self, *args, **kwargs):
print_msg("Updated build option 'force' to 'True'")


def pre_install_hook(self, *args, **kwargs):
"""Main pre install hook: trigger custom functions based on software name."""

# To work around a permission issue fo rebuilds (see https://github.com/EESSI/software-layer/issues/556),
# a solution was implemented (see https://github.com/EESSI/software-layer/issues/556)
# that removes the existing installation directory, creates a new one (with some empty top-level subdirs),
# and calls EasyBuild with --try-amend=keeppreviousinstall=True (to prevent it from removing it and recreating it once again).
# To be sure, we check here if this parameter is used, and if so, if the directory really does not contain any files anymore.
if 'keeppreviousinstall' in self.cfg and self.cfg['keeppreviousinstall']:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bedroge I think we deserve some context here, where/how we're using keeppreviousinstall, and why we only want to use this only when empty directories are available.
Definitely point to #556 + #871

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: cc79fd7

if dir_contains_files(self.installdir, recursive=True):
raise EasyBuildError("Parameter keeppreviousinstall is set to True, but the installation directory still contains files!")

if self.name in PRE_INSTALL_HOOKS:
PRE_INSTALL_HOOKS[ec.name](self, *args, **kwargs)


def post_module_hook_zen4_gcccore1220(self, *args, **kwargs):
"""Revert changes from pre_fetch_hook_zen4_gcccore1220"""
if is_gcccore_1220_based(ecname=self.name, ecversion=self.version, tcname=self.toolchain.name,
Expand Down Expand Up @@ -1149,6 +1165,8 @@ def post_module_hook(self, *args, **kwargs):
'Score-P': pre_configure_hook_score_p,
}

PRE_INSTALL_HOOKS = {}

PRE_TEST_HOOKS = {
'ESPResSo': pre_test_hook_ignore_failing_tests_ESPResSo,
'FFTW.MPI': pre_test_hook_ignore_failing_tests_FFTWMPI,
Expand Down