From d916dd1dfe4b8b9e5b6d42420917e0eca6920444 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Mon, 13 Jun 2022 11:11:28 +0200 Subject: [PATCH] refactor: ol_dir -> ol_mod_root and ol_install_dir -> ol_inst_root --- Pmodules/libmodules.tcl | 24 ++++++++++++------------ Pmodules/libpbuild.bash | 4 ++-- Pmodules/modbuild.in | 18 +++++++++--------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Pmodules/libmodules.tcl b/Pmodules/libmodules.tcl index 074550e..942ae33 100644 --- a/Pmodules/libmodules.tcl +++ b/Pmodules/libmodules.tcl @@ -329,20 +329,20 @@ proc _find_overlay { modulefile_components } { debug "_find_overlay()" foreach ol $::UsedOverlays { debug "$ol" - set ol_dir $::OverlayInfo(${ol}:mod_root) - if { [string range $ol_dir end end] == "/" } { - set ol_dir [string range $ol_dir 0 end-1] + set ol_mod_root $::OverlayInfo(${ol}:mod_root) + if { [string range $ol_mod_root end end] == "/" } { + set ol_mod_root [string range $ol_mod_root 0 end-1] } - debug "$ol_dir" - set ol_dir_splitted [file split $ol_dir] + debug "$ol_mod_root" + set ol_mod_root_splitted [file split $ol_mod_root] set modulefile_root [file join \ {*}[lrange \ $modulefile_components \ - 0 [expr [llength $ol_dir_splitted] - 1]]] + 0 [expr [llength $ol_mod_root_splitted] - 1]]] debug "$modulefile_root" - if { [string compare $ol_dir $modulefile_root] == 0 } { - debug "$ol_dir_splitted" - return $ol_dir_splitted + if { [string compare $ol_mod_root $modulefile_root] == 0 } { + debug "$ol_mod_root_splitted" + return $ol_mod_root_splitted } } debug "not found" @@ -374,8 +374,8 @@ proc _pmodules_init_global_vars { } { set modulefile_splitted [file split $::ModulesCurrentModulefile] - set ol_dir_splitted [_find_overlay ${modulefile_splitted}] - set rel_modulefile [lrange $modulefile_splitted [llength $ol_dir_splitted] end] + set ol_mod_root_splitted [_find_overlay ${modulefile_splitted}] + set rel_modulefile [lrange $modulefile_splitted [llength $ol_mod_root_splitted] end] set group [lindex $rel_modulefile 0] set GROUP "${group}" set name [lindex $modulefile_splitted end-1] @@ -386,7 +386,7 @@ proc _pmodules_init_global_vars { } { set V_RELEASE [lindex [split $tmp _] 0] lassign [split $V_PKG .] V_MAJOR V_MINOR V_PATCHLVL set variant [lrange $rel_modulefile 2 end] - set mod_root [file join {*}$ol_dir_splitted] + set mod_root [file join {*}$ol_mod_root_splitted] debug "mod_root=$mod_root" set ol $::Dir2OverlayMap($mod_root) debug "ol=$ol" diff --git a/Pmodules/libpbuild.bash b/Pmodules/libpbuild.bash index ad62e80..c9abe8a 100644 --- a/Pmodules/libpbuild.bash +++ b/Pmodules/libpbuild.bash @@ -769,7 +769,7 @@ pbuild::make_all() { "${module_name}") modulefile_name="${modulefile_dir}/${module_version}" - PREFIX="${ol_install_dir}/${GROUP}/${module_name}/${module_version}" + PREFIX="${ol_inst_root}/${GROUP}/${module_name}/${module_version}" local -i i=0 for ((i=${#names[@]}-1; i >= 0; i--)); do PREFIX+="/${names[i]}" @@ -1482,7 +1482,7 @@ pbuild.bootstrap() { MODULECMD=$(which true) GROUP='Tools' - PREFIX="${ol_dir}/${GROUP}/Pmodules/${PMODULES_VERSION}" + PREFIX="${ol_mod_root}/${GROUP}/Pmodules/${PMODULES_VERSION}" C_INCLUDE_PATH="${PREFIX}/include" CPLUS_INCLUDE_PATH="${PREFIX}/include" diff --git a/Pmodules/modbuild.in b/Pmodules/modbuild.in index fa1afb6..4c0665a 100755 --- a/Pmodules/modbuild.in +++ b/Pmodules/modbuild.in @@ -62,8 +62,8 @@ declare -r ARGS="$@" shopt -s nocaseglob shopt -s extglob -declare ol_dir -declare ol_install_dir +declare ol_mod_root +declare ol_inst_root ############################################################################## # @@ -434,8 +434,8 @@ build_modules_legacy() { fi declare ol_name='base' declare ol_type='' - declare ol_dir="${pm_root}" - declare ol_install_dir="${pm_root}" + declare ol_mod_root="${pm_root}" + declare ol_inst_root="${pm_root}" local -i i=0 local -i num_variants=${#variants[@]} for ((i = 0; i < num_variants; i++)); do @@ -534,7 +534,7 @@ build_modules_yaml(){ local m local pattern="//" for m in "${with_modules[@]}"; do - if [[ -n $(awk "/${m%/*}[\/ ]/" "${files[@]}") ]]; then + if [[ -n $(awk "/${m%/*}[\/ ]/" "${fname}") ]]; then pattern+=" && /${m//\//\\/}/" fi done @@ -561,8 +561,8 @@ build_modules_yaml(){ fi yaml_get_relstage relstage "${fname}" "${v}" $i yaml_get_dependencies deps "${fname}" "${v}" $i - ol_install_dir="${OverlayInfo[${ol_name}:inst_root]}" - ol_dir="${OverlayInfo[${ol_name}:mod_root]}" + ol_inst_root="${OverlayInfo[${ol_name}:inst_root]}" + ol_mod_root="${OverlayInfo[${ol_name}:mod_root]}" if (( ${#deps[@]} > 0 )); then while read -a with_modules; do @@ -636,8 +636,8 @@ module_name=${fname[${#fname[@]}-2]} if [[ "${opt_bootstrap}" == 'yes' ]]; then declare ol_name='base' declare ol_type='' - declare ol_dir="${pm_root}" - declare ol_install_dir="${pm_root}" + declare ol_mod_root="${pm_root}" + declare ol_inst_root="${pm_root}" pbuild.bootstrap "${module_name}" "${versions[0]}" 'stable' exit $? fi