]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
Fix problems with serial comparison sed scripts, and factor out
authorGary V. Vaughan <gary@gnu.org>
Fri, 1 Apr 2005 12:27:56 +0000 (12:27 +0000)
committerGary V. Vaughan <gary@gnu.org>
Fri, 1 Apr 2005 12:27:56 +0000 (12:27 +0000)
common code from similar serial comparison functions:

* libtoolize.m4sh (func_keyword_update): Common code factored out
of func_ltmain_update and func_config_update.
(func_ltmain_update, func_config_update): Adjust, and fix sed
expressions to not use unportable ? modifier.
(func_install_update): New serial number based file updater keyed
off 'scriptversion' variable in install-sh.  Adjust all callers.

ChangeLog
libtoolize.m4sh

index 839d52b9d3900921052ed0ec15e70a681cf20ba5..2c99b0d70e7cc180985a8ce5aa82c6c7b29293cf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2005-04-01  Gary V. Vaughan  <gary@gnu.org>
+
+       Fix problems with serial comparison sed scripts, and factor out
+       common code from similar serial comparison functions:
+
+       * libtoolize.m4sh (func_keyword_update): Common code factored out
+       of func_ltmain_update and func_config_update.
+       (func_ltmain_update, func_config_update): Adjust, and fix sed
+       expressions to not use unportable ? modifier.
+       (func_install_update): New serial number based file updater keyed
+       off 'scriptversion' variable in install-sh.  Adjust all callers.
+
 2005-04-01  Gary V. Vaughan  <gary@gnu.org>
 
        Most of the hair introduced ostensibly to enable testing of
index 54af8d265acc030e34afcd9ae29eca8c01c31dea..6ae585526da87c320bae16b33a4d58e01808e9b3 100644 (file)
@@ -678,24 +678,23 @@ func_serial_update ()
 }
 
 
-# func_ltmain_update filename srcdir destdir
+# func_keyword_update filename srcdir destdir sed_script
 # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
-# has a newer revision, or DESTFILE does not yet exist, or the user
-# specified `--force' at the command line.
-func_ltmain_update ()
+# has a newer revision according to the serial number extracted by
+# SED_SCRIPT, or DESTFILE does not yet exist, or the user specified
+# `--force' at the command line.
+func_keyword_update ()
 {
     $opt_debug
     my_filename="$1"
     my_srcdir="$2"
     my_destdir="$3"
+    my_sed_script="$4"
 
     my_srcfile="$my_srcdir/$my_filename"
     my_destfile="$my_destdir/$my_filename"
 
-    my_update_p=:
-    my_sed_ltmain=['/^package_revision=[0-9][1-9.]*/ {
-      s,^package_revision=\([0-9.]*\)[         ]*$,\1,; p;
-    }; d']
+    my_keyword_update_p=:
 
     test -f "$my_srcfile" || {
       func_error "\`$my_srcfile' does not exist."
@@ -703,21 +702,21 @@ func_ltmain_update ()
     }
 
     if test -f "$my_destfile"; then
-      my_src_serial=`$SED -e "$my_sed_ltmain" "$my_srcfile"`
+      my_src_serial=`$SED -e "$my_sed_script" "$my_srcfile"`
       test -z "$my_src_serial" && {
         func_error "warning: no serial number in \`$my_srcfile', not copying."
        return
       }
 
-      my_dest_serial=`$SED -e "$my_sed_ltmain" "$my_destfile"`
+      my_dest_serial=`$SED -e "$my_sed_script" "$my_destfile"`
       test -n "$my_dest_serial" || my_dest_serial=0
 
       func_serial_update_check \
          "$my_srcfile" "$my_src_serial" "$my_destfile" "$my_dest_serial"
-      my_update_p="$func_serial_update_check_result"
+      my_keyword_update_p="$func_serial_update_check_result"
     fi
 
-    if $my_update_p || $opt_force; then
+    if $my_keyword_update_p || $opt_force; then
       func_copy "$my_srcfile" "$my_destfile"
     elif test "X$my_dest_serial" = "X$my_src_serial"; then
       $opt_quiet \
@@ -726,6 +725,23 @@ func_ltmain_update ()
 }
 
 
