On Mon, Dec 23, 2013 at 01:27:53PM -0600, Kent R. Spillner wrote:
> On Mon, Dec 23, 2013 at 06:57:25PM +0100, Jérémie Courrèges-Anglas wrote:
> > If you want to improve this port, though, there are portability problems
> > that could be fixed.  I noticed a few sed s/.../.../iasdf flags that
> > don't work with our sed.  This could be dealt with patching the scritps
> > to use @SED@ and amending the % :: %.in rule in Makefile.in.
> 
> Thanks for pointing that out.  I'll looking into fixing those portability
> issues.

Here is an updated patch with the portability improvments suggested by jca@.

I'm only patching quilt/mail.in at the moment because that was the only place
where I saw non-portable flags to the substitution command (but since I was
there I decided to patch all invocations anyways).  I'll send a larger diff
upstream that actually fixes every invocation.

Still only tested on amd64.

Index: Makefile
===================================================================
RCS file: /work/cvsroot/ports/devel/quilt/Makefile,v
retrieving revision 1.4
diff -p -u -r1.4 Makefile
--- Makefile    31 Aug 2013 17:22:16 -0000      1.4
+++ Makefile    14 Dec 2013 04:11:46 -0000
@@ -2,11 +2,11 @@
 
 COMMENT=               manage large numbers of patches
 
-DISTNAME=              quilt-0.60
-REVISION=              1
+DISTNAME=              quilt-0.61
 CATEGORIES=            devel
 
 HOMEPAGE=              http://savannah.nongnu.org/projects/quilt/
+MAINTAINER=            Kent R. Spillner <kspill...@acm.org>
 
 # GPLv3+
 PERMIT_PACKAGE_CDROM=  Yes
Index: distinfo
===================================================================
RCS file: /work/cvsroot/ports/devel/quilt/distinfo,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 distinfo
--- distinfo    8 Oct 2012 15:14:25 -0000       1.1.1.1
+++ distinfo    14 Dec 2013 03:34:38 -0000
@@ -1,2 +1,2 @@
-SHA256 (quilt-0.60.tar.gz) = PXKikuQyvrmnP50Kz+OnfJtNfkIgmRm7JE6ZWMfP5ks=
-SIZE (quilt-0.60.tar.gz) = 442369
+SHA256 (quilt-0.61.tar.gz) = HuwKJwrE1B7qD9WCNgPJ0qNatrirc6kN2SzhKRsqn8M=
+SIZE (quilt-0.61.tar.gz) = 450552
Index: patches/patch-Makefile_in
===================================================================
RCS file: /work/cvsroot/ports/devel/quilt/patches/patch-Makefile_in,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 patch-Makefile_in
--- patches/patch-Makefile_in   8 Oct 2012 15:14:25 -0000       1.1.1.1
+++ patches/patch-Makefile_in   24 Dec 2013 12:45:07 -0000
@@ -1,6 +1,6 @@
-$OpenBSD: patch-Makefile_in,v 1.1.1.1 2012/10/08 15:14:25 rpe Exp $
---- Makefile.in.orig   Sun Sep  2 19:19:00 2012
-+++ Makefile.in        Sun Sep  2 19:19:16 2012
+$OpenBSD$
+--- Makefile.in.orig   Tue Dec 24 06:44:51 2013
++++ Makefile.in        Tue Dec 24 06:43:04 2013
 @@ -13,7 +13,7 @@ docdir :=    @docdir@
  mandir :=     @mandir@
  localedir :=  $(datadir)/locale
@@ -10,3 +10,11 @@ $OpenBSD: patch-Makefile_in,v 1.1.1.1 20
  
  INSTALL :=    @INSTALL@
  POD2MAN :=    @POD2MAN@
