[arch-commits] Commit in grep/trunk (67-w.patch PKGBUILD grep.install)

Allan McRae allan at archlinux.org
Fri Jul 3 12:59:52 UTC 2009


    Date: Friday, July 3, 2009 @ 08:59:52
  Author: allan
Revision: 44657

upgpkg: grep 2.5.4-3
    fix -w (FS#15330), compress info pages

Added:
  grep/trunk/67-w.patch
Modified:
  grep/trunk/PKGBUILD
  grep/trunk/grep.install

--------------+
 67-w.patch   |  119 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 PKGBUILD     |   12 +++--
 grep.install |    6 +-
 3 files changed, 131 insertions(+), 6 deletions(-)

Added: 67-w.patch
===================================================================
--- 67-w.patch	                        (rev 0)
+++ 67-w.patch	2009-07-03 12:59:52 UTC (rev 44657)
@@ -0,0 +1,119 @@
+
+--- a/src/search.c	2007-10-01 14:47:55.000000000 +0200
++++ b/src/search.c	2007-09-30 23:38:45.000000000 +0200
+@@ -282,6 +282,7 @@
+   static int use_dfa_checked = 0;
+   size_t i, ret_val;
+ #ifdef MBS_SUPPORT
++  const char *last_char = NULL;
+   int mb_cur_max = MB_CUR_MAX;
+   mbstate_t mbs;
+   memset (&mbs, '\0', sizeof (mbstate_t));
+@@ -338,6 +341,8 @@
+ 		  while (bytes_left)
+ 		    {
+ 		      size_t mlen = mbrlen (beg, bytes_left, &mbs);
++
++		      last_char = beg;
+ 		      if (mlen == (size_t) -1 || mlen == 0)
+ 			{
+ 			  /* Incomplete character: treat as single-byte. */
+@@ -398,6 +403,8 @@
+ 		  while (bytes_left)
+ 		    {
+ 		      size_t mlen = mbrlen (beg, bytes_left, &mbs);
++
++		      last_char = beg;
+ 		      if (mlen == (size_t) -1 || mlen == 0)
+ 			{
+ 			  /* Incomplete character: treat as single-byte. */
+@@ -475,10 +483,84 @@
+ 	      if (match_words)
+ 		while (match <= best_match)
+ 		  {
++		    int lword_match = 0;
++		    if (match == buf)
++		      lword_match = 1;
++		    else
++		      {
++			assert (start > 0);
++#ifdef MBS_SUPPORT
++			if (mb_cur_max > 1)
++			  {
++			    const char *s;
++			    int mr;
++			    wchar_t pwc;
++			    if (using_utf8)
++			      {
++				s = match - 1;
++				while (s > buf
++				       && (unsigned char) *s >= 0x80
++				       && (unsigned char) *s <= 0xbf)
++				  --s;
++			      }
++			    else
++			      s = last_char;
++			    mr = mbtowc (&pwc, s, match - s);
++			    if (mr <= 0)
++			      {
++				memset (&mbs, '\0', sizeof (mbstate_t));
++				lword_match = 1;
++			      }
++			    else if (!(iswalnum (pwc) || pwc == L'_')
++				     && mr == (int) (match - s))
++			      lword_match = 1;
++			  }
++			else
++#endif /* MBS_SUPPORT */
++			if (!WCHAR ((unsigned char) match[-1]))
++			  lword_match = 1;
++		      }
++
++		    if (lword_match)
++		      {
++			int rword_match = 0;
++			if (start + len == end - beg - 1)
++			  rword_match = 1;
++			else
++			  {
++#ifdef MBS_SUPPORT
++			    if (mb_cur_max > 1)
++			      {
++				wchar_t nwc;
++				int mr;
++
++				mr = mbtowc (&nwc, buf + start + len,
++					     end - buf - start - len - 1);
++				if (mr <= 0)
++				  {
++				    memset (&mbs, '\0', sizeof (mbstate_t));
++				    rword_match = 1;
++				  }
++				else if (!iswalnum (nwc) && nwc != L'_')
++				  rword_match = 1;
++			      }
++			    else
++#endif /* MBS_SUPPORT */
++			    if (!WCHAR ((unsigned char) match[len]))
++			      rword_match = 1;
++			  }
++
++			if (rword_match)
++			  {
++			    if (!start_ptr)
++			      /* Returns the whole line. */
++			      goto success;
++			    else
++			      {
++				goto assess_pattern_match;
++			      }
++			  }
++		      }
+-		    if ((match == buf || !WCHAR ((unsigned char) match[-1]))
+-			&& (len == end - beg - 1
+-			    || !WCHAR ((unsigned char) match[len])))
+-		      goto assess_pattern_match;
+ 		    if (len > 0)
+ 		      {
+ 			/* Try a shorter length anchored at the same place. */
+

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2009-07-03 12:55:19 UTC (rev 44656)
+++ PKGBUILD	2009-07-03 12:59:52 UTC (rev 44657)
@@ -4,7 +4,7 @@
 
 pkgname=grep
 pkgver=2.5.4
-pkgrel=2
+pkgrel=3
 pkgdesc="A string search utility"
 arch=('i686' 'x86_64')
 license=('GPL3')
@@ -18,15 +18,18 @@
 	15-empty-pattern.patch
 	# utf8 grep speed fix - FS#7141
 	64-egf-speedup.patch
-	# fix the case insensitive search issues the above patch causes - FS#14877
+	# fix the case insensitive search issues the above patch causes
+	# FS#14877 and FS#15330
 	65-dfa-optional.patch
-	66-match_icase.patch)
+	66-match_icase.patch
+	67-w.patch)
 md5sums=('92258031d98d4f12dfc6a6d24057e672'
          'bc937da562d468f32c1fef2894610283'
          'f421415b679ebcc9152797caaa0b1d51'
          'efbe9d49d71a74092db6b86224b09fdd'
          'f913cc834cda9be198b98318048a5ded'
-         '253351c7d960331a8268b4d853c511ff')
+         '253351c7d960331a8268b4d853c511ff'
+         'c5ab886a6072474cf5ccfc59ed45dd74')
 
 build() {
   cd ${srcdir}/${pkgname}-${pkgver}
@@ -38,4 +41,5 @@
   make DESTDIR=${pkgdir} install || return 1
 
   rm -f ${pkgdir}/usr/share/info/dir
+  gzip -9 ${pkgdir}/usr/share/info/*
 }

Modified: grep.install
===================================================================
--- grep.install	2009-07-03 12:55:19 UTC (rev 44656)
+++ grep.install	2009-07-03 12:59:52 UTC (rev 44657)
@@ -2,8 +2,9 @@
 filelist=(grep.info)
 
 post_install() {
+  [ -x usr/bin/install-info ] || return 0
   for file in ${filelist[@]}; do
-    install-info $infodir/$file $infodir/dir 2> /dev/null
+    install-info $infodir/$file.gz $infodir/dir 2> /dev/null
   done
 }
 
@@ -12,8 +13,9 @@
 }
 
 pre_remove() {
+  [ -x usr/bin/install-info ] || return 0
   for file in ${filelist[@]}; do
-    install-info --delete $infodir/$file $infodir/dir 2> /dev/null
+    install-info --delete $infodir/$file.gz $infodir/dir 2> /dev/null
   done
 }
 




More information about the arch-commits mailing list