+# func_ltmain_update filename srcdir destdir
+# Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
+# has a newer revision, or DESTFILE does not yet exist, or the user
+# specified `--force' at the command line.
+func_ltmain_update ()
+{
+    $opt_debug
+    my_sed_ltmain=['/^package_revision='\''*[0-9][1-9.]*'\''*/ {
+      s,^package_revision='\''*\([0-9.]*\)'\''*[       ]*$,\1,; p;
+    }; d']
+
+    func_keyword_update "$1" "$2" "$3" "$my_sed_ltmain"
+
+    return $my_return_status
+}
+
+
 # func_config_update filename srcdir destdir
 # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
 # has a newer timestamp, or DESTFILE does not yet exist, or the user
@@ -733,44 +749,30 @@ func_ltmain_update ()
 func_config_update ()
 {
     $opt_debug
-    my_filename="$1"
-    my_srcdir="$2"
-    my_destdir="$3"
-
-    my_srcfile="$my_srcdir/$my_filename"
-    my_destfile="$my_destdir/$my_filename"
-
-    my_update_p=:
-    my_sed_config=['/^timestamp='\''\?[0-9][1-9-]*'\''\?/ {
-      s,^timestamp='\''\?\([0-9-]*\)'\''\?,\1,; s/-/./g; p;
+    my_sed_config=['/^timestamp='\''*[0-9][1-9-]*'\''*/ {
+      s,^timestamp='\''*\([0-9-]*\)'\''*,\1,; s/-/./g; p;
     }; d']
 
-    test -f "$my_srcfile" || {
-      func_error "\`$my_srcfile' does not exist."
-      return
-    }
+    func_keyword_update "$1" "$2" "$3" "$my_sed_config"
 
-    if test -f "$my_destfile"; then
-      my_src_serial=`$SED -e "$my_sed_config" "$my_srcfile"`
-      test -z "$my_src_serial" && {
-        func_error "warning: no serial number in \`$my_srcfile', not copying."
-       return
-      }
+    return $my_return_status
+}
 
-      my_dest_serial=`$SED -e "$my_sed_config" "$my_destfile"`
-      test -n "$my_dest_serial" || my_dest_serial=0
 
-      func_serial_update_check \
-         "$my_srcfile" "$my_src_serial" "$my_destfile" "$my_dest_serial"
-      my_update_p="$func_serial_update_check_result"
-    fi
+# func_install_update filename srcdir destdir
+# Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
+# has a newer timestamp, or DESTFILE does not yet exist, or the user
+# specified `--force' at the command line.
+func_install_update ()
+{
+    $opt_debug
+    my_sed_install=['/^scriptversion='\''*[0-9][1-9.-]*'\''*/ {
+      s,^scriptversion='\''*\([0-9.-]*\)'\''*,\1,; s/-/./g; p;
+    }; d']
 
-    if $my_update_p || $opt_force; then
-      func_copy "$my_srcfile" "$my_destfile"
-    elif test "X$my_dest_serial" = "X$my_src_serial"; then
-      $opt_quiet \
-        || func_echo "\`$my_destfile' is already up to date."
-    fi
+    func_keyword_update "$1" "$2" "$3" "$my_sed_install"
+
+    return $my_return_status
 }
 
 
@@ -881,7 +883,7 @@ func_massage_pkgvltdl_files ()
   if $opt_install; then
     func_config_update config.guess "$pkgvdatadir/config" "$auxdir"
     func_config_update config.sub   "$pkgvdatadir/config" "$auxdir"
-    func_config_update install-sh   "$pkgvdatadir/config" "$auxdir"
+    func_install_update install-sh  "$pkgvdatadir/config" "$auxdir"
   fi
   func_ltmain_update ltmain.sh "$pkgvdatadir/config" "$auxdir"