From 28293475dcac28f80927fadbdcb20a6d5db14d1b Mon Sep 17 00:00:00 2001 From: Mamoru Tasaka Date: Thu, 16 Sep 2010 16:19:57 +0900 Subject: [PATCH] - Patch for EL-5 ruby 1.8.5 specific issue (bug 634380) - fix missing symbol issue for ruby 1.8.5 - fix test_utc_datetime failure - Enable %check --- json-1.4.3-for-ruby185.patch | 40 ++++++++++++++++++++++++++++++++++++ rubygem-json.spec | 23 +++++++++++++++++---- 2 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 json-1.4.3-for-ruby185.patch diff --git a/json-1.4.3-for-ruby185.patch b/json-1.4.3-for-ruby185.patch new file mode 100644 index 0000000..20385f2 --- /dev/null +++ b/json-1.4.3-for-ruby185.patch @@ -0,0 +1,40 @@ +--- json-1.4.3/ext/json/ext/parser/parser.h.debug 2010-09-16 02:59:45.000000000 +0900 ++++ json-1.4.3/ext/json/ext/parser/parser.h 2010-09-16 04:49:41.000000000 +0900 +@@ -16,6 +16,15 @@ + + #define option_given_p(opts, key) RTEST(rb_funcall(opts, i_key_p, 1, key)) + ++/* see ext/generator/generator.h */ ++/* Needed for ruby 1.8.5 */ ++#ifndef RSTRING_PTR ++#define RSTRING_PTR(string) RSTRING(string)->ptr ++#endif ++#ifndef RSTRING_LEN ++#define RSTRING_LEN(string) RSTRING(string)->len ++#endif ++ + /* unicode */ + + typedef unsigned long UTF32; /* at least 32 bits */ +--- json-1.4.3/lib/json/add/core.rb.debug 2010-09-16 02:59:45.000000000 +0900 ++++ json-1.4.3/lib/json/add/core.rb 2010-09-16 04:54:14.000000000 +0900 +@@ -66,6 +66,19 @@ + if of_b and of_b != '0' + args << Rational(of_a.to_i, of_b.to_i) + else ++ # ++ # Only hack for ruby 1.8.5 ++ # Without the fix below, "rake test_ext (or rake test_pure) fails ++ # for test_utc_datetime(TC_JSONAddition) at tests/test_json_addition.rb:156 ++ if RUBY_VERSION == "1.8.5" ++ if of_a.is_a?(String) ++ of_a = of_a.to_i ++ end ++ end ++ # The above fix is not needed for ruby 1.8.6 and above due to the change ++ # on civil() in date.rb ++ # Fix for ruby 1.8.5 end ++ # + args << of_a + end + args << object['sg'] diff --git a/rubygem-json.spec b/rubygem-json.spec index 9afd8dc..aa6d1b7 100644 --- a/rubygem-json.spec +++ b/rubygem-json.spec @@ -9,7 +9,7 @@ Name: rubygem-%{gemname} Version: 1.4.3 -Release: 3%{?dist} +Release: 3%{?dist}.1 Summary: A JSON implementation in Ruby Group: Development/Languages @@ -17,6 +17,7 @@ Group: Development/Languages License: Ruby or GPLv2 URL: http://json.rubyforge.org Source0: http://gems.rubyforge.org/gems/%{gemname}-%{version}.gem +Patch0: json-1.4.3-for-ruby185.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: ruby, ruby-devel @@ -64,6 +65,14 @@ export CONFIGURE_ARGS="--with-cflags='%{optflags}'" #pushd ./%{gemdir} gem install --local --install-dir .%{gemdir} -V --force %{SOURCE0} +# change cflags to honor Fedora compiler flags correctly +find . -name extconf.rb | xargs sed -e 's|-O3|-O2|' +pushd .%{geminstdir} +cat %PATCH0 | patch -s -p1 --fuzz=0 +# compile again +rake clean +rake + %install rm -rf $RPM_BUILD_ROOT @@ -150,9 +159,9 @@ create_symlink_rec %{geminstdir}/lib %{ruby_sitelib} rm -rf $RPM_BUILD_ROOT %check -#pushd .%{geminstdir} -#rake test --trace -#popd +pushd .%{geminstdir} +rake test_ext --trace +popd @@ -183,6 +192,12 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Thu Sep 16 2010 Mamoru Tasaka - 1.4.3-3.1 +- Patch for EL-5 ruby 1.8.5 specific issue (bug 634380) + - fix missing symbol issue for ruby 1.8.5 + - fix test_utc_datetime failure +- Enable %%check + * Fri Jun 11 2010 Xavier Lamien - 1.4.3-3 - Fix gtk2-editor removal.