Hi all,

In order to get quilt to run on my Solaris 8 workstation, I would need
to be able to tell it which tail [1] and grep binaries to use.
Unfortunately, quilt's configure script doesn't let me do that. Attached
is a patch addressing the problem. There are surprisingly few calls to
tail and grep in the quilt scripts (2 and 8, respectively), so these
changes are less intrusive that I would have first thought.

Still, given recent discussions about the best way to address
incompatibility issues, these patches may be controversial, which is why
I am posting them here first rather than applying them directly (as I'd
have done a few days ago).

My opinion is that alternative compatibility solutions (such as a
separate subdirectory with replacement stuff, to be prepended to quilt's
$PATH) have only been mentioned but nothing is currently implemented
AFAIK, and it may take some time before something is. So I don't think
we should stop using the old approach until something else is available,
if anyone actually goes working on this. For this reason, I would be in
favor of applying these patches. But I am of course open to objections,
especially given the context and the audience.

[1] Solaris' /usr/bin/tail doesn't support -n 42, it wants -42.
Fortuntely enough, it also has /usr/xpg4/bin/tail, which does understand
-n 42. But /usr/xpg4/bin isn't in the path by default, and I fear the
consequences of adding it in front of my path, given that it contains
similar replacements for many other commands, sometimes with
incompatible command line options.

Thanks,
-- 
Jean Delvare
 Makefile.in         |    2 ++
 configure.ac        |   14 ++++++++++++++
 quilt/previous.in   |    2 +-
 scripts/patchfns.in |    2 +-
 4 files changed, 18 insertions(+), 2 deletions(-)

--- quilt.orig/configure.ac     2005-08-28 20:52:10.000000000 +0200
+++ quilt/configure.ac  2005-09-15 11:04:55.000000000 +0200
@@ -135,6 +135,20 @@
     fi
 fi
 
