diff --git a/.github/workflows/scripts/diff_eessi_extend.sh b/.github/workflows/scripts/diff_eessi_extend.sh new file mode 100755 index 00000000..dd5ba833 --- /dev/null +++ b/.github/workflows/scripts/diff_eessi_extend.sh @@ -0,0 +1,76 @@ +#!/bin/bash +set -euo pipefail + +shopt -s nullglob + +total_failures=0 +failure_summary=() + +compare_group() { + local version="$1" + shift + local files=("$@") + + (( ${#files[@]} > 1 )) || return 0 + + local ref="${files[0]}" + local failures=0 + + # echo + # echo "Reference file: $ref" + + for f in "${files[@]:1}"; do + # echo -e "\tComparing with $f" + + if ! diff \ + <(grep -v '^local root = ' "$ref") \ + <(grep -v '^local root = ' "$f"); then + + failure_summary+=("$version|$ref|$f") + + ((++total_failures)) + fi + done +} + +for version_dir in /cvmfs/software.eessi.io/versions/*; do + version=$(basename "$version_dir") + + x86_64_files=( + "$version_dir"/software/linux/x86_64/*/modules/all/EESSI-extend/"$version"-easybuild.lua + "$version_dir"/software/linux/x86_64/*/*/modules/all/EESSI-extend/"$version"-easybuild.lua + ) + compare_group "$version" "${x86_64_files[@]}" + + aarch64_files=( + "$version_dir"/software/linux/aarch64/*/modules/all/EESSI-extend/"$version"-easybuild.lua + "$version_dir"/software/linux/aarch64/*/*/modules/all/EESSI-extend/"$version"-easybuild.lua + ) + # For aarch64 we also check our RISC-V development repo + riscv_version_dirs=(/cvmfs/dev.eessi.io/riscv/versions/"$version"-*) + if ((${#riscv_version_dirs[@]})); then + latest_riscv_version_dir="${riscv_version_dirs[-1]}" + aarch64_files+=( + "$latest_riscv_version_dir"/software/linux/riscv64/*/modules/all/EESSI-extend/"$version"-easybuild.lua + "$latest_riscv_version_dir"/software/linux/riscv64/*/*/modules/all/EESSI-extend/"$version"-easybuild.lua + ) + fi + + compare_group "$version" "${aarch64_files[@]}" +done + +if (( total_failures > 0 )); then + echo + echo "Summary of differences:" + for entry in "${failure_summary[@]}"; do + IFS='|' read -r version ref file <<< "$entry" + printf 'Version: %s\n' "$version" + printf 'Reference: %s\n' "$ref" + printf 'File: %s\n\n' "$file" + done + + echo "$total_failures file(s) differed." + exit 1 +fi + +echo "All files matched." diff --git a/.github/workflows/tests_eessi_extend_module.yml b/.github/workflows/tests_eessi_extend_module.yml index 94a1d68f..de51b650 100644 --- a/.github/workflows/tests_eessi_extend_module.yml +++ b/.github/workflows/tests_eessi_extend_module.yml @@ -28,7 +28,7 @@ jobs: eessi_stack_version: ${{matrix.eessi_version}} use_eessi_module: true - - name: Install the EESSI-extend shipped with the repository + - name: Install the EESSI-extend shipped with the repository and verify it is consistent with the CVMFS repo run: | # Define a function to check the values of environment variables # and another that checks an environment does not contain environment @@ -64,6 +64,12 @@ jobs: eb --rebuild ${{matrix.rebuild_software}} echo "Testing a rebuild using the hooks in the current branch" eb --rebuild --hooks=./eb_hooks.py ${{matrix.rebuild_software}} + + # First, check if it differs against what is currently shipped by CVMFS + diff <(grep -v '^local root = ' /cvmfs/software.eessi.io/versions/${{matrix.eessi_version}}/software/linux/$(uname -m)/generic/modules/all/EESSI-extend/${{matrix.eessi_version}}-easybuild.lua) <(grep -v '^local root = ' $MY_INSTALLATION_PATH/modules/all/EESSI-extend/${{matrix.eessi_version}}-easybuild.lua) + # Then do a consistency check in CVMFS for all architectures + .github/workflows/scripts/diff_eessi_extend.sh + # Proceed with unload and checking the environment variables module unload EESSI-extend # That should have unset all EasyBuild envvars (including EASYBUILD_PREFIX) diff --git a/EESSI-extend-easybuild.eb b/EESSI-extend-easybuild.eb index 250191c0..c8be0660 100644 --- a/EESSI-extend-easybuild.eb +++ b/EESSI-extend-easybuild.eb @@ -143,9 +143,21 @@ elseif eessi_site_install then LmodError("You cannot use EESSI_SITE_INSTALL in combination with any other EESSI_*_INSTALL environment variables") end easybuild_installpath = os.getenv("EESSI_SITE_SOFTWARE_PATH") + -- Check that the plain EESSI_SITE_SOFTWARE_PATH exists + if not isDir(easybuild_installpath) then + installpath_warning = "The location of EESSI_SITE_SOFTWARE_PATH (" .. easybuild_installpath .. ") does not exist or is not a directory. " + installpath_warning = installpath_warning .. "If you have sufficient permissions this location will be created, otherwise you will run into errors." + LmodWarning(installpath_warning) + end -- Enforce accelerator subdirectory usage for site installs (only if an accelerator install is requested) if (eessi_accelerator_target ~= nil) and (cuda_compute_capability ~= nil) and (os.getenv("EESSI_ACCELERATOR_INSTALL") ~= nil) then easybuild_installpath = pathJoin(easybuild_installpath, eessi_accelerator_target) + -- Check that the EESSI_SITE_SOFTWARE_PATH with eessi_accelerator_target prefix exists + if not isDir(easybuild_installpath) then + installpath_warning = "The location of EESSI_SITE_SOFTWARE_PATH (" .. easybuild_installpath .. ") does not exist or is not a directory. " + installpath_warning = installpath_warning .. "If you have sufficient permissions this location will be created, otherwise you will run into errors." + LmodWarning(installpath_warning) + end end else -- Deal with user and project installs