[rubygem-glib2/f17] Fix UTF-{16,32} related test failure on ppc{,64}

Mamoru Tasaka mtasaka at fedoraproject.org
Tue Mar 27 04:47:13 UTC 2012


commit 52429f73ec4cd03faac0c72800ed1d8a7c46b003
Author: TASAKA Mamoru <mtasaka at localhost.localdomain>
Date:   Tue Mar 27 13:47:00 2012 +0900

    Fix UTF-{16,32} related test failure on ppc{,64}
    
      (bug 804319, upstream bug 107)

 rubygem-glib2-1.1.2-utf-endian.patch |   49 ++++++++++++++++++++++++++++++++++
 rubygem-glib2.spec                   |   13 +++++++--
 2 files changed, 59 insertions(+), 3 deletions(-)
---
diff --git a/rubygem-glib2-1.1.2-utf-endian.patch b/rubygem-glib2-1.1.2-utf-endian.patch
new file mode 100644
index 0000000..5757859
--- /dev/null
+++ b/rubygem-glib2-1.1.2-utf-endian.patch
@@ -0,0 +1,49 @@
+commit fe12467a828f081a1c2d7284ff306a3660b430a8
+Author: Kouhei Sutou <kou at clear-code.com>
+Date:   Mon Mar 26 22:00:35 2012 +0900
+
+    glib2 test: work on ppc
+    
+    GitHub: #107
+    
+    Reported by mtasaka. Thanks!!!
+
+diff --git a/glib2/test/test_unicode.rb b/glib2/test/test_unicode.rb
+index 09f270b..52ac0f7 100644
+--- a/glib2/test/test_unicode.rb
++++ b/glib2/test/test_unicode.rb
+@@ -351,7 +351,11 @@ class TestGLibUnicode < Test::Unit::TestCase
+ 
+   def utf8_to_utf32(string)
+     if string.respond_to?(:encode)
+-      string.encode("UTF-32LE")
++      if little_endian?
++        string.encode("UTF-32LE")
++      else
++        string.encode("UTF-32BE")
++      end
+     else
+       require_uconv
+       Uconv.u8tou4(string)
+@@ -360,7 +364,11 @@ class TestGLibUnicode < Test::Unit::TestCase
+ 
+   def utf8_to_utf16(string)
+     if string.respond_to?(:encode)
+-      string.encode("UTF-16LE")
++      if little_endian?
++        string.encode("UTF-16LE")
++      else
++        string.encode("UTF-16BE")
++      end
+     else
+       require_uconv
+       Uconv.u8tou16(string)
+@@ -379,4 +387,8 @@ class TestGLibUnicode < Test::Unit::TestCase
+     end
+     string
+   end
++
++  def little_endian?
++    [1].pack("v") == [1].pack("S")
++  end
+ end
diff --git a/rubygem-glib2.spec b/rubygem-glib2.spec
index 4ca3df5..6a3c3ee 100644
--- a/rubygem-glib2.spec
+++ b/rubygem-glib2.spec
@@ -18,15 +18,17 @@
 Summary:	Ruby binding of GLib-2.x
 Name:		rubygem-%{gem_name}
 Version:	1.1.2
-Release:	4%{?dist}
+Release:	5%{?dist}
 Group:		Development/Languages
 # from README
 License:	LGPLv2
 URL:		http://ruby-gnome2.sourceforge.jp/
 Source0:	http://rubygems.org/gems/%{gem_name}-%{version}.gem
-# https://github.com/ruby-gnome2/ruby-gnome2/issues/106
 # https://bugzilla.redhat.com/show_bug.cgi?id=804319
+# https://github.com/ruby-gnome2/ruby-gnome2/issues/106
 Patch0:	rubygem-glib2-1.1.2-ifdef-enum.patch
+# https://github.com/ruby-gnome2/ruby-gnome2/issues/107
+Patch1:	rubygem-glib2-1.1.2-utf-endian.patch
 
 BuildRequires:	ruby(abi) = %{rubyabi}
 BuildRequires:	rubygems-devel
@@ -110,6 +112,7 @@ tar xf %{SOURCE0}
 cd glib2
 tar xzf ../data.tar.gz
 %patch0 -p2
+%patch1 -p2
 rake gem
 mv pkg/%{gem_name}-%{version}.gem $TOPDIR/
 popd
@@ -354,8 +357,12 @@ popd
 
 
 %changelog
+* Tue Mar 27 2012 Mamoru Tasaka <mtasaka at fedoraproject.org> - 1.1.2-5
+- Fix UTF-{16,32} related test failure on ppc{,64}
+  (bug 804319, upstream bug 107)
+
 * Fri Mar 23 2012 Mamoru Tasaka <mtasaka at fedoraproject.org> - 1.1.2-4
-- Fix build error with GLib >= 2.31.20 (bug 804319)
+- Fix build error with GLib >= 2.31.20 (bug 804319, upstream bug 106)
 
 * Wed Feb  1 2012 Mamoru Tasaka <mtasaka at fedoraproject.org> - 1.1.2-3
 - Add proper Obsoletes/Provides


More information about the scm-commits mailing list