+dnl Check for tail
+AC_ARG_WITH(tail, AC_HELP_STRING(
+    [--with-tail], [name of the tail executable to use]),
+    [
+       TAIL="$withval"
+       AC_SUBST(TAIL)
+       AC_MSG_NOTICE([Using tail executable $TAIL])
+    ],[
+       AC_PATH_PROG(TAIL, tail)
+    ])
+if test -z "$TAIL"; then
+    AC_MSG_ERROR([Please specify the location of tail with the option 
'--with-tail'])
+fi
+
 dnl Check for diff
 AC_ARG_WITH(diff, AC_HELP_STRING(
     [--with-diff], [name of the diff executable to use]),
--- quilt.orig/Makefile.in      2005-09-15 11:07:24.000000000 +0200
+++ quilt/Makefile.in   2005-09-15 11:08:06.000000000 +0200
@@ -23,6 +23,7 @@
 SED :=         @SED@
 AWK :=         @AWK@
 DIFF :=                @DIFF@
+TAIL :=                @TAIL@
 PATCH :=       @PATCH@
 MKTEMP :=      @MKTEMP@
 MSGFMT :=      @MSGFMT@
@@ -215,6 +216,7 @@
             -e 's:@BASH''@:$(BASH):g' \
             -e 's:@SED''@:$(SED):g' \
             -e 's:@AWK''@:$(AWK):g' \
+            -e 's:@TAIL''@:$(TAIL):g' \
             -e 's:@DIFF''@:$(DIFF):g' \
             -e 's:@PATCH''@:$(PATCH):g' \
             -e 's:@MKTEMP''@:$(MKTEMP):g' \
--- quilt.orig/quilt/previous.in        2005-06-12 14:37:56.000000000 +0200
+++ quilt/quilt/previous.in     2005-09-15 11:09:56.000000000 +0200
@@ -66,7 +66,7 @@
        patch=$(top_patch)
 fi
 
-previous=$(applied_before "$patch" | tail -n 1)
+previous=$(applied_before "$patch" | @TAIL@ -n 1)
 if [ -n "$previous" ]
 then
        echo "$(print_patch $previous)"
--- quilt.orig/scripts/patchfns.in      2005-09-09 17:53:52.000000000 +0200
+++ quilt/scripts/patchfns.in   2005-09-15 11:09:15.000000000 +0200
@@ -308,7 +308,7 @@
 
 top_patch()
 {
-       [ -e $DB ] && tail -n 1 $DB
+       [ -e $DB ] && @TAIL@ -n 1 $DB
 }
 
 is_numeric()
 Makefile.in         |    4 +++-
 configure.ac        |   12 ++++++++++++
 quilt/grep.in       |    2 +-
 quilt/patches.in    |    2 +-
 quilt/upgrade.in    |    4 ++--
 scripts/patchfns.in |    8 ++++----
 6 files changed, 23 insertions(+), 9 deletions(-)

--- quilt.orig/Makefile.in      2005-09-15 11:08:06.000000000 +0200
+++ quilt/Makefile.in   2005-09-15 11:42:25.000000000 +0200
@@ -20,6 +20,7 @@
 INSTALL :=     @INSTALL@
 PERL :=                @PERL@
 BASH :=                @BASH@
+GREP :=                @GREP@
 SED :=         @SED@
 AWK :=         @AWK@
 DIFF :=                @DIFF@
@@ -150,7 +151,7 @@
                   head -n 1;                            \
                 echo ;                                  \
                (@BASH@ -c ". scripts/patchfns ; LC_ALL=C . $$here/$$cmd -h")| \
-                grep -v 'Usage: quilt' |                \
+                @GREP@ -v 'Usage: quilt' |                \
                   sed -e $$'s/^\t//'                    \
                       -e $$'s/\t/\\\n/' |               \
                   sed -e 's/^\(-.*\)$$/.IP "    \1" 8/' \
@@ -214,6 +215,7 @@
             -e 's:@SCRIPTS''@:$(SCRIPTS_DIR):g' \
             -e 's:@PERL''@:$(PERL):g' \
             -e 's:@BASH''@:$(BASH):g' \
+            -e 's:@GREP''@:$(GREP):g' \
             -e 's:@SED''@:$(SED):g' \
             -e 's:@AWK''@:$(AWK):g' \
             -e 's:@TAIL''@:$(TAIL):g' \
--- quilt.orig/configure.ac     2005-09-15 11:04:55.000000000 +0200
+++ quilt/configure.ac  2005-09-15 11:41:26.000000000 +0200
@@ -77,6 +77,18 @@
     AC_MSG_ERROR([Please specify the location of Perl with the option 
'--with-perl'])
 fi
 
+dnl Check for grep
+AC_ARG_WITH(grep, AC_HELP_STRING(
+    [--with-grep], [name of the grep executable to use]),
+    [
+       GREP="$withval"
+       AC_SUBST(GREP)
+       AC_MSG_NOTICE([Using grep executable $GREP])
+    ],[
+       GREP="grep"
+       AC_SUBST(GREP)
+    ])
+
 dnl Check for sed
 AC_ARG_WITH(sed, AC_HELP_STRING(
     [--with-sed], [name of the sed executable to use]),
--- quilt.orig/quilt/grep.in    2004-07-14 15:39:35.000000000 +0200
+++ quilt/quilt/grep.in 2005-09-15 11:47:13.000000000 +0200
@@ -118,7 +118,7 @@
        -path "./$QUILT_PATCHES/*" -o \
        -path "./$QUILT_PC/*" \) -prune -o \
        -type f -print \
-| xargs grep $opt_H "[EMAIL PROTECTED]" \
+| xargs @GREP@ $opt_H "[EMAIL PROTECTED]" \
 | if [ [EMAIL PROTECTED] -eq 0 ]; then
        @SED@ -e 's,^./,,'
 else
--- quilt.orig/quilt/patches.in 2005-07-19 07:56:54.000000000 +0200
+++ quilt/quilt/patches.in      2005-09-15 11:47:33.000000000 +0200
@@ -74,7 +74,7 @@
        for patch in "$@"
        do
                if touched_by_patch $(patch_strip_level $patch) $patch \
-                  | grep -q "^$file_bre\$"
+                  | @GREP@ -q "^$file_bre\$"
                then
                        echo "$prefix$(print_patch $patch)"
                fi
--- quilt.orig/quilt/upgrade.in 2004-09-14 01:03:07.000000000 +0200
+++ quilt/quilt/upgrade.in      2005-09-15 11:47:52.000000000 +0200
@@ -76,7 +76,7 @@
 
 for patch in $(applied_patches)
 do
-       proper_name="$(grep -E -e '^'"$(quote_re 
$patch)"'(|\.patch|\.diff?)(|\.gz|\.bz2)([ \t]|$)' $SERIES)"
+       proper_name="$(@GREP@ -E -e '^'"$(quote_re 
$patch)"'(|\.patch|\.diff?)(|\.gz|\.bz2)([ \t]|$)' $SERIES)"
        proper_name=${proper_name#$QUILT_PATCHES/}
        proper_name=${proper_name%% *}
        if [ -z "$proper_name" ]
@@ -86,7 +86,7 @@
        fi
 
        if [ "$patch" != "$proper_name" -a -d $QUILT_PC/$patch ] \
-          && grep -q "^$(quote_bre $patch)\$" \
+          && @GREP@ -q "^$(quote_bre $patch)\$" \
                   $QUILT_PC/applied-patches
        then
                mv $QUILT_PC/$patch $QUILT_PC/$proper_name \
--- quilt.orig/scripts/patchfns.in      2005-09-15 11:09:15.000000000 +0200
+++ quilt/scripts/patchfns.in   2005-09-15 11:49:21.000000000 +0200
@@ -183,7 +183,7 @@
        then
                return 1
        else
-               grep -q -E "^$(quote_re $patch)([ \t]|$)" $SERIES
+               @GREP@ -q -E "^$(quote_re $patch)([ \t]|$)" $SERIES
        fi
 }
 
@@ -313,14 +313,14 @@
 
 is_numeric()
 {
-       echo $1 | grep -q '^[0-9]*$'
+       echo $1 | @GREP@ -q '^[0-9]*$'
 }
 
 is_applied()
 {
        local patch=$1
        [ -e $DB ] || return 1
-       grep -q -E "^$(quote_re $patch)\$" $DB
+       @GREP@ -q -E "^$(quote_re $patch)\$" $DB
 }
 
 applied_patches()
@@ -413,7 +413,7 @@
        local tmpfile
        if tmpfile=$(gen_tempfile)
        then
-               grep -v -E "^$(quote_re $patch)\$" $DB > $tmpfile
+               @GREP@ -v -E "^$(quote_re $patch)\$" $DB > $tmpfile
                cat $tmpfile > $DB
                rm -f $tmpfile
                [ -s $DB ] || rm -f $DB
_______________________________________________
Quilt-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/quilt-dev

Reply via email to