mirror of
https://github.com/Pmodules/Pmodules.git
synced 2026-06-30 11:19:39 +02:00
Merge branch '32-overlay-implementation' of gitlab.psi.ch:Pmodules/src into 32-overlay-implementation
This commit is contained in:
+1
-5
@@ -29,11 +29,9 @@ fi
|
||||
unset MODULE_VERSION
|
||||
unset MODULE_VERSION_STACK
|
||||
unset MODULESHOME
|
||||
#unset PMODULES_ENV
|
||||
|
||||
declare -x PMODULES_DIR="${PMODULES_HOME}"
|
||||
|
||||
|
||||
#############################################################################
|
||||
# implement module comand as shell function
|
||||
#
|
||||
@@ -44,9 +42,7 @@ module() {
|
||||
export -f module
|
||||
|
||||
modbuild(){
|
||||
(
|
||||
"${PMODULES_HOME}/bin/modbuild" "$@"
|
||||
)
|
||||
"${PMODULES_HOME}/bin/modbuild" "$@"
|
||||
}
|
||||
export -f modbuild
|
||||
|
||||
|
||||
@@ -740,9 +740,8 @@ pbuild::make_all() {
|
||||
#
|
||||
set_full_module_name_and_prefix() {
|
||||
do_simple_group(){
|
||||
modulefile_dir=$(join_by '/' \
|
||||
"${ol_mod_root}/${GROUP}/${PMODULES_MODULEFILES_DIR}" \
|
||||
"${module_name}")
|
||||
modulefile_dir="${ol_mod_root}/${GROUP}/${PMODULES_MODULEFILES_DIR}/"
|
||||
modulefile_dir+="${module_name}"
|
||||
modulefile_name="${modulefile_dir}/${module_version}"
|
||||
PREFIX="${ol_inst_root}/${GROUP}/${module_name}/${module_version}"
|
||||
}
|
||||
@@ -783,7 +782,9 @@ pbuild::make_all() {
|
||||
fi
|
||||
|
||||
modulefile_dir=$(join_by '/' \
|
||||
"${ol_mod_root}/${GROUP}/${PMODULES_MODULEFILES_DIR}" \
|
||||
"${ol_mod_root}" \
|
||||
"${GROUP}" \
|
||||
"${PMODULES_MODULEFILES_DIR}" \
|
||||
"${names[@]}" \
|
||||
"${module_name}")
|
||||
modulefile_name="${modulefile_dir}/${module_version}"
|
||||
|
||||
@@ -43,7 +43,7 @@ compute_group_depth () {
|
||||
test -d "${dir}" || return 1
|
||||
local group=${dir%/*}
|
||||
local group=${group##*/}
|
||||
local -i result=$(${find} "${dir}" -depth \( -type f -o -type l \) \
|
||||
result=$(${find} "${dir}" -depth \( -type f -o -type l \) \
|
||||
-printf "%d" -quit 2>/dev/null)
|
||||
(( result-=2 ))
|
||||
# if a group doesn't contain a modulefile, depth is negativ
|
||||
@@ -59,12 +59,14 @@ compute_group_depth () {
|
||||
#
|
||||
scan_groups () {
|
||||
local ol
|
||||
local depth
|
||||
for ol in "$@"; do
|
||||
local mod_root="${OverlayInfo[${ol}:mod_root]}"
|
||||
local -i depth
|
||||
local dir
|
||||
for dir in ${mod_root}/*/${PMODULES_MODULEFILES_DIR}; do
|
||||
if [[ -n "${GroupDepths[${group}]}" ]]; then
|
||||
local group="${dir%/*}"
|
||||
group="${group##*/}"
|
||||
if [[ ! -v GroupDepths[${group}] ]]; then
|
||||
compute_group_depth depth "${dir}"
|
||||
GroupDepths[$group]=${depth}
|
||||
fi
|
||||
|
||||
+29
-6
@@ -489,6 +489,19 @@ build_modules_yaml(){
|
||||
_result='base'
|
||||
}
|
||||
|
||||
yaml_get_systems(){
|
||||
local -n _result="$1"
|
||||
local fname="$2"
|
||||
local version="$3"
|
||||
local idx="$4"
|
||||
_result=$(yq -Ne e ".\"${version}\"[${idx}].systems" \
|
||||
"${fname}" 2>/dev/null)
|
||||
(( $? == 0 )) && return
|
||||
_result=$(yq -Ne e ".systems" "${fname}" 2>/dev/null)
|
||||
(( $? == 0 )) && return
|
||||
_result='any'
|
||||
}
|
||||
|
||||
yaml_get_dependencies(){
|
||||
local -n _result="$1"
|
||||
local fname="$2"
|
||||
@@ -519,16 +532,12 @@ build_modules_yaml(){
|
||||
local m
|
||||
local pattern="//"
|
||||
for m in "${with_modules[@]}"; do
|
||||
if [[ -n $(awk "/${m%/*}[\/ ]/" "${fname}") ]]; then
|
||||
pattern+=" && /${m//\//\\/}/"
|
||||
fi
|
||||
pattern+=" && /${m//\//\\/}/"
|
||||
done
|
||||
|
||||
local -a versions
|
||||
yaml_get_versions versions "${fname}" "${name}/${version}"
|
||||
echo versions=${versions[@]}
|
||||
for v in "${versions[@]}"; do
|
||||
echo version=$v
|
||||
local -i n_variants
|
||||
yaml_get_num_variants n_variants "${fname}" "${v}"
|
||||
local -i i
|
||||
@@ -548,7 +557,21 @@ build_modules_yaml(){
|
||||
yaml_get_dependencies deps "${fname}" "${v}" $i
|
||||
ol_inst_root="${OverlayInfo[${ol_name}:inst_root]}"
|
||||
ol_mod_root="${OverlayInfo[${ol_name}:mod_root]}"
|
||||
|
||||
|
||||
local systems
|
||||
yaml_get_systems systems "${fname}" "${v}" $i
|
||||
# build module if
|
||||
# - systems is any
|
||||
# - opt_system is listed in systems
|
||||
local build_it='no'
|
||||
if [[ "${systems}" == 'any' ]]; then
|
||||
build_it='yes'
|
||||
fi
|
||||
if [[ ,${systems}, == *,${opt_system},* ]]; then
|
||||
build_it='yes'
|
||||
fi
|
||||
[[ ${build_it} == 'no' ]] && continue
|
||||
|
||||
if (( ${#deps[@]} > 0 )); then
|
||||
while read -a with_modules; do
|
||||
pbuild.build_module \
|
||||
|
||||
@@ -1514,7 +1514,7 @@ subcommand_use() {
|
||||
if [[ ! -v GroupDepths[${arg}] ]]; then
|
||||
# this scan is required if a new group has been
|
||||
# create inside an used overlay
|
||||
scan_groups "${!OverlayInfo[@]}"
|
||||
scan_groups "${UsedOverlays[@]}"
|
||||
g_env_must_be_saved='yes'
|
||||
fi
|
||||
if [[ -n ${GroupDepths[${arg}]} ]]; then
|
||||
@@ -2757,8 +2757,21 @@ if [[ -n ${PMODULES_ENV} ]]; then
|
||||
eval "$("${base64}" -d <<< "${PMODULES_ENV}" 2>/dev/null)"
|
||||
fi
|
||||
if [[ -z ${Version} ]] || [[ ${Version} != ${PMODULES_VERSION} ]]; then
|
||||
# this can only happen if the last command was
|
||||
# module load Pmodules/${PMODULES_VERSION}
|
||||
#
|
||||
# the values these two variables must be saved before initialising
|
||||
declare _tmp_loaded_modules_="${LOADEDMODULES}"
|
||||
declare _tmp_lmfiles_="${_LMFILES_}"
|
||||
|
||||
pmodules_init
|
||||
#g_env_must_be_saved='yes'
|
||||
|
||||
# restore and export
|
||||
LOADEDMODULES="${_tmp_loaded_modules_}"
|
||||
_LMFILES_="${_tmp_lmfiles_}"
|
||||
export_env \
|
||||
LOADEDMODULES \
|
||||
_LMFILES_
|
||||
fi
|
||||
|
||||
if (( ${#GroupDepths[@]} == 0 )); then
|
||||
|
||||
Reference in New Issue
Block a user