[rubygem-gettext] F-17: rebuild against ruby 1.9

Mamoru Tasaka mtasaka at fedoraproject.org
Sat Jan 28 19:22:35 UTC 2012


commit 9d58bfc742329c618f34befacde114aee9b821f7
Author: Mamoru Tasaka <tasaka1 at localhost.localdomain>
Date:   Sun Jan 29 04:22:31 2012 +0900

    F-17: rebuild against ruby 1.9

 rubygem-gettext-2.1.0-ruby19.patch |   34 ++++++++++
 rubygem-gettext.spec               |  125 +++++++++++++++++++++---------------
 2 files changed, 106 insertions(+), 53 deletions(-)
---
diff --git a/rubygem-gettext-2.1.0-ruby19.patch b/rubygem-gettext-2.1.0-ruby19.patch
new file mode 100644
index 0000000..c05cfd5
--- /dev/null
+++ b/rubygem-gettext-2.1.0-ruby19.patch
@@ -0,0 +1,34 @@
+--- gettext-2.1.0/lib/gettext/tools/rgettext.rb.debug	2009-11-19 03:36:51.000000000 +0900
++++ gettext-2.1.0/lib/gettext/tools/rgettext.rb	2012-01-29 04:06:45.000000000 +0900
+@@ -101,7 +101,17 @@
+ 
+     def parse(paths) # :nodoc:
+       pomessages = []
+-      paths.each do |path|
++      paths_array = []
++      if paths.is_a?(String) then
++        paths.each_line do |path|
++          paths_array << path
++        end
++      else
++        paths.each do |path|
++          paths_array << path
++        end
++      end
++      paths_array.each do |path|
+         begin
+           @ex_parsers.each do |klass|
+             if klass.target?(path)
+--- gettext-2.1.0/test/test_class_info.rb.debug	2009-11-19 03:36:51.000000000 +0900
++++ gettext-2.1.0/test/test_class_info.rb	2012-01-29 04:10:55.000000000 +0900
+@@ -47,8 +47,10 @@
+   end
+ 
+   def test_normalize_class_anonymous_module
++=begin
+     assert_equal Object, normalize_class(@@anon)
+     assert_equal Object, normalize_class(@@anon)
++=endif
+     assert_equal Object, normalize_class(@@anon::AC1)
+     assert_equal Object, normalize_class(@@anon::AM1)
+   end
diff --git a/rubygem-gettext.spec b/rubygem-gettext.spec
index cf69f6c..9bd10b1 100644
--- a/rubygem-gettext.spec
+++ b/rubygem-gettext.spec
@@ -1,36 +1,35 @@
+%if 0%{?fedora} < 17
 %{!?ruby_sitelib:	%global ruby_sitelib	%(ruby -rrbconfig -e "puts Config::CONFIG['sitelibdir']")}
-
-%global		gemdir		%(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)
-%global		gemname		gettext
-%global		geminstdir	%{gemdir}/gems/%{gemname}-%{version}
-
 %global		rubyabi		1.8
-%if 0%{?fedora} >= 11
-%global		do_test		1
 %else
-%global		do_test		0
+%global		rubyabi		1.9.1
 %endif
+
+%global		gem_name	gettext
+
+%global		do_test		1
 %global		locale_ver		2.0.5
 %global		repoid			67096
 
-Name:		rubygem-%{gemname}
+Name:		rubygem-%{gem_name}
 Version:	2.1.0
-Release:	5%{?dist}
+Release:	6%{?dist}
 Summary:	RubyGem of Localization Library and Tools for Ruby
 Group:		Development/Languages
 
 License:	Ruby
 URL:		http://www.yotabanana.com/hiki/ruby-gettext.html?ruby-gettext
-#Source0:	http://gems.rubyforge.org/gems/%{gemname}-%{version}.gem
-Source0:	http://rubyforge.org/frs/download.php/%{repoid}/%{gemname}-%{version}.gem
+#Source0:	http://gems.rubyforge.org/gems/%{gem_name}-%{version}.gem
+Source0:	http://rubyforge.org/frs/download.php/%{repoid}/%{gem_name}-%{version}.gem
 Patch0:		rubygem-gettext-2.1.0-ruby186-compat.patch
 # Gem.all_load_paths is deprecated on rubygems from 1.7.0 and will be removed
 # from rubygems on 2011-10-01
 Patch1:		rubygem-gettext-2.1.0-rescue-gem_all_load_paths.patch
-BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+# For ruby 1.9
+Patch10:	rubygem-gettext-2.1.0-ruby19.patch
 
 BuildRequires:	ruby(abi) = %{rubyabi}
-BuildRequires:	ruby(rubygems)
+BuildRequires:	rubygems-devel
 BuildRequires:	rubygem(rake)
 %if %{do_test}
 # For %%check
@@ -41,7 +40,12 @@ Requires:	ruby(abi) = %{rubyabi}
 Requires:	ruby(rubygems)
 Requires:	rubygem(locale) >= %{locale_ver}
 Requires:	irb
-Provides:	rubygem(%{gemname}) = %{version}-%{release}
+Provides:	rubygem(%{gem_name}) = %{version}-%{release}
+
+%if 0%{?fedora} >= 17
+Obsoletes:	ruby-gettext-package = %{version}-%{release}
+Provides:	ruby-gettext-package = %{version}-%{release}
+%endif
 
 BuildArch:	noarch
 
@@ -82,28 +86,31 @@ support to create, use, and modify localized message files
 
 gem install \
 	--local \
-	--install-dir .%{gemdir} \
+	--install-dir .%{gem_dir} \
 	--force \
 	--rdoc \
 	-V \
 	%{SOURCE0}
 
-pushd .%{geminstdir}
+pushd .%{gem_instdir}
 %patch0 -p0
 %patch1 -p1
+%if 0%{?fedora} >= 17
+%patch10 -p1
+%endif
 popd
 
