install: add --enable-silent-shell-debug-support configure opt

Add the ability to control whether or not code to support silent shell
debug should be added to the module function and sh-kind initialization
scripts. Enabled by default

Fixes #166
This commit is contained in:
Xavier Delaruelle
2018-09-03 07:01:50 +02:00
parent 924b10864c
commit f700e055d4
14 changed files with 148 additions and 105 deletions

View File

@@ -83,7 +83,7 @@ matrix:
- cmake3
- r-base-core
- env: CONFIGURE_OPTS='--with-tclsh=tclsh8.4 --prefix=/tmp/modules --enable-compat-version --enable-versioning --with-loadedmodules=null:dot --without-pager'
- env: CONFIGURE_OPTS='--with-tclsh=tclsh8.4 --prefix=/tmp/modules --enable-compat-version --enable-versioning --disable-silent-shell-debug-support --with-loadedmodules=null:dot --without-pager'
EXTRA_SCRIPT_PRETEST='make install-testmodulerc install-testsiteconfig install-testmodspath-empty' EXTRA_SCRIPT_POSTTEST='make uninstall-testconfig'
addons:
apt:

View File

@@ -242,6 +242,10 @@ instance ``--disable-set-manpath``):
to Modules version is added to the shared modulepath and
enables to switch from one Modules version to another.
(default=no)
--enable-silent-shell-debug-support
Generate code in module function definition and
initialization scripts to add support for silencing
shell debugging properties (default=yes)
--enable-auto-handling
Set modulecmd.tcl to automatically apply automated
modulefiles handling actions, like loading the

View File

@@ -85,6 +85,12 @@ else
setnotversioning :=
endif
ifeq ($(silentshdbgsupport),y)
setsilentshdbgsupport :=
else
setsilentshdbgsupport := \#
endif
ifeq ($(autohandling),y)
setautohandling := 1
else
@@ -104,6 +110,7 @@ sed -e 's|@prefix@|$(prefix)|g' \
-e 's|@pager@|$(pager)|g' \
-e 's|@pageropts@|$(pageropts)|g' \
-e 's|@autohandling@|$(setautohandling)|g' \
-e 's|@silentshdbgsupport@|$(setsilentshdbgsupport)|g' \
-e 's|@VERSIONING@|$(setversioning)|g' \
-e 's|@NOTVERSIONING@|$(setnotversioning)|g' \
-e 's|@MODULES_RELEASE@|$(MODULES_RELEASE)|g' \

View File

@@ -23,6 +23,8 @@ VERSION := @VERSION@
modulepath := @modulepath@
loadedmodules := @loadedmodules@
# silent shell debug support
silentshdbgsupport := @silentshdbgsupport@
# runtime quarantine mechanism
quarantinevars := @quarantinevars@

11
configure vendored
View File

@@ -30,8 +30,8 @@ arglist="TCLSH SPHINXBUILD PS BASENAME RMDIR_IGN_NON_EMPTY VERSION \
baseprefix prefix bindir libexecdir etcdir initdir datarootdir mandir docdir \
modulefilesdir setmanpath appendmanpath setbinpath appendbinpath \
setdotmodulespath docinstall examplemodulefiles builddoc gitworktree \
usemanpath compatversion EXEEXT versioning autohandling pager pageropts \
modulepath loadedmodules quarantinevars"
usemanpath compatversion EXEEXT versioning silentshdbgsupport autohandling \
pager pageropts modulepath loadedmodules quarantinevars"
compatarglist=
# flags to know if argument has been specified on command-line
@@ -51,6 +51,7 @@ examplemodulefiles=y
compatversion=y
EXEEXT=
versioning=n
silentshdbgsupport=y
autohandling=n
loadedmodules=
quarantinevars=
@@ -147,6 +148,10 @@ Optional Features:
versioning enabled Modules installation, containing
modulefiles that enable to switch from one Modules
version to another [no]
--enable-silent-shell-debug-support
generate code in module function definition and
initialization scripts to add support for silencing
shell debugging properties [yes]
--enable-auto-handling set modulecmd.tcl to automatically apply automated
modulefiles handling actions, like loading the
pre-requisites of a modulefile when loading this
@@ -309,6 +314,8 @@ for arg in "$@"; do
defcompatversion=0 ;;
--enable-versioning*|--disable-versioning)
versioning=$(get_feature_value "$arg") ;;
--enable-silent-shell-debug-support*|--disable-silent-shell-debug-support)
silentshdbgsupport=$(get_feature_value "$arg") ;;
--enable-auto-handling*|--disable-auto-handling)
autohandling=$(get_feature_value "$arg") ;;
--with-bin-search-path=*|--without-bin-search-path)

View File

@@ -88,6 +88,11 @@ else
usemanpathre := /@usemanpath@/d
notusemanpathre := s|@notusemanpath@||g
endif
ifeq ($(silentshdbgsupport),y)
silentshdbgsupportre := s|@silentshdbgsupport@||g
else
silentshdbgsupportre := /@silentshdbgsupport@/d
endif
# comment entries if feature not enabled
ifeq ($(versioning),y)
@@ -131,6 +136,7 @@ sed -e 's|@prefix@|$(prefix)|g' \
-e '$(prependbinpathre)' \
-e '$(compatversionre)' \
-e '$(notcompatversionre)' \
-e '$(silentshdbgsupportre)' \
-e '$(usemanpathre)' \
-e '$(notusemanpathre)' \
-e $$'s|@modulerc@|$(modulerc)|g' \

View File

@@ -1,15 +1,15 @@
unset _mlshdbg;
# disable shell debugging for the run of this init file
if [ "${MODULES_SILENT_SHELL_DEBUG:-0}" = '1' ]; then
# immediately disable debugging to echo the less number of line possible
case "$-" in
*v*x*) set +vx; _mlshdbg='vx' ;;
*v*) set +v; _mlshdbg='v' ;;
*x*) set +x; _mlshdbg='x' ;;
*) _mlshdbg='' ;;
esac;
fi;
@silentshdbgsupport@unset _mlshdbg;
@silentshdbgsupport@# disable shell debugging for the run of this init file
@silentshdbgsupport@if [ "${MODULES_SILENT_SHELL_DEBUG:-0}" = '1' ]; then
@silentshdbgsupport@ # immediately disable debugging to echo the less number of line possible
@silentshdbgsupport@ case "$-" in
@silentshdbgsupport@ *v*x*) set +vx; _mlshdbg='vx' ;;
@silentshdbgsupport@ *v*) set +v; _mlshdbg='v' ;;
@silentshdbgsupport@ *x*) set +x; _mlshdbg='x' ;;
@silentshdbgsupport@ *) _mlshdbg='' ;;
@silentshdbgsupport@ esac;
@silentshdbgsupport@fi;
@silentshdbgsupport@
# define modules runtine quarantine configuration
@setquarvars@export MODULES_RUN_QUARANTINE='@RUN_QUARANTINE@'
@setquarvars@@export RUNENV_VAR='RUNENV_VAL'@
@@ -114,8 +114,8 @@ fi
@setmanpath@@appendmanpath@ MANPATH=$manpath${manpath:+:}@mandir@; export MANPATH
@setmanpath@fi
@setmanpath@
# restore shell debugging options if disabled
if [ -n "${_mlshdbg:-}" ]; then
set -$_mlshdbg;
unset _mlshdbg;
fi;
@silentshdbgsupport@# restore shell debugging options if disabled
@silentshdbgsupport@if [ -n "${_mlshdbg:-}" ]; then
@silentshdbgsupport@ set -$_mlshdbg;
@silentshdbgsupport@ unset _mlshdbg;
@silentshdbgsupport@fi;

View File

