[mm-common] Fix handling of mm-common-prepare --force



commit 70ed1e7ff3a17168fc9a14ac140b158159f78b5b
Author: Daniel Elstner <danielk openismus com>
Date:   Fri Aug 7 23:03:28 2009 +0200

    Fix handling of mm-common-prepare --force
    
    * util/mm-common-prepare.in: Simply check whether $forceflag is empty
    instead of doing a string comparison and getting it wrong.  Also, for
    improved robustness, use a fixed list of files to install instead of
    a wildcard pattern.  Make the sed expression to extract the auxiliary
    build directory skip over both spaces and tabs.

 util/mm-common-prepare.in |   32 ++++++++++++++++++--------------
 1 files changed, 18 insertions(+), 14 deletions(-)
---
diff --git a/util/mm-common-prepare.in b/util/mm-common-prepare.in
index 4c33b70..460380a 100644
--- a/util/mm-common-prepare.in
+++ b/util/mm-common-prepare.in
@@ -24,13 +24,14 @@ pkgdatadir="${datadir}/@PACKAGE_TARNAME@"
 
 progname="${0##*/}"
 installcmd='ln -s'
+instaction=symlinking
 forceflag=
 srcdir=.
 
 for arg
 do
   case $arg in
-  --help)
+  '-?'|--help)
     cat <<EOF
 Usage: $progname [OPTION]... [DIRECTORY]
 
@@ -49,16 +50,18 @@ EOF
     ;;
   -c|--copy)
     installcmd=cp
+    instaction=copying
     ;;
   -f|--force)
     forceflag=' -f'
     ;;
   -cf|-fc)
     installcmd=cp
+    instaction=copying
     forceflag=' -f'
     ;;
   -*)
-    echo "$progname: unrecognized option '$arg'" >&2
+    echo "$progname: error: unrecognized option '$arg'" >&2
     exit 1
     ;;
   ?*)
@@ -67,22 +70,23 @@ EOF
   esac
 done
 
-if test -f "$srcdir/configure.ac"; then :; else
-  echo "$progname: $srcdir/configure.ac not found" >&2
-  exit 1
-fi
+acfile=$srcdir/configure.ac
 
-auxdir=`sed -n 's/^ *AC_CONFIG_AUX_DIR([[ ]*\([^]),$ ]*\).*/\1/p' "$srcdir/configure.ac"`
-auxdir=$srcdir${auxdir:+"/$auxdir"}
+test -f "$acfile" || {
+  echo "$progname: error: $acfile not found" >&2
+  exit 1
+}
+# The sed expression contains literal tab characters for portability
+auxdir=`sed -n 's/^[	 ]*AC_CONFIG_AUX_DIR([[	 ]*\([^]),$	 ]*\).*/\1/p' "$acfile"`
+auxdir=$srcdir${auxdir:+/}$auxdir
 
-echo "Build support directory: $auxdir"
+echo "$progname: putting auxiliary files into $auxdir"
 
-for file in "$pkgdatadir"/build/*.am
+for file in compile-binding.am dist-changelog.am doc-reference.am generate-binding.am
 do
-  basename="${file##*/}"
-  if test " $forceflag" = ' -f' || test ! -f "$auxdir/$basename"; then
-    echo "$progname: Copying $basename to $auxdir"
-    $installcmd$forceflag "$file" "$auxdir/$basename"
+  if test -n "$forceflag" || test ! -f "$auxdir/$file"; then
+    echo "$progname: $instaction file $file"
+    $installcmd$forceflag "$pkgdatadir/build/$file" "$auxdir/$file"
   fi
 done
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]