This series of changesets are either necessary for, or at least
make the application of the directory move patches coming in the
next set as straight forward as possible.
It turns out that we haven't needed to fork a tar process for
every file-copy for about 4 years now. With that knowledge it's
easy to reduce the complexity of the surrounding functions
somewhat.
I'll apply in 72 hours, along with addressing any feedback I
get in the mean time.
* libtoolize.m4sh (TAR): Remove.
(func_copy_some_files, func_copy_cb): Remove.
(func_copy): Refactor from all of the above, and simplify. No
need to use $TAR to preserve timestamps when copying, since
we've been running touch right afterwards anyway. Adjust all
callers to use the new argument footprint.
(func_serial_update, func_keyword_update): Delete any pre-
existing destination file when used with `--force' before
calling func_copy, now that the hardcoded special cases are not
in there any more.
(func_install_pkgmacro_subproject)
(func_install_pkgaux_subproject): Use our own file loop -
func_copy subsumes all the checks previously in
func_copy_some_files, but operates on only one file at a time.
(func_install_pkgltdl_files): Similarly, handle aclocal.m4 and
configure special cases here, before calling func_copy.
* tests/libtoolize.at: Make sure we match corrected copying
`configure.ac' output.
Signed-off-by: Gary V. Vaughan g...@gnu.org
---
libtoolize.m4sh | 186 ++
tests/libtoolize.at |4 +-
2 files changed, 69 insertions(+), 121 deletions(-)
diff --git a/libtoolize.m4sh b/libtoolize.m4sh
index c920248..8fc2042 100644
--- a/libtoolize.m4sh
+++ b/libtoolize.m4sh
@@ -67,8 +67,6 @@ AS_INIT[]m4_divert_push([HEADER-COPYRIGHT])
# GNU @PACKAGE@ home page: @PACKAGE_URL@.
# General help using GNU software: http://www.gnu.org/gethelp/.
-: ${TAR=tar}
-
PROGRAM=libtoolize
m4_divert_pop
@@ -112,8 +110,7 @@ M4SH_GETOPTS(
CP=func_echo_all $CP
test -n $LN_S LN_S=func_echo_all $LN_S
MKDIR=func_echo_all $MKDIR
- RM=func_echo_all $RM
- TAR=func_echo_all $TAR],
+ RM=func_echo_all $RM],
[q], [--quiet|--automake], [], [],
[v], [--verbose],[], [],
[], [--no-warning|--no-warn], [], [],
@@ -211,134 +208,73 @@ func_whisper_error_hdr ()
func_whisper_once $my_msg_var
func_error $*
-}
-
-
-# func_copy srcfile destfile [msg_var]
-# A wrapper for func_copy_cb that accepts arguments in the same order
-# as the cp(1) shell command.
-func_copy ()
-{
-$debug_cmd
-
-test -f $1 || \
- { func_error \`$1' not copied: not a regular file; return 1; }
-
-func_dirname_and_basename $1
-my_f1=$func_basename_result
-
-if test -d $2; then
-
- func_copy_cb $my_f1 \
- `$ECHO $1 | $SED $dirname` $2 $3
-
-else
- # Supporting this would mean changing the timestamp:
- func_dirname_and_basename $2
- my_tname=$func_basename_result
- test X$my_f1 = X$my_tname \
-|| func_fatal_error func_copy() cannot change filename on copy
-
- func_copy_cb $my_f1 \
-`$ECHO $1 | $SED $dirname` \
-`$ECHO $2 | $SED $dirname` \
- $3
-
-fi
-
-return $copy_return_status # set in func_copy_cb
+exit_status=$EXIT_FAILURE
}
-# func_copy_cb filename srcdir destdir [msg_var]
+# func_copy filename srcdir destdir [msg_var]
# If option `--copy' was specified, or soft-linking SRCFILE to DESTFILE
# fails, then try to copy SRCFILE to DESTFILE (making sure to update the
# timestamp so that a series of files with dependencies can be copied
# in the right order that their timestamps won't trigger rebuilds).
-func_copy_cb ()
+# MSG_VAR names a variable for use with func_whisper_hdr.
+func_copy ()
{
$debug_cmd
-my_file=$1
-my_srcdir=$2
-my_destdir=$3
-my_msg_var=$4
-copy_return_status=1
+my_filename=$1
+my_srcdir=$2
+my_destdir=$3
+my_msg_var=$4
+
+my_srcfile=$my_srcdir/$my_filename
+my_destfile=$my_destdir/$my_filename
# Libtool is probably misinstalled if this happens:
-test -f $my_srcdir/$my_file ||
-func_fatal_error \`$my_file' not found in \`$my_srcdir'
+test -f $my_srcfile || {
+ func_whisper_error_hdr $my_msg_var \`$my_srcfile' not found
+ return 1
+}
-case $opt_verbose in
- false) my_copy_msg=file \`$my_destdir/$my_file' ;;
- *) my_copy_msg=file from \`$my_srcdir/$my_file' ;;
-esac
-func_mkdir_p `$ECHO $my_destdir/$my_file | $SED $dirname`
+# Require --force to remove existing $my_destfile.
+$opt_force $RM $my_destfile
+test -f $my_destfile {
+ func_whisper_error_hdr $my_msg_var \
+\`$my_destfile' exists: use \`--force' to overwrite
+ return 1
+}
+
+# Be careful to support `func_copy dir/target srcbase destbase'.
+