@@ -1,15 +1,15 @@
unset _mlshdbg;
# disable shell debugging for the run of this init file
if [ "${MODULES_SILENT_SHELL_DEBUG:-0}" = '1' ]; then
# immediately disable debugging to echo the less number of line possible
case "$-" in
*v*x*) set +vx; _mlshdbg='vx' ;;
*v*) set +v; _mlshdbg='v' ;;
*x*) set +x; _mlshdbg='x' ;;
*) _mlshdbg='' ;;
esac;
fi;
@silentshdbgsupport@unset _mlshdbg;
@silentshdbgsupport@# disable shell debugging for the run of this init file
@silentshdbgsupport@if [ "${MODULES_SILENT_SHELL_DEBUG:-0}" = '1' ]; then
@silentshdbgsupport@ # immediately disable debugging to echo the less number of line possible
@silentshdbgsupport@ case "$-" in
@silentshdbgsupport@ *v*x*) set +vx; _mlshdbg='vx' ;;
@silentshdbgsupport@ *v*) set +v; _mlshdbg='v' ;;
@silentshdbgsupport@ *x*) set +x; _mlshdbg='x' ;;
@silentshdbgsupport@ *) _mlshdbg='' ;;
@silentshdbgsupport@ esac;
@silentshdbgsupport@fi;
@silentshdbgsupport@
# define modules runtine quarantine configuration
@setquarvars@export MODULES_RUN_QUARANTINE='@RUN_QUARANTINE@'
@setquarvars@@export RUNENV_VAR='RUNENV_VAL'@
@@ -112,9 +112,9 @@ fi
@setmanpath@fi
@setmanpath@
unset _mlinstr
# restore shell debugging options if disabled
if [ -n "${_mlshdbg:-}" ]; then
set -$_mlshdbg;
unset _mlshdbg;
fi;
@silentshdbgsupport@
@silentshdbgsupport@# restore shell debugging options if disabled
@silentshdbgsupport@if [ -n "${_mlshdbg:-}" ]; then
@silentshdbgsupport@ set -$_mlshdbg;
@silentshdbgsupport@ unset _mlshdbg;
@silentshdbgsupport@fi;

View File

@@ -1,15 +1,15 @@
unset _mlshdbg;
# disable shell debugging for the run of this init file
if [ "${MODULES_SILENT_SHELL_DEBUG:-0}" = '1' ]; then
# immediately disable debugging to echo the less number of line possible
case "$-" in
*v*x*) set +vx; _mlshdbg='vx' ;;
*v*) set +v; _mlshdbg='v' ;;
*x*) set +x; _mlshdbg='x' ;;
*) _mlshdbg='' ;;
esac;
fi;
@silentshdbgsupport@unset _mlshdbg;
@silentshdbgsupport@# disable shell debugging for the run of this init file
@silentshdbgsupport@if [ "${MODULES_SILENT_SHELL_DEBUG:-0}" = '1' ]; then
@silentshdbgsupport@ # immediately disable debugging to echo the less number of line possible
@silentshdbgsupport@ case "$-" in
@silentshdbgsupport@ *v*x*) set +vx; _mlshdbg='vx' ;;
@silentshdbgsupport@ *v*) set +v; _mlshdbg='v' ;;
@silentshdbgsupport@ *x*) set +x; _mlshdbg='x' ;;
@silentshdbgsupport@ *) _mlshdbg='' ;;
@silentshdbgsupport@ esac;
@silentshdbgsupport@fi;
@silentshdbgsupport@
# define modules runtine quarantine configuration
@setquarvars@export MODULES_RUN_QUARANTINE='@RUN_QUARANTINE@'
@setquarvars@@export RUNENV_VAR='RUNENV_VAL'@
@@ -114,8 +114,8 @@ BASH_ENV=@initdir@/bash; export BASH_ENV
@setmanpath@@appendmanpath@ *) MANPATH=$manpath${manpath:+:}@mandir@; export MANPATH
@setmanpath@esac
@setmanpath@
# restore shell debugging options if disabled
if [ -n "${_mlshdbg:-}" ]; then
set -$_mlshdbg;
unset _mlshdbg;
fi;
@silentshdbgsupport@# restore shell debugging options if disabled
@silentshdbgsupport@if [ -n "${_mlshdbg:-}" ]; then
@silentshdbgsupport@ set -$_mlshdbg;
@silentshdbgsupport@ unset _mlshdbg;
@silentshdbgsupport@fi;