+@@ -256,6 +256,7 @@ $(patsubst %.in,%,$(wildcard bin/*.in quilt/*.in quilt
+       @$(SED) -e 's:@QUILT_DIR''@:$(datadir)/$(PACKAGE):g'            \
+               -e 's:@PERL''@:$(PERL):g'                               \
+               -e 's:@BASH''@:$(BASH):g'                               \
++              -e 's:@SED''@:$(SED):g'                                 \
+               -e 's:@PATCH''@:$(PATCH):g'                             \
+               -e 's:@STAT_HARDLINK''@:$(STAT_HARDLINK):g'             \
+               -e 's:@VERSION''@:$(VERSION):g'                         \
Index: patches/patch-quilt_mail_in
===================================================================
RCS file: patches/patch-quilt_mail_in
diff -N patches/patch-quilt_mail_in
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-quilt_mail_in 24 Dec 2013 14:00:44 -0000
@@ -0,0 +1,111 @@
+$OpenBSD$
+--- quilt/mail.in.orig Sun Dec  8 14:39:50 2013
++++ quilt/mail.in      Tue Dec 24 08:00:32 2013
+@@ -6,6 +6,8 @@
+ #
+ #  See the COPYING and AUTHORS files for more details.
+ 
++SED=@SED@
++
+ : ${EDITOR:=vi}
+ 
+ # Read in library functions
+@@ -146,7 +148,7 @@ process_mail()
+       else
+               local from_date=$(LC_ALL=POSIX date "+%a %b %e %H:%M:%S %Y")
+               echo "From $opt_sender_address $from_date"
+-              sed -e 's/^From />From /' $tmpfile
++              $SED -e 's/^From />From /' $tmpfile
+               echo
+       fi
+       rm -f $tmpfile
+@@ -305,7 +307,7 @@ Could not determine the envelope sender address. Pleas
+               ;;
+       esac
+ fi
+-opt_sender_address=$(echo "$opt_sender" | sed -re 's:.*<([^<>]+)>.*:\1:')
++opt_sender_address=$(echo "$opt_sender" | $SED -re 's:.*<([^<>]+)>.*:\1:')
+ 
+ if [ -z "$opt_charset" ]
+ then
+@@ -360,7 +362,7 @@ then
+               # Is the first paragraph short enough to be used as the subject?
+               if [ -z "$subject" ]
+               then
+-                      local para=$(sed -e $'/^[ \t]*$/q' $tmpdir/header)
++                      local para=$($SED -e $'/^[ \t]*$/q' $tmpdir/header)
+                       if [ ${#para} -gt 0 -a ${#para} -lt 150 ]
+                       then
+                               subject=$(echo "$para" | join_lines)
+@@ -378,7 +380,7 @@ then
+               fi
+ 
+               subject=$(echo "$subject" \
+-                        | sed -e 
$'s/^\\(\\(\\[[^]]*\\]\\|fwd:\\|fw:\\|re:\\|aw:\\|tr:\\)[ \t]*\\)*//i')
++                        | $SED -e 
$'s/^\\(\\(\\[[^]]*\\]\\|fwd:\\|fw:\\|re:\\|aw:\\|tr:\\)[ \t]*\\)*//i')
+               echo "Replace-Subject: $subject"
+ 
+               # Add recipients defined by some recognized keywords
+@@ -391,7 +393,7 @@ then
+               set -- "$*"
+               set -- ${*// /\\|}
+ 
+-              sed -n -e "/\<${LOGNAME:-$(whoami)}@/d" \
++              $SED -n -e "/\<${LOGNAME:-$(whoami)}@/d" \
+                      -e 's/^\(\(To\|'"$*"'\):[ 
'$'\t'']*\)\([^"]*\(,[^"]*\)\+[^" '$'\t'']\)\([ '$'\t'']*<.*>\)/\1"\3"\5/I' \
+                      -e 's/^To:\(.*@.*\)/Recipient-To:\1/Ip' \
+                      -e 's/^\('"$*"'\):\(.*@.*\)/Recipient-Cc:\2/Ip' \
+@@ -483,7 +485,7 @@ then
+       if [ -z "$opt_subject" ]
+       then
+               opt_subject="Re: $(formail -x Subject: < "$opt_reply_to" \
+-                            | sed -e 's/^ *\([rR][eE]: *\)*//')"
++                            | $SED -e 's/^ *\([rR][eE]: *\)*//')"
+       fi
+ fi
+ 
+@@ -557,7 +559,7 @@ subject_prefix=${subject_prefix//\'/\'\'}
+ subject_prefix=${subject_prefix//\//\\\/}
+ p=${subject_prefix//@num@/$(printf %0*d ${#total} 0)}
+ p=${p//@total@/$total}
+-sed -e $'s/^\\(Subject:[ \t]\\)/\\1'"$p"'/' \
++$SED -e $'s/^\\(Subject:[ \t]\\)/\\1'"$p"'/' \
+     -e '/^Subject-Prefix:/d' \
+ $introduction \
+ | $QUILT_DIR/scripts/edmail --charset $opt_charset \
+@@ -573,7 +575,7 @@ fi
+ # increment the timestamp by one second and wait with sending until
+ # that time has arrived. This allows MUAs to show the messages in the
+ # correct order.
+-last_ts=$(date '+%s' -d "$(sed -ne $'s/^Date:[ \t]*//p' $introduction)")
++last_ts=$(date '+%s' -d "$($SED -ne $'s/^Date:[ \t]*//p' $introduction)")
+ 
+ num=1
+ for patch in "${patches[@]}"; do
+@@ -607,7 +609,7 @@ for patch in "${patches[@]}"; do
+                                   gsub(/'\''/, "'\'\''", s)
+                                   print options[n] " " r "='\''" s "'\'' \\" 
} }
+       ' $body)"
+-#     echo "$modify" | sed -e 's/^/>> /' >&2
++#     echo "$modify" | $SED -e 's/^/>> /' >&2
+       p=${subject_prefix//@num@/$(printf %0*d ${#total} $num)}
+       p=${p//@total@/$total}
+ 
+@@ -641,7 +643,7 @@ for patch in "${patches[@]}"; do
+               --replace-header Date="\"$new_date\"" \
+               To Cc Bcc \
+               "$modify" \
+-      | sed -e $'s/^\\(Subject:[ \t]\\)/\\1'"$p"'/' \
++      | $SED -e $'s/^\\(Subject:[ \t]\\)/\\1'"$p"'/' \
+             -e '/^Subject-Prefix:/d' \
+       | $QUILT_DIR/scripts/edmail --remove-empty-headers \
+       | process_mail ) 2> $tmpdir/err
+@@ -649,7 +651,7 @@ for patch in "${patches[@]}"; do
+       status=$?
+       if [ -s $tmpdir/err ]
+       then
+-              sed -e "s/^/${patch//\//\\/}: /" <  $tmpdir/err >&2
++              $SED -e "s/^/${patch//\//\\/}: /" <  $tmpdir/err >&2
+       fi
+       if [ $status -ne 0 ]
+       then
Index: patches/patch-test_delete_test
===================================================================
RCS file: /work/cvsroot/ports/devel/quilt/patches/patch-test_delete_test,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 patch-test_delete_test
--- patches/patch-test_delete_test      8 Oct 2012 15:14:25 -0000       1.1.1.1
+++ patches/patch-test_delete_test      13 Dec 2013 23:56:08 -0000
@@ -1,17 +1,17 @@
 $OpenBSD: patch-test_delete_test,v 1.1.1.1 2012/10/08 15:14:25 rpe Exp $
---- test/delete.test.orig      Sun Sep  2 21:40:18 2012
-+++ test/delete.test   Sun Sep  2 21:40:26 2012
+--- test/delete.test.orig      Sun Dec  8 03:40:42 2013
++++ test/delete.test   Fri Dec 13 17:55:39 2013
 @@ -1,3 +1,4 @@
-+#     >~ find: `?\./dir'?: Permission denied
++#     >~ .*find: [`']?\./dir'?: Permission denied
  Test the delete command.
  
        $ mkdir patches
-@@ -77,7 +78,7 @@ Test the delete command.
- 
+@@ -79,7 +80,7 @@ Test the delete command.
+       # running as root, but you shouldn't do that anyway.
        $ quilt delete "test3"
        > Removing patch %{P}test3
--      >~ find: `?\./dir'?: Permission denied
-+      > ${LOCALBASE}/bin/gfind: `./dir': Permission denied
+-      >~ .*find: [`']?\./dir'?: Permission denied
++      >~ /usr/local/bin/gfind: [`']?\./dir'?: Permission denied
  
        $ chmod a+rx .pc/test3/dir
  
Index: patches/patch-test_remove-trailing-ws_test
===================================================================
RCS file: patches/patch-test_remove-trailing-ws_test
diff -N patches/patch-test_remove-trailing-ws_test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-test_remove-trailing-ws_test  14 Dec 2013 03:15:03 -0000
@@ -0,0 +1,63 @@
+$OpenBSD$
+--- test/remove-trailing-ws.test.orig  Fri Dec 13 17:38:41 2013
++++ test/remove-trailing-ws.test       Fri Dec 13 17:50:26 2013
+@@ -134,21 +134,21 @@ $ %{QUILT_DIR}/scripts/remove-trailing-ws < unified.di
+ > Removing trailing whitespace from lines 12,16 of files/complex
+ > Removing trailing whitespace from lines 1,2,3 of files/create
+ $ wc -l files/add
+-> 8 files/add
++>~ (\s+)?8 files/add
+ $ wc -l files/change
+-> 3 files/change
++>~ (\s+)?3 files/change
+ $ wc -l files/complex
+-> 21 files/complex
++>~ (\s+)?21 files/complex
+ $ wc -l files/create
+-> 3 files/create
++>~ (\s+)?3 files/create
+ $ wc -l files/remove
+-> 6 files/remove
++>~ (\s+)?6 files/remove
+ $ wc -l files/remove-at-end
+-> 8 files/remove-at-end
++>~ (\s+)?8 files/remove-at-end
+ $ wc -l unified.diff
+-> 85 unified.diff
++>~ (\s+)?85 unified.diff
+ $ wc -l unified-wsok.diff
+-> 85 unified-wsok.diff
++>~ (\s+)?85 unified-wsok.diff
+ $ diff -u unified.diff unified-wsok.diff | grep '^++[^+]'
+ > ++Line 4
+ > ++to
+@@ -167,21 +167,21 @@ $ %{QUILT_DIR}/scripts/remove-trailing-ws < context.di
+ > Removing trailing whitespace from lines 12,16 of files/complex
+ > Removing trailing whitespace from lines 1,2,3 of files/create
+ $ wc -l files/add
+-> 8 files/add
++>~ (\s+)?8 files/add
+ $ wc -l files/change
+-> 3 files/change
++>~ (\s+)?3 files/change
+ $ wc -l files/complex
+-> 21 files/complex
++>~ (\s+)?21 files/complex
+ $ wc -l files/create
+-> 3 files/create
++>~ (\s+)?3 files/create
+ $ wc -l files/remove
+-> 6 files/remove
++>~ (\s+)?6 files/remove
+ $ wc -l files/remove-at-end
+-> 8 files/remove-at-end
++>~ (\s+)?8 files/remove-at-end
+ $ wc -l context.diff
+-> 104 context.diff
++>~ (\s+)?104 context.diff
+ $ wc -l context-wsok.diff
+-> 104 context-wsok.diff
++>~ (\s+)?104 context-wsok.diff
+ $ diff -u context.diff context-wsok.diff | grep '^+[+!] '
+ > ++ Line 4
+ > ++ create

Reply via email to