diff --git a/bot/test.sh b/bot/test.sh index b615be00..168b0d5c 100755 --- a/bot/test.sh +++ b/bot/test.sh @@ -151,12 +151,13 @@ EESSI_REPOS_CFG_DIR_OVERRIDE=$(cfg_get_value "repository" "repos_cfg_dir") export EESSI_REPOS_CFG_DIR_OVERRIDE=${EESSI_REPOS_CFG_DIR_OVERRIDE:-${PWD}/cfg} echo "bot/test.sh: EESSI_REPOS_CFG_DIR_OVERRIDE='${EESSI_REPOS_CFG_DIR_OVERRIDE}'" -# determine pilot version to be used from .repository.repo_version in ${JOB_CFG_FILE} -# here, just set & export EESSI_PILOT_VERSION_OVERRIDE +# determine EESSI version to be used from .repository.repo_version in ${JOB_CFG_FILE} +# here, just set & export EESSI_VERSION_OVERRIDE # next script (eessi_container.sh) makes use of it via sourcing init scripts # (e.g., init/eessi_defaults or init/minimal_eessi_env) -export EESSI_PILOT_VERSION_OVERRIDE=$(cfg_get_value "repository" "repo_version") -echo "bot/test.sh: EESSI_PILOT_VERSION_OVERRIDE='${EESSI_PILOT_VERSION_OVERRIDE}'" +REPOSITORY_VERSION=$(cfg_get_value "repository" "repo_version") +export EESSI_VERSION_OVERRIDE=${REPOSITORY_VERSION} +echo "bot/build.sh: EESSI_VERSION_OVERRIDE='${EESSI_VERSION_OVERRIDE}'" # determine CVMFS repo to be used from .repository.repo_name in ${JOB_CFG_FILE} # here, just set EESSI_CVMFS_REPO_OVERRIDE, a bit further down diff --git a/eb_hooks.py b/eb_hooks.py index 4775bd44..552ba466 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -405,7 +405,7 @@ def parse_hook_zen4_module_only(ec, eprefix): env_varname = EESSI_IGNORE_ZEN4_GCC1220_ENVVAR # TODO: create a docs page to which we can refer for more info here # TODO: then update the link to the known issues page to the _specific_ issue - # Need to escape newline character so that the newline character actually ends up in the module file + # Need to escape the newline character so that the newline character actually ends up in the module file # (otherwise, it splits the string, and a 2-line string ends up in the modulefile, resulting in syntax error) errmsg = "EasyConfigs using toolchains based on GCCcore-12.2.0 are not supported for the Zen4 architecture.\\n" errmsg += "See https://www.eessi.io/docs/known_issues/eessi-/#gcc-1220-and-foss-2022b-based-modules-cannot-be-loaded-on-zen4-architecture" diff --git a/install_scripts.sh b/install_scripts.sh index 5ac2940e..cbe9bdb7 100755 --- a/install_scripts.sh +++ b/install_scripts.sh @@ -37,6 +37,31 @@ file_changed_in_pr() { ) && return 0 || return 1 } +sed_update_if_changed() { + # Usage: sed_update_if_changed 's/foo/bar/' file.txt + if [ "$#" -ne 2 ]; then + echo "Usage: sed_update_if_changed 'sed_command' file" >&2 + return 1 + fi + + local sed_command="$1" + local file="$2" + local tmp_file="$(mktemp "${file}.XXXXXX")" + + sed "$sed_command" "$file" > "$tmp_file" || { + rm -f "$tmp_file" + echo "sed command failed" >&2 + return 1 + } + + if ! diff -q "$file" "$tmp_file" > /dev/null; then + # Use cat to retain existing permissions, set umask to world readable in case the target file does not yet exist. + (umask 022 && cat "$tmp_file" > "$file") + fi + # Remove the temporary file + rm -f "$tmp_file" +} + compare_and_copy() { if [ "$#" -ne 2 ]; then echo "Usage of function: compare_and_copy " @@ -193,15 +218,15 @@ copy_files_by_list ${TOPDIR} ${INSTALL_PREFIX}/init/easybuild "${hook_files[@]}" # but that should be fine (no changes are made if version placeholder is not present anymore) # make sure that scripts in init/ and scripts/ use correct EESSI version -sed -i "s/__EESSI_VERSION_DEFAULT__/${EESSI_VERSION}/g" ${INSTALL_PREFIX}/init/eessi_defaults +sed_update_if_changed "s/__EESSI_VERSION_DEFAULT__/${EESSI_VERSION}/g" ${INSTALL_PREFIX}/init/eessi_defaults # replace placeholder for default EESSI version in Lmod init scripts for shell in $(ls ${INSTALL_PREFIX}/init/lmod); do - sed -i "s/__EESSI_VERSION_DEFAULT__/${EESSI_VERSION}/g" ${INSTALL_PREFIX}/init/lmod/${shell} + sed_update_if_changed "s/__EESSI_VERSION_DEFAULT__/${EESSI_VERSION}/g" ${INSTALL_PREFIX}/init/lmod/${shell} done # replace EESSI version used in comments in EESSI module -sed -i "s@//@/${EESSI_VERSION}/@g" ${INSTALL_PREFIX}/init/modules/EESSI/${EESSI_VERSION}.lua +sed_update_if_changed "s@//@/${EESSI_VERSION}/@g" ${INSTALL_PREFIX}/init/modules/EESSI/${EESSI_VERSION}.lua # replace EESSI version used in EasyBuild hooks -sed -i "s@//@/${EESSI_VERSION}/@g" ${INSTALL_PREFIX}/init/easybuild/eb_hooks.py +sed_update_if_changed "s@/eessi-/@/eessi-${EESSI_VERSION}/@g" ${INSTALL_PREFIX}/init/easybuild/eb_hooks.py