From ab82e6d84c514176fc2e9cf1afc978139f2da65e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Tue, 21 Jan 2025 15:42:11 +0100 Subject: [PATCH 1/2] reuse existing directory for rebuilds --- EESSI-install-software.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/EESSI-install-software.sh b/EESSI-install-software.sh index 2f05953158..3a9ba175c9 100755 --- a/EESSI-install-software.sh +++ b/EESSI-install-software.sh @@ -336,7 +336,15 @@ else if [ -f ${easystack_file} ]; then echo_green "Feeding easystack file ${easystack_file} to EasyBuild..." - ${EB} --easystack ${easystack_file} --robot + if [[ ${easystack_file} == *"/rebuilds/"* ]]; then + # the removal script should have removed the original directory and created a new and empty one + # to work around permission issues: + # https://github.com/EESSI/software-layer/issues/556 + echo_yellow "This is a rebuild, so using --try-amend=keeppreviousinstall=True to reuse the already created directory" + ${EB} --easystack ${easystack_file} --robot --try-amend=keeppreviousinstall=True + else + ${EB} --easystack ${easystack_file} --robot + fi ec=$? # copy EasyBuild log file if EasyBuild exited with an error From 0a85fd21eb0fa37605e8976d928edc19ab3a6008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Tue, 21 Jan 2025 15:45:21 +0100 Subject: [PATCH 2/2] recreate installation dir and first-level subdirs after it has been removed --- EESSI-remove-software.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/EESSI-remove-software.sh b/EESSI-remove-software.sh index 1a03a7af98..e4b377fd16 100755 --- a/EESSI-remove-software.sh +++ b/EESSI-remove-software.sh @@ -125,13 +125,18 @@ if [ $EUID -eq 0 ]; then # Two dirname invocations, so returns e.g. /cvmfs/software.eessi.io/versions/2023.06/software/linux/x86_64/amd/zen2 app_installprefix=$(dirname $(dirname ${app_modulepath})) app_dir=${app_installprefix}/software/${app} + app_subdirs=$(find ${app_dir} -mindepth 1 -maxdepth 1 -type d) app_module=${app_installprefix}/modules/all/${app}.lua echo_yellow "Removing ${app_dir} and ${app_module}..." rm -rf ${app_dir} rm -rf ${app_module} - # recreate some directory to work around permission denied - # issues when rebuilding the package - mkdir -p ${app_dir}/easybuild + # recreate the installation directories and first-level subdirectories to work around permission denied + # issues when rebuilding the package (see https://github.com/EESSI/software-layer/issues/556) + echo_yellow "Recreating an empty ${app_dir}..." + mkdir -p ${app_dir} + for app_subdir in ${app_subdirs}; do + mkdir -p ${app_subdir} + done done else fatal_error "Easystack file ${easystack_file} not found!"