Skip to content

Make sure the full directory name is replaced in eb_hooks.py, replace placeholders before comparing what is shipped #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
9 changes: 5 additions & 4 deletions bot/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion eb_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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-<EESSI_VERSION>/#gcc-1220-and-foss-2022b-based-modules-cannot-be-loaded-on-zen4-architecture"
Expand Down
32 changes: 28 additions & 4 deletions install_scripts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,30 @@ 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
mv "$tmp_file" "$file"
else
rm -f "$tmp_file"
fi
}

compare_and_copy() {
if [ "$#" -ne 2 ]; then
echo "Usage of function: compare_and_copy <source_file> <destination_file>"
Expand Down Expand Up @@ -193,15 +217,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>/@/${EESSI_VERSION}/@g" ${INSTALL_PREFIX}/init/modules/EESSI/${EESSI_VERSION}.lua
sed_update_if_changed "s@/<EESSI_VERSION>/@/${EESSI_VERSION}/@g" ${INSTALL_PREFIX}/init/modules/EESSI/${EESSI_VERSION}.lua

# replace EESSI version used in EasyBuild hooks
sed -i "s@/<EESSI_VERSION>/@/${EESSI_VERSION}/@g" ${INSTALL_PREFIX}/init/easybuild/eb_hooks.py
sed_update_if_changed "s@/eessi-<EESSI_VERSION>/@/eessi-${EESSI_VERSION}/@g" ${INSTALL_PREFIX}/init/easybuild/eb_hooks.py
Loading