[migemo/f17: 1/2] Rebuilt and patched for Ruby 1.9.3.

Vít Ondruch vondruch at fedoraproject.org
Fri Mar 2 12:13:40 UTC 2012


commit 18848c6263f5af8c050a718adcc2b8443ab29e8e
Author: Vít Ondruch <vondruch at redhat.com>
Date:   Fri Mar 2 13:12:11 2012 +0100

    Rebuilt and patched for Ruby 1.9.3.

 migemo-ruby-1.9.patch |  145 +++++++++++++++++++++++++++++++++++++++++++++++++
 migemo.spec           |   20 +++++--
 2 files changed, 159 insertions(+), 6 deletions(-)
---
diff --git a/migemo-ruby-1.9.patch b/migemo-ruby-1.9.patch
new file mode 100644
index 0000000..4cfb221
--- /dev/null
+++ b/migemo-ruby-1.9.patch
@@ -0,0 +1,145 @@
+diff -ur migemo-0.40/genchars.sh migemo-0.40-1.9.1/genchars.sh
+--- migemo-0.40/genchars.sh	2001-08-13 18:30:48.000000000 +0900
++++ migemo-0.40-1.9.1/genchars.sh	2010-09-24 00:32:26.000000000 +0900
+@@ -1,6 +1,6 @@
+ #! /bin/sh
+ 
+-ruby -rromkan -nle 'head = split[0]; if /^\w+$/ =~ head then puts head else roma = head.to_roma; puts roma, roma.to_kunrei end' migemo-dict |uniq> tmp.ascii.words
++ruby -rromkan -nle 'head = $_.split[0]; if /^\w+$/ =~ head then puts head else roma = head.to_roma; puts roma, roma.to_kunrei end' migemo-dict |uniq> tmp.ascii.words
+ 
+ # Get the top 500 frequent ngrams.
+ for i in 1 2 3 4 5 6 7 8; do
+diff -ur migemo-0.40/migemo migemo-0.40-1.9.1/migemo
+--- migemo-0.40/migemo	2003-05-27 12:01:10.000000000 +0900
++++ migemo-0.40-1.9.1/migemo	2010-09-24 00:32:26.000000000 +0900
+@@ -10,7 +10,6 @@
+ # the GNU General Public License version 2.
+ #
+ 
+-$KCODE = "e"
+ 
+ require 'migemo'
+ require 'getoptlong'
+diff -ur migemo-0.40/migemo-cache.rb migemo-0.40-1.9.1/migemo-cache.rb
+--- migemo-0.40/migemo-cache.rb	2001-07-15 02:38:56.000000000 +0900
++++ migemo-0.40-1.9.1/migemo-cache.rb	2010-09-24 00:32:26.000000000 +0900
+@@ -1,5 +1,4 @@
+ require 'migemo'
+-$KCODE="e"
+ raise if ARGV[0] == nil
+ dict = ARGV[0]
+ static_dict = MigemoStaticDict.new(dict)
+@@ -18,10 +17,10 @@
+   migemo = Migemo.new(static_dict, pattern)
+   migemo.optimization = 3
+   data = Marshal.dump(migemo.regex_tree)
+-  output = [pattern.length].pack("N") + pattern + 
+-    [data.length].pack("N") + data
++  output = [pattern.bytesize].pack("N") + pattern.dup.force_encoding("ASCII-8BIT") + 
++    [data.bytesize].pack("N") + data
+   cache.print output
+   index.print [idx].pack("N")
+-  idx += output.length
++  idx += output.bytesize
+ end
+ 
+diff -ur migemo-0.40/migemo-convert.rb migemo-0.40-1.9.1/migemo-convert.rb
+--- migemo-0.40/migemo-convert.rb	2003-05-26 15:55:22.000000000 +0900
++++ migemo-0.40-1.9.1/migemo-convert.rb	2010-09-24 00:32:26.000000000 +0900
+@@ -1,3 +1,4 @@
++# -*- encoding:euc-jp -*-
+ #
+ # Ruby/Migemo - a library for Japanese incremental search.
+ #
+diff -ur migemo-0.40/migemo-dict.rb migemo-0.40-1.9.1/migemo-dict.rb
+--- migemo-0.40/migemo-dict.rb	2002-10-22 14:38:14.000000000 +0900
++++ migemo-0.40-1.9.1/migemo-dict.rb	2010-09-24 00:32:26.000000000 +0900
+@@ -1,3 +1,4 @@
++# -*- encoding:euc-jp -*-
+ #
+ # Ruby/Migemo - a library for Japanese incremental search.
+ #
+@@ -122,8 +123,8 @@
+   def lookup (pattern)
+     raise if pattern == nil
+     pattern = pattern.downcase
+-    idx = @index.bsearch_first do |idx| 
+-      key, data = decompose(idx)
++    idx = @index.bsearch_first do |idx1| 
++      key, data = decompose(idx1)
+       key <=> pattern 
+     end
+     if idx
+diff -ur migemo-0.40/migemo-index.rb migemo-0.40-1.9.1/migemo-index.rb
+--- migemo-0.40/migemo-index.rb	2003-05-26 15:45:53.000000000 +0900
++++ migemo-0.40-1.9.1/migemo-index.rb	2010-09-24 00:32:26.000000000 +0900
+@@ -19,5 +19,5 @@
+   unless line =~ /^;/
+     print [offset].pack("N")
+   end
+-  offset += line.length
++  offset += line.bytesize
+ end
+diff -ur migemo-0.40/migemo.rb.in migemo-0.40-1.9.1/migemo.rb.in
+--- migemo-0.40/migemo.rb.in	2003-05-28 21:00:52.000000000 +0900
++++ migemo-0.40-1.9.1/migemo.rb.in	2010-09-24 00:33:04.000000000 +0900
+@@ -1,3 +1,4 @@
++# -*- encoding:euc-jp -*-
+ #
+ # Ruby/Migemo - a library for Japanese incremental search.
+ #
+@@ -14,7 +15,6 @@
+ require 'migemo-dict'
+ require 'migemo-regex'
+ require 'romkan'
+-require 'jcode'
+ include MigemoRegex
+ 
+ class String
+@@ -24,7 +24,7 @@
+   end
+ 
+   def quotemeta
+-    self.gsub(/([^ \w])/, '\\\\\\1')
++    self.gsub(/([[:punct:]])/, '\\\\\\1')
+   end
+ 
+   def first
+@@ -177,7 +177,7 @@
+     expand_kanas.each do |x| 
+       compiler.push(x)
+       compiler.push(x.to_katakana)
+-      expand_words(@static_dict, x).each do |x| compiler.push(x) end
++      expand_words(@static_dict, x).each do |y| compiler.push(y) end
+     end
+     expand_words(@static_dict, @pattern).each do |x| compiler.push(x) end
+     compiler.uniq
+@@ -188,7 +188,7 @@
+   def lookup_user_dict
+     compiler = RegexCompiler.new
+     expand_kanas.each do |x| 
+-      expand_words(@user_dict, x).each do |x| compiler.push(x) end
++      expand_words(@user_dict, x).each do |y| compiler.push(y) end
+     end
+     expand_words(@user_dict, @pattern).each do |x| compiler.push(x) end
+     compiler.uniq
+diff -ur migemo-0.40/tests/Makefile.in migemo-0.40-1.9.1/tests/Makefile.in
+--- migemo-0.40/tests/Makefile.in	2003-05-29 17:09:03.000000000 +0900
++++ migemo-0.40-1.9.1/tests/Makefile.in	2010-09-24 00:32:26.000000000 +0900
+@@ -203,7 +203,7 @@
+ test-dict.cache: test-dict test-dict.idx ../migemo-cache.rb
+ 	ruby -rromkan -ne 'puts $$1.to_roma if /^(.+?)	/' test-dict |\
+ 	while read line; do\
+-	    echo $$line | ruby -ne 'chomp!;1.upto($$_.length) do |x| puts $$_[0,x] end';\
++	    echo $$line | ruby -ne '$$_.chomp!;1.upto($$_.length) do |x| puts $$_[0,x] end';\
+ 	done | ruby -I.. ../migemo-cache.rb test-dict
+ 
+ clean-local:
+diff -ur migemo-0.40/migemo-regex.rb migemo-0.40-1.9.1/migemo-regex.rb
+--- migemo-0.40/migemo-regex.rb
++++ migemo-0.40-1.9.1/migemo-regex.rb
+@@ -1,3 +1,4 @@
++# -*- encoding:euc-jp -*-
+ #
+ # Ruby/Migemo - a library for Japanese incremental search.
+ #
diff --git a/migemo.spec b/migemo.spec
index 21d93ed..88a3e37 100644
--- a/migemo.spec
+++ b/migemo.spec
@@ -4,23 +4,24 @@
 %define		xemacsver	21.4
 %define		e_sitedir	%{_datadir}/emacs/site-lisp
 %define		xe_sitedir	%{_datadir}/xemacs/site-lisp