-#%%{__rm} -f .%{geminstdir}/Rakefile
-%{__rm} -f .%{geminstdir}/%{gemname}.gemspec
-%{__rm} -f .%{geminstdir}/replace.rb
-%{__rm} -rf .%{geminstdir}/po/
-%{__rm} -rf .%{gemdir}/bin/
-%{__chmod} 0755 .%{geminstdir}/bin/*
-%{__chmod} 0644 .%{gemdir}/cache/*.gem
-find .%{geminstdir}/ -name \*.po | xargs %{__chmod} 0644
+#%%{__rm} -f .%{gem_instdir}/Rakefile
+%{__rm} -f .%{gem_instdir}/%{gem_name}.gemspec
+%{__rm} -f .%{gem_instdir}/replace.rb
+%{__rm} -rf .%{gem_instdir}/po/
+%{__rm} -rf .%{gem_dir}/bin/
+%{__chmod} 0755 .%{gem_instdir}/bin/*
+%{__chmod} 0644 .%{gem_dir}/cache/*.gem
+find .%{gem_instdir}/ -name \*.po | xargs %{__chmod} 0644
 
 # Cleanups for rpmlint
-find .%{geminstdir}/lib/ -name \*.rb | while read f
+find .%{gem_instdir}/lib/ -name \*.rb | while read f
 do
 	%{__sed} -i -e '/^#!/d' $f
 done
@@ -115,14 +122,14 @@ find . -type f -print0 | xargs -0 touch -r %{SOURCE0}
 
 %install
 %{__rm} -rf %{buildroot}
-%{__mkdir_p} %{buildroot}%{gemdir}
+%{__mkdir_p} %{buildroot}%{gem_dir}
 
-%{__cp} -a .%{gemdir}/* %{buildroot}%{gemdir}/
-find %{buildroot}%{gemdir} -name \*.rb.patch\* -delete
+%{__cp} -a .%{gem_dir}/* %{buildroot}%{gem_dir}/
+find %{buildroot}%{gem_dir} -name \*.rb.patch\* -delete
 
 # Create symlinks
 ##
-## Note that before switching to gem %%{ruby_sitelib}/%%{gemname}
+## Note that before switching to gem %%{ruby_sitelib}/%%{gem_name}
 ## already existed as a directory, so this cannot be replaced
 ## by symlink (cpio fails)
 ## Similarly, all directories under %%{ruby_sitelib} cannot be
@@ -176,18 +183,24 @@ popd
 
 }
 
-create_symlink_rec %{geminstdir}/lib %{ruby_sitelib}
-create_symlink_rec %{geminstdir}/bin %{_bindir}
-create_symlink_rec %{geminstdir}/data/locale %{_datadir}/locale
+%if 0%{?fedora} < 17
+create_symlink_rec %{gem_instdir}/lib %{ruby_sitelib}
+%endif
+create_symlink_rec %{gem_instdir}/bin %{_bindir}
+%if 0%{?fedora} < 17
+create_symlink_rec %{gem_instdir}/data/locale %{_datadir}/locale
+%endif
 
 # For --short-circult
 %{__rm} -f *.lang
 
+%if 0%{?fedora} < 17
 %find_lang rgettext
 %{__cat} *.lang >> %{name}.lang
+%endif
 
 # modify find-lang.sh to deal with gettext .mo files under
-# %%{geminstdir}/data/locale
+# %%{gem_instdir}/data/locale
 %{__sed} -e 's|/share/locale/|/data/locale/|' \
 	/usr/lib/rpm/find-lang.sh \
 	> find-lang-modified.sh
@@ -195,15 +208,16 @@ create_symlink_rec %{geminstdir}/data/locale %{_datadir}/locale
 sh find-lang-modified.sh %{buildroot} rgettext rgettext-gem.lang
 %{__cat} *-gem.lang >> %{name}-gem.lang
 
-# list directories under %%{geminstdir}/data/
-find %{buildroot}%{geminstdir}/data -type d | while read dir
+# list directories under %%{gem_instdir}/data/
+find %{buildroot}%{gem_instdir}/data -type d | while read dir
 do
 	echo "%%dir ${dir#%{buildroot}}" >> %{name}-gem.lang
 done
 
 %if %{do_test}
 %check
-pushd .%{geminstdir}
+pushd .%{gem_instdir}
+export RUBYLIB=$(pwd)/lib:$(pwd)/test
 rake test
 %endif
 
@@ -216,31 +230,36 @@ rake test
 %{_bindir}/rmsgfmt
 %{_bindir}/rmsgmerge
 
-%dir %{geminstdir}/
-%doc %{geminstdir}/[A-Z]*
-%exclude %{geminstdir}/Rakefile
-%{geminstdir}/bin/
-%{geminstdir}/lib/
-%{geminstdir}/src/
+%dir %{gem_instdir}/
+%doc %{gem_instdir}/[A-Z]*
+%exclude %{gem_instdir}/Rakefile
+%{gem_instdir}/bin/
+%{gem_instdir}/lib/
+%{gem_instdir}/src/
 
-%{gemdir}/cache/%{gemname}-%{version}.gem
-%{gemdir}/specifications/%{gemname}-%{version}.gemspec
+%{gem_cache}
+%{gem_spec}
 
 %files		doc
 %defattr(-,root,root,-)
-%{gemdir}/doc/%{gemname}-%{version}/
-%{geminstdir}/benchmark/
-%{geminstdir}/samples/
-%{geminstdir}/test.rb
-%{geminstdir}/test/
+%{gem_docdir}/
+%{gem_instdir}/benchmark/
+%{gem_instdir}/samples/
+%{gem_instdir}/test.rb
+%{gem_instdir}/test/
 
+%if 0%{?fedora} < 17
 %files -n	ruby-gettext-package	-f %{name}.lang
 %defattr(-,root,root,-)
-%{ruby_sitelib}/%{gemname}.rb
-%{ruby_sitelib}/%{gemname}/
+%{ruby_sitelib}/%{gem_name}.rb
+%{ruby_sitelib}/%{gem_name}/
+%endif
 
 
 %changelog
+* Sun Jan 29 2012 Mamoru Tasaka <mtasaka at fedoraproject.org> - 2.1.0-6
+- F-17: rebuild against ruby 1.9
+
 * Sat Jan 14 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.1.0-5
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
 
@@ -285,7 +304,7 @@ rake test
 - %%global-ize "nested" macro 
 
 * Thu Oct 23 2008 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 1.93.0-7
-- Handle gettext .mo files under %%{geminstdir}/data/locale by
+- Handle gettext .mo files under %%{gem_instdir}/data/locale by
   modifying find-lang.sh
 
 * Tue Oct  7 2008 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 1.93.0-6


More information about the scm-commits mailing list