View File

@@ -1,15 +1,15 @@
unset _mlshdbg;
# disable shell debugging for the run of this init file
if [ "${MODULES_SILENT_SHELL_DEBUG:-0}" = '1' ]; then
# immediately disable debugging to echo the less number of line possible
case "$-" in
*v*x*) set +vx; _mlshdbg='vx' ;;
*v*) set +v; _mlshdbg='v' ;;
*x*) set +x; _mlshdbg='x' ;;
*) _mlshdbg='' ;;
esac;
fi;
@silentshdbgsupport@unset _mlshdbg;
@silentshdbgsupport@# disable shell debugging for the run of this init file
@silentshdbgsupport@if [ "${MODULES_SILENT_SHELL_DEBUG:-0}" = '1' ]; then
@silentshdbgsupport@ # immediately disable debugging to echo the less number of line possible
@silentshdbgsupport@ case "$-" in
@silentshdbgsupport@ *v*x*) set +vx; _mlshdbg='vx' ;;
@silentshdbgsupport@ *v*) set +v; _mlshdbg='v' ;;
@silentshdbgsupport@ *x*) set +x; _mlshdbg='x' ;;
@silentshdbgsupport@ *) _mlshdbg='' ;;
@silentshdbgsupport@ esac;
@silentshdbgsupport@fi;
@silentshdbgsupport@
# define modules runtine quarantine configuration
@setquarvars@export MODULES_RUN_QUARANTINE='@RUN_QUARANTINE@'
@setquarvars@@export RUNENV_VAR='RUNENV_VAL'@
@@ -111,8 +111,8 @@ fi
@setmanpath@@appendmanpath@ MANPATH=$manpath${manpath:+:}@mandir@; export MANPATH
@setmanpath@fi
@setmanpath@
# restore shell debugging options if disabled
if [ -n "${_mlshdbg:-}" ]; then
set -$_mlshdbg;
unset _mlshdbg;
fi;
@silentshdbgsupport@# restore shell debugging options if disabled
@silentshdbgsupport@if [ -n "${_mlshdbg:-}" ]; then
@silentshdbgsupport@ set -$_mlshdbg;
@silentshdbgsupport@ unset _mlshdbg;
@silentshdbgsupport@fi;

View File