-%define		rubyabi		1.8
-
-%{!?ruby_sitelib:	%define ruby_sitelib	%(ruby -rrbconfig -e "puts Config::CONFIG['sitelibdir']")}
+%define		rubyabi		1.9.1
 
 Name:		migemo
 Version:	%{migemover}
-Release:	14%{?dist}
+Release:	15%{?dist}
 Summary:	Japanese incremental search tool
 Group:		Applications/Text
 License:	GPLv2
 URL:		http://0xcc.net/migemo/
 Source0:	http://0xcc.net/migemo/%{name}-%{version}.tar.gz
+# patch taken and modified from http://d.hatena.ne.jp/yshl/20090814/1250197679
+Patch0:		migemo-ruby-1.9.patch
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildArch:	noarch
 
 BuildRequires:	ruby
+BuildRequires:	ruby-devel
 BuildRequires:	ruby(abi) = %{rubyabi}
 BuildRequires:	ruby(romkan)
 BuildRequires:	ruby(bsearch)
@@ -56,14 +57,17 @@ Requires:	apel
 
 %prep
 %setup -q
+%patch0 -p1
+sed -i '18d' migemo-convert.rb # patching is failing probably because of the special chars, so do this by sed
 
 %build
 %configure \
-	--with-rubydir=%{ruby_sitelib}
+	--with-rubydir=%{ruby_vendorlibdir}
 %{__make} %{?_smp_mflags} migemo.elc
 
 %install
 %{__rm} -rf $RPM_BUILD_ROOT
+export LANG=ja_JP.eucJP
 %{__make} INSTALL="%{__install} -c -p" DESTDIR=$RPM_BUILD_ROOT install
 
 # For xemacs
@@ -78,6 +82,7 @@ Requires:	apel
 %{__rm} -rf $RPM_BUILD_ROOT
 
 %check
+export LANG=ja_JP.eucJP
 cd tests
 for f in *.sh ; do \
 	sh ./$f || :
@@ -89,7 +94,7 @@ done
 
 %{_bindir}/migemo*
 %{_datadir}/migemo/
-%{ruby_sitelib}/migemo*
+%{ruby_vendorlibdir}/migemo*
 
 %files	emacs
 %defattr(-,root,root,-)
@@ -100,6 +105,9 @@ done
 %{xe_sitedir}/migemo.el*
 
 %changelog
+* Fri Mar 02 2012 Bohuslav Kabrda <bkabrda at redhat.com> - 0.40-15
+- Rebuilt and patched for Ruby 1.9.3.
+
 * Fri Jan 13 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.40-14
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
 


More information about the scm-commits mailing list