From 2438c476acc05930de540e3a89f38f8ffd7dc2c4 Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Thu, 14 Nov 2024 10:44:32 +0100 Subject: [PATCH] pre-package hook for EESSI-extend that stats all files/dirs in installation directory --- eb_hooks.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/eb_hooks.py b/eb_hooks.py index 03642656ea..20f0281492 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -962,6 +962,29 @@ def inject_gpu_property(ec): return ec +def pre_package_hook(self, *args, **kwargs): + """Main pre-package hook: trigger custom functions based on software name.""" + if self.name in PRE_PACKAGE_HOOKS: + PRE_PACKAGE_HOOKS[self.name](self, *args, **kwargs) + + +def pre_package_eessi_extend(self, *args, **kwargs): + """ + Pre-package hook for EESSI-extend: ls/stat all files/directories to work around + 'permission denied' issue when package got removed (and this hook is run when + the package is being rebuilt) + """ + if self.name == 'EESSI-extend': + dir_tree = [] + for root, _, files in os.walk(self.installdir): + dir_tree.append(root) + for f in files: + tree.append(os.path.join(root, f)) + for entry in dir_tree: + print(entry) + os.stat(entry) + + PARSE_HOOKS = { 'casacore': parse_hook_casacore_disable_vectorize, 'CGAL': parse_hook_cgal_toolchainopts_precise, @@ -1020,4 +1043,7 @@ def inject_gpu_property(ec): POST_POSTPROC_HOOKS = { 'CUDA': post_postproc_cuda, 'cuDNN': post_postproc_cudnn, + +PRE_PACKAGE_HOOKS = { + 'EESSI-extend': pre_package_eessi_extend, }