From: Gary V. Vaughan Date: Thu, 10 Jun 2010 14:02:48 +0000 (+0700) Subject: Support shell tracing inside functions even with ksh. X-Git-Tag: v2.4~164 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cd0b95778b73f5101d4e10bda30a24191d8e1eae;p=thirdparty%2Flibtool.git Support shell tracing inside functions even with ksh. * libltdl/config/getopt.m4sh: Set $opt_debug to be either `:' or `set -x' depending on whether --debug was parsed to match usage in libtoolize.m4sh and ltmain.m4sh. * clcommit.m4sh, libltdl/config/announce-gen.sh: Instead of `$opt_debug && ...', use `test "$opt_debug" != ":" && ...'. * clcommit.m4sh, libltdl/config/announce-gen.m4sh, libltdl/config/getopt.m4sh, libltdl/connfig/mailnotify.m4sh: Execute at the start of functions to cater to ksh, which resets `-x' inside shell functions. Signed-off-by: Gary V. Vaughan --- diff --git a/ChangeLog b/ChangeLog index 170e9d5ce..ce76dcfd4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2010-06-10 Gary V. Vaughan + Support shell tracing inside functions even with ksh. + * libltdl/config/getopt.m4sh: Set $opt_debug to be either `:' + or `set -x' depending on whether --debug was parsed to match + usage in libtoolize.m4sh and ltmain.m4sh. + * clcommit.m4sh, libltdl/config/announce-gen.sh: Instead of + `$opt_debug && ...', use `test "$opt_debug" != ":" && ...'. + * clcommit.m4sh, libltdl/config/announce-gen.m4sh, + libltdl/config/getopt.m4sh, libltdl/connfig/mailnotify.m4sh: + Execute at the start of functions to cater to ksh, which + resets `-x' inside shell functions. + Fix a typu in HACKING. * HACKING (Release Procedure): s/Makeflie/Makefile/. diff --git a/clcommit.m4sh b/clcommit.m4sh index 6157cd295..8292d6a66 100644 --- a/clcommit.m4sh +++ b/clcommit.m4sh @@ -135,7 +135,7 @@ M4SH_GETOPTS( [], [--tags], [], [], [ # pass debug flag along to mailnotify - $opt_debug && + test "$opt_debug" != ":" && mailnotify_flags="${mailnotify_flags+$mailnotify_flags }--debug" # validate $opt_first, $opt_file and $opt_message @@ -172,6 +172,8 @@ set -e # func_check_conflicts func_check_conflicts () { + $opt_debug + func_verbose "checking for commit conflicts..." if $GIT push --dry-run > "$push_conflicts" 2>&1; then :; else cat "$push_conflicts" >&2 @@ -183,6 +185,8 @@ func_check_conflicts () # func_check_commit_msg func_check_commit_msg () { + $opt_debug + if test -z "$opt_changelog"; then for f in ${1+"$@"}; do case "$f" in @@ -258,6 +262,8 @@ func_check_commit_msg () # func_commit func_commit () { + $opt_debug + ${PAGER-more} "$log_file" || exit $EXIT_FAILURE sleep 1 # give the user some time for a ^C @@ -280,6 +286,8 @@ func_commit () # func_mailnotify func_mailnotify () { + $opt_debug + notify_file="${log_dir}/notify" func_verbose "Mailing commit notification to \"$opt_sendmail\"" diff --git a/libltdl/config/announce-gen.m4sh b/libltdl/config/announce-gen.m4sh index 2eb021c0f..a528fefde 100644 --- a/libltdl/config/announce-gen.m4sh +++ b/libltdl/config/announce-gen.m4sh @@ -187,7 +187,7 @@ M4SH_GETOPTS( } # pass trace argument along to mailnotify too - $opt_debug && + test "$opt_debug" != ":" && mailnotify_flags="${mailnotify_flags+$mailnotify_flags }--debug" # validate remaining command line args as destination addresses @@ -205,6 +205,8 @@ set -e # func_print_changelog_deltas func_print_changelog_deltas () { + $opt_debug + # FIXME: Jim's announce-gen does something with ChangeLogs # and cvs diff. We don't use CVS, and perl makes # my eyes bleed... maybe I'll write this function @@ -216,6 +218,8 @@ func_print_changelog_deltas () # func_print_checksums title filename... func_print_checksums () { + $opt_debug + my_title="$1"; shift test -n "$1" && { @@ -240,6 +244,8 @@ func_print_checksums () # func_print_locations title url files func_print_locations () { + $opt_debug + test -n "$3" && { echo echo "Here are the $1:" @@ -258,6 +264,8 @@ func_print_locations () # func_print_news_deltas func_print_news_deltas () { + $opt_debug + my_news_file="$top_srcdir/NEWS" my_skipping=: @@ -289,6 +297,8 @@ func_print_news_deltas () # func_tool_versions toolname... func_print_tool_versions () { + $opt_debug + test -n "$1" && { echo echo "This release was bootstrapped with the following tools:" diff --git a/libltdl/config/getopt.m4sh b/libltdl/config/getopt.m4sh index 2899539c7..c37864071 100644 --- a/libltdl/config/getopt.m4sh +++ b/libltdl/config/getopt.m4sh @@ -420,7 +420,7 @@ m4_define([m4go_optional_file_arg], m4_define([m4go_printopts], [ # Option defaults: -opt_debug=false +opt_debug=: m4go_defaults # Parse options once, thoroughly. This comes as soon as possible in the @@ -437,9 +437,9 @@ m4go_defaults opt="[$]1" shift case $opt in - --debug|-x) opt_debug=: + --debug|-x) opt_debug='set -x' func_echo "enabling shell trace mode" - set -x + $opt_debug ;; m4go_branches -\?|-h) func_usage ;; @@ -502,6 +502,8 @@ m4_divert_pop([KILL])M4SH_VERBATIM([[ # Echo version message to standard output and exit. func_version () { + $opt_debug + $SED -n '/(C)/!b go :more /\./!{ @@ -523,6 +525,8 @@ func_version () # Echo short help message to standard output and exit. func_usage () { + $opt_debug + $SED -n '/^# Usage:/,/^# *.*--help/ { s/^# // s/^# *$// @@ -539,6 +543,8 @@ func_usage () # unless 'noexit' is passed as argument. func_help () { + $opt_debug + $SED -n '/^# Usage:/,/# Report bugs to/ { s/^# // s/^# *$// @@ -564,6 +570,8 @@ func_help () # exit_cmd. func_missing_arg () { + $opt_debug + func_error "missing argument for $1." exit_cmd=exit } diff --git a/libltdl/config/mailnotify.m4sh b/libltdl/config/mailnotify.m4sh index d8a24e3b0..af60de566 100644 --- a/libltdl/config/mailnotify.m4sh +++ b/libltdl/config/mailnotify.m4sh @@ -149,6 +149,8 @@ set -e # separated list of fully qualified destination addresses. func_headers () { + $opt_debug + my_outfile="$1" my_destination="$2" my_sed_version_no=' @@ -185,6 +187,8 @@ func_headers () # Send the only message part as a single mime mail part. func_single_content () { + $opt_debug + my_outfile="$1" $opt_dry_run || cat >> "$my_outfile" <