@@ -4335,16 +4335,18 @@ if ( ! \$?histchars && ! \$?prompt ) alias module '$eval_cmd' ;"
# an empty runtime variable is set even if no corresponding
# MODULES_RUNENV_* variable found, as var cannot be unset on
# modified environment command-line
set fdef "${fname}() {
unset _mlshdbg;
if \[ \"\$\{MODULES_SILENT_SHELL_DEBUG:-0\}\" = '1' \]; then
case \"$-\" in
*v*x*) set +vx; _mlshdbg='vx' ;;
*v*) set +v; _mlshdbg='v' ;;
*x*) set +x; _mlshdbg='x' ;;
*) _mlshdbg='' ;;
esac;
fi;
set fdef "${fname}() {"
@silentshdbgsupport@ append fdef {
@silentshdbgsupport@ unset _mlshdbg;
@silentshdbgsupport@ if [ "${MODULES_SILENT_SHELL_DEBUG:-0}" = '1' ]; then
@silentshdbgsupport@ case "$-" in
@silentshdbgsupport@ *v*x*) set +vx; _mlshdbg='vx' ;;
@silentshdbgsupport@ *v*) set +v; _mlshdbg='v' ;;
@silentshdbgsupport@ *x*) set +x; _mlshdbg='x' ;;
@silentshdbgsupport@ *) _mlshdbg='' ;;
@silentshdbgsupport@ esac;
@silentshdbgsupport@ fi;}
append fdef "
unset _mlre _mlIFS;
if \[ -n \"\${IFS+x}\" \]; then
_mlIFS=\$IFS;
@@ -4372,11 +4374,13 @@ $::g_shell '\"\$@\"'`;
else
unset IFS;
fi;
unset _mlre _mlv _mlrv _mlIFS;
if [ -n "${_mlshdbg:-}" ]; then
set -$_mlshdbg;
fi;
unset _mlshdbg;
unset _mlre _mlv _mlrv _mlIFS;}
@silentshdbgsupport@ append fdef {
@silentshdbgsupport@ if [ -n "${_mlshdbg:-}" ]; then
@silentshdbgsupport@ set -$_mlshdbg;
@silentshdbgsupport@ fi;
@silentshdbgsupport@ unset _mlshdbg;}
append fdef {
return $_mlstatus;}
append fdef "\n};"
if {[isStderrTty]} {

View File

@@ -14,6 +14,7 @@ set install_version "@VERSION@"
set install_modulepath {@modulepath@}
set install_loadedmodules "@loadedmodules@"
set install_silentshdbgsupport "@silentshdbgsupport@"
set install_quarantinevars "@quarantinevars@"
set install_compatversion "@compatversion@"

View File

@@ -225,6 +225,7 @@ if {$install_loadedmodules ne ""} {
# basic test for MODULES_SILENT_SHELL_DEBUG, checking module answer is still present
# among the debugging output
if {$install_silentshdbgsupport eq y} {
if {$verbose > 0} {
send_user "\tChecking MODULES_SILENT_SHELL_DEBUG\n"
send_user "\tSetup MODULES_SILENT_SHELL_DEBUG = '1'\n"
@@ -268,12 +269,16 @@ foreach shell $shell_sh_family {
}
}
unset env(MODULES_SILENT_SHELL_DEBUG)
} elseif {$verbose > 0} {
send_user "\tSkipping silent shell debug checks\n"
}
#
# Clean up variables used in this test case
#
unset env(MODULES_SILENT_SHELL_DEBUG)
unset bad_cmd
unset use_desc
unset mod_examples

View File

@@ -103,17 +103,8 @@ set func_quar_zsh "\\s*unset _mlre _mlIFS;
\\s*IFS=' ';
\\s*for _mlv in \\\${=MODULES_RUN_QUARANTINE:-}; do
$end_quar_sh"
set func_clean_ifs "\\s*if \\\[ -n \"\\\${_mlIFS\\\+x}\" \\\]; then
\\s*IFS=\\\$_mlIFS;
\\s*else
\\s*unset IFS;
\\s*fi;
\\s*unset _mlre _mlv _mlrv _mlIFS;
\\s*if \\\[ -n \"\\\${_mlshdbg:-}\" \\\]; then
\\s*set -\\\$_mlshdbg;
\\s*fi;
\\s*unset _mlshdbg;
\\s*return \\\$_mlstatus;"
if {$install_silentshdbgsupport eq y} {
set func_silentdbg "\\s*unset _mlshdbg;
\\s*if \\\[ \"\\\${MODULES_SILENT_SHELL_DEBUG:-0}\" = '1' \\\]; then
\\s*case \"\\\$-\" in
@@ -122,7 +113,23 @@ set func_silentdbg "\\s*unset _mlshdbg;
\\s*\\\*x\\\*\\\) set \\\+x; _mlshdbg='x' ;;
\\s*\\\*\\\) _mlshdbg='' ;;
\\s*esac;
\\s*fi;"
\\s*fi;\n"
set end_silentdbg "\\s*if \\\[ -n \"\\\${_mlshdbg:-}\" \\\]; then
\\s*set -\\\$_mlshdbg;
\\s*fi;
\\s*unset _mlshdbg;\n"
} else {
set func_silentdbg ""
set end_silentdbg ""
}
set func_clean_ifs "\\s*if \\\[ -n \"\\\${_mlIFS\\\+x}\" \\\]; then
\\s*IFS=\\\$_mlIFS;
\\s*else
\\s*unset IFS;
\\s*fi;
\\s*unset _mlre _mlv _mlrv _mlIFS;
$end_silentdbg\\s*return \\\$_mlstatus;"
set func_modcmd_sh "\\s*if \\\[ -n \"\\\${_mlre:-}\" \\\]; then
\\s*eval `eval \\\${_mlre}$install_tclsh $modulecmd_pathre sh '\"\\$\\@\"'`;
@@ -156,10 +163,10 @@ if {$is_stderr_tty} {
set add_func_fish ""
}
set func_sh "$func_name\\\(\\\) {\n$func_silentdbg\n$func_quar_sh\n$func_modcmd_sh\n\\s*_mlstatus=\\\$\\\?;\n$func_clean_ifs\n};$add_func_sh"
set func_bash "$func_name\\\(\\\) {\n$func_silentdbg\n$func_quar_sh\n$func_modcmd_bash\n\\s*_mlstatus=\\\$\\\?;\n$func_clean_ifs\n};$add_func_sh"
set func_ksh "$func_name\\\(\\\) {\n$func_silentdbg\n$func_quar_sh\n$func_modcmd_ksh\n\\s*_mlstatus=\\\$\\\?;\n$func_clean_ifs\n};$add_func_sh"
set func_zsh "$func_name\\\(\\\) {\n$func_silentdbg\n$func_quar_zsh\n$func_modcmd_zsh\n\\s*_mlstatus=\\\$\\\?;\n$func_clean_ifs\n};$add_func_sh"
set func_sh "$func_name\\\(\\\) {\n$func_silentdbg$func_quar_sh\n$func_modcmd_sh\n\\s*_mlstatus=\\\$\\\?;\n$func_clean_ifs\n};$add_func_sh"
set func_bash "$func_name\\\(\\\) {\n$func_silentdbg$func_quar_sh\n$func_modcmd_bash\n\\s*_mlstatus=\\\$\\\?;\n$func_clean_ifs\n};$add_func_sh"
set func_ksh "$func_name\\\(\\\) {\n$func_silentdbg$func_quar_sh\n$func_modcmd_ksh\n\\s*_mlstatus=\\\$\\\?;\n$func_clean_ifs\n};$add_func_sh"
set func_zsh "$func_name\\\(\\\) {\n$func_silentdbg$func_quar_zsh\n$func_modcmd_zsh\n\\s*_mlstatus=\\\$\\\?;\n$func_clean_ifs\n};$add_func_sh"
set func_csh "if \\\( \\\$\\\?histchars && \\\$\\\?prompt \\\) alias module 'set _histchars = \\\$histchars; unset histchars; set _prompt=\"\\\$prompt\"; set prompt=\"\"; eval \"`$install_tclsh $modulecmd_pathre csh \\\\!\\*:q`\"; set _exit=\"\\\$status\"; set histchars = \\\$_histchars; unset _histchars; set prompt=\"\\\$_prompt\"; unset _prompt; test 0 = \\\$_exit' ;
if \\\( \\\$\\\?histchars && \\\! \\\$\\\?prompt \\\) alias module 'set _histchars = \\\$histchars; unset histchars; eval \"`$install_tclsh $modulecmd_pathre csh \\\\!\\*:q`\"; set _exit=\"\\\$status\"; set histchars = \\\$_histchars; unset _histchars; test 0 = \\\$_exit' ;
if \\\( \\\! \\\$\\\?histchars && \\\$\\\?prompt \\\) alias module 'set _prompt=\"\\\$prompt\"; set prompt=\"\"; eval \"`$install_tclsh $modulecmd_pathre csh \\\\!\\*:q`\"; set _exit=\"\\\$status\"; set prompt=\"\\\$_prompt\"; unset _prompt; test 0 = \\\$_exit' ;