]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
Support shell tracing inside functions even with ksh.
authorGary V. Vaughan <gary@gnu.org>
Thu, 10 Jun 2010 14:02:48 +0000 (21:02 +0700)
committerGary V. Vaughan <gary@gnu.org>
Thu, 10 Jun 2010 14:02:48 +0000 (21:02 +0700)
* 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 <gary@gnu.org>
ChangeLog
clcommit.m4sh
libltdl/config/announce-gen.m4sh
libltdl/config/getopt.m4sh
libltdl/config/mailnotify.m4sh

index 170e9d5ceadcd8f93709170c2d0ebb4ff4baf754..ce76dcfd4bd5f77b37801c25ab5276939a7a070f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2010-06-10  Gary V. Vaughan  <gary@gnu.org>
 
+       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/.
 
index 6157cd295ac7d3bac4d065efdcff74a7e68c047a..8292d6a665a616d82b98c992f6e43041e1b68a9b 100644 (file)
@@ -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\""
 
index 2eb021c0f890018c2410ee748c63c334a2aaecf1..a528fefde0063e1f586fe37d7a8235056e24a3b7 100644 (file)
@@ -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:"
index 2899539c78712e8d9540f8d5a9f511cbdd12b8c3..c37864071ad74d663475660786fb55526f1fa8f7 100644 (file)
@@ -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
 }
index d8a24e3b080abd239acb89091d5c81c25d7e78f0..af60de566630b3e47eae67764b1108593f5c1161 100644 (file)
@@ -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" <<EOF
@@ -200,6 +204,8 @@ EOF
 # Send the various message parts to OUTFILE as a multipart mime mail.
 func_multipart_content ()
 {
+    $opt_debug
+
     my_outfile="$1"
     boundary="boundary-${HOST}-$$-`date | tr ' :' -`"
     $opt_dry_run || {
@@ -250,6 +256,8 @@ EOF
 #         sending domain.
 func_sendmail ()
 {
+    $opt_debug
+
     my_infile="$1"
     my_destination="$2"
     my_from="$3"
@@ -298,6 +306,8 @@ func_sendmail ()
 # func_extract_email_from_header re_header headerfile
 func_extract_email ()
 {
+    $opt_debug
+
     my_re_header="$1"
     my_headerfile="$2"
     $as_unset func_extract_email_result