This patch makes $dry_run obsolete in favor of using $dry only. This way, the repeated and error-prone setting of the latter is eliminated.
No, I don't have assignment for gnulib yet, but I guess I'll make some papers ready soon. I do believe this is a rather trivial patch, though. If you disagree, please hold back this trivial patch rather than the nontrivial (more important) ones which fix actual bugs. :) Cheers, Ralf 2005-09-13 Ralf Wildenhues <[EMAIL PROTECTED]> (tiny change) * gnulib-tool (dry_run): Remove use in favor of `dry'. (func_cp_if_changed, func_mv_if_changed, func_ln_if_changed) (func_import): Adjusted. Index: gnulib-tool =================================================================== RCS file: /cvsroot/gnulib/gnulib/gnulib-tool,v retrieving revision 1.76 diff -u -r1.76 gnulib-tool --- gnulib-tool 5 Sep 2005 11:40:42 -0000 1.76 +++ gnulib-tool 13 Sep 2005 12:59:50 -0000 @@ -134,13 +134,12 @@ # func_cp_if_changed SRC DEST # Like cp, but avoids munging timestamps if the file hasn't changed. # Uses also the variables -# - dry_run true if actions shall only be printed, blank otherwise +# - dry echo if actions shall only be printed, blank otherwise func_cp_if_changed () { if test $# -ne 2; then echo "usage: func_cp_if_changed SRC DEST" >&2 fi - test -n "$dry_run" && dry=echo if cmp "$1" "$2" >/dev/null 2>&1; then : else @@ -152,13 +151,12 @@ # Like mv, but avoids munging timestamps if the file hasn't changed. # Removes SRC if it is not renamed. # Uses also the variables -# - dry_run true if actions shall only be printed, blank otherwise +# - dry echo if actions shall only be printed, blank otherwise func_mv_if_changed () { if test $# -ne 2; then echo "usage: func_mv_if_changed SRC DEST" >&2 fi - test -n "$dry_run" && dry=echo if cmp "$1" "$2" >/dev/null 2>&1; then $dry rm "$1" else @@ -169,13 +167,12 @@ # func_ln_if_changed SRC DEST # Like ln -s, but avoids munging timestamps if the link is correct. # Uses also the variables -# - dry_run true if actions shall only be printed, blank otherwise +# - dry echo if actions shall only be printed, blank otherwise func_ln_if_changed () { if test $# -ne 2; then echo "usage: func_ln_if_changed SRC DEST" >&2 fi - test -n "$dry_run" && dry=echo if test -L "$2" -a "$1" = "`readlink "$2"`"; then : else @@ -198,7 +195,7 @@ # - lgpl true if --lgpl was given, blank otherwise # - libtool true if --libtool was given, blank otherwise # - do_changelog false if --no-changelog was given, : otherwise -# - dry_run true if --dry-run was given, blank otherwise +# - dry echo if --dry-run was given, blank otherwise { mode= destdir= @@ -214,7 +211,7 @@ libtool= macro_prefix= do_changelog=: - dry_run= + dry= symbolic= supplied_opts="$@" @@ -337,7 +334,7 @@ do_changelog=false shift ;; --dry-run ) - dry_run=true + dry=echo shift ;; -s | --symbolic | --symlink ) symbolic=true @@ -748,7 +745,7 @@ # - libtool true if libtool will be used, blank otherwise # - guessed_libtool true if the configure.ac file uses libtool, blank otherwise # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use -# - dry_run true if actions shall only be printed, blank otherwise +# - dry echo if actions shall only be printed, blank otherwise # - symbolic true if files should be symlinked, copied otherwise func_import () { @@ -896,11 +893,11 @@ # Create directories. test -d "$destdir/$sourcebase" \ - || { test -n "$dry_run" || mkdir "$destdir/$sourcebase" || func_fatal_error "failed"; } + || { test -n "$dry" || mkdir "$destdir/$sourcebase" || func_fatal_error "failed"; } test -d "$destdir/$m4base" \ - || { test -n "$dry_run" || mkdir "$destdir/$m4base" || func_fatal_error "failed"; } + || { test -n "$dry" || mkdir "$destdir/$m4base" || func_fatal_error "failed"; } test -d "$destdir/$auxdir" \ - || { test -n "$dry_run" || mkdir "$destdir/$auxdir" || func_fatal_error "failed"; } + || { test -n "$dry" || mkdir "$destdir/$auxdir" || func_fatal_error "failed"; } # Copy files or make symbolic links. Remove obsolete files. for f1 in $old_files; do @@ -927,7 +924,6 @@ # Remove the file. Do nothing if the user already removed it. if test -f "$destdir/$g1"; then echo "Removing file $g1 (backup in ${g1}~)" - test -n "$dry_run" && dry=echo $dry mv -f "$destdir/$g1" "$destdir/${g1}~" || func_fatal_error "failed" fi fi @@ -974,7 +970,6 @@ else echo "Replacing file $g2 (non-gnulib code backuped in ${g2}~) !!" fi - test -n "$dry_run" && dry=echo $dry mv -f "$destdir/$g2" "$destdir/${g2}~" || func_fatal_error "failed" if test -n "$symbolic" && cmp "$gnulib_dir/$f2" "$destdir/$g2.tmp" > /dev/null; then func_ln_if_changed "$gnulib_dir/$f2" "$destdir/$g2" @@ -987,7 +982,6 @@ # Don't protest if the file should be there but isn't: it happens # frequently that developers don't put autogenerated files into CVS. echo "Copying file $g2" - test -n "$dry_run" && dry=echo if test -n "$symbolic" && cmp "$gnulib_dir/$f2" "$destdir/$g2.tmp" > /dev/null; then func_ln_if_changed "$gnulib_dir/$f2" "$destdir/$g2" else @@ -1017,7 +1011,7 @@ actioncmd="$actioncmd `echo $specified_modules`" # Create lib/Makefile.am. - if test -z "$dry_run"; then + if test -z "$dry"; then func_emit_lib_Makefile_am > "$destdir"/$sourcebase/Makefile.am.tmp if test -f "$destdir"/$sourcebase/Makefile.am; then if cmp "$destdir"/$sourcebase/Makefile.am "$destdir"/$sourcebase/Makefile.am.tmp > /dev/null; then @@ -1038,7 +1032,7 @@ # Create m4/gnulib-cache.m4. ( - if test -z "$dry_run"; then + if test -z "$dry"; then exec > "$destdir"/$m4base/gnulib-cache.m4.tmp else echo "Creating $m4base/gnulib-cache.m4..." @@ -1074,7 +1068,7 @@ echo echo "# gnulib-cache.m4 ends here" ) - if test -z "$dry_run"; then + if test -z "$dry"; then if test -f "$destdir"/$m4base/gnulib-cache.m4; then if cmp "$destdir"/$m4base/gnulib-cache.m4 "$destdir"/$m4base/gnulib-cache.m4.tmp > /dev/null; then rm -f "$destdir"/$m4base/gnulib-cache.m4.tmp @@ -1091,7 +1085,7 @@ # Create m4/gnulib-comp.m4. ( - if test -z "$dry_run"; then + if test -z "$dry"; then exec > "$destdir"/$m4base/gnulib-comp.m4.tmp else echo "Creating $m4base/gnulib-comp.m4..." @@ -1151,7 +1145,7 @@ echo echo "# gnulib-comp.m4 ends here" ) - if test -z "$dry_run"; then + if test -z "$dry"; then if test -f "$destdir"/$m4base/gnulib-comp.m4; then if cmp "$destdir"/$m4base/gnulib-comp.m4 "$destdir"/$m4base/gnulib-comp.m4.tmp > /dev/null; then rm -f "$destdir"/$m4base/gnulib-comp.m4.tmp _______________________________________________ bug-gnulib mailing list bug-gnulib@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnulib