summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Legler <a3li@gentoo.org>2011-04-10 20:53:19 +0000
committerAlex Legler <a3li@gentoo.org>2011-04-10 20:53:19 +0000
commit79333da6d48a9922f99153cbe090605f0e535474 (patch)
tree1326e7502366ae74f2a3fbc74bcf47a1c4f1fcc6 /dev-ruby
parenthttp://my.opera.com/desktopteam/blog/2011/04/10/barracuda-release-candidate-3-11 (diff)
downloadhistorical-79333da6d48a9922f99153cbe090605f0e535474.tar.gz
historical-79333da6d48a9922f99153cbe090605f0e535474.tar.bz2
historical-79333da6d48a9922f99153cbe090605f0e535474.zip
Revbump, fixing issues with an empty LANGUAGE variable. Patches via upstream rubyforge ticket #26998. Fixes bugs 327677 and 330227.
Package-Manager: portage-2.2.0_alpha28/cvs/Linux x86_64
Diffstat (limited to 'dev-ruby')
-rw-r--r--dev-ruby/locale/ChangeLog9
-rw-r--r--dev-ruby/locale/Manifest12
-rw-r--r--dev-ruby/locale/files/locale-language-fixes.patch246
-rw-r--r--dev-ruby/locale/locale-2.0.5-r2.ebuild34
4 files changed, 295 insertions, 6 deletions
diff --git a/dev-ruby/locale/ChangeLog b/dev-ruby/locale/ChangeLog
index 0e197f734967..1c306c353905 100644
--- a/dev-ruby/locale/ChangeLog
+++ b/dev-ruby/locale/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for dev-ruby/locale
# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-ruby/locale/ChangeLog,v 1.22 2011/01/10 18:05:35 graaff Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-ruby/locale/ChangeLog,v 1.23 2011/04/10 20:53:19 a3li Exp $
+
+*locale-2.0.5-r2 (10 Apr 2011)
+
+ 10 Apr 2011; Alex Legler <a3li@gentoo.org> +locale-2.0.5-r2.ebuild,
+ +files/locale-language-fixes.patch:
+ Revbump, fixing issues with an empty LANGUAGE variable. Patches via upstream
+ rubyforge ticket #26998. Fixes bugs 327677 and 330227.
10 Jan 2011; Hans de Graaff <graaff@gentoo.org> locale-2.0.5-r1.ebuild:
Keyword ~x86-macos.
diff --git a/dev-ruby/locale/Manifest b/dev-ruby/locale/Manifest
index f8141ccbae27..4f5f66ab5518 100644
--- a/dev-ruby/locale/Manifest
+++ b/dev-ruby/locale/Manifest
@@ -1,15 +1,17 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
+AUX locale-language-fixes.patch 8049 RMD160 49e3f1a2867d1c9cb36984929d70d8fa9e36da34 SHA1 4d064a9add31ce31e3ac4d394f81f7a88ecc2f6e SHA256 7ad3a4143f5994090cd0d4b4fe5acee1117c1d318ddf1a5c9960338a7b8d1308
DIST locale-2.0.5.gem 111104 RMD160 3b32340c2983e2cf707a52868a6152a6e74505d2 SHA1 70962dd7b0fe9b1eb59775e8fed2a2543d1b5361 SHA256 28baf0410c9742eb49402200f47b99d9d4b793e02a5436a7275a89d273eafe00
EBUILD locale-2.0.5-r1.ebuild 836 RMD160 cac20b812bee662228841ffe067811f746dbd185 SHA1 e74e2f0d7dd0223bd69e43f8723a666a0203f26b SHA256 13d7ddee26faa4f689c82a3ea2ad755fd34281eb6ceaf797004fc21c18c6da3c
+EBUILD locale-2.0.5-r2.ebuild 893 RMD160 6c275ed3d22f0ed36091265d9e4ee475f9e3b2eb SHA1 e598383db743b76060e620c681992e2cf6c16588 SHA256 9312da9c6c4e037728679a469aab55d513a2eba206b11e78e43b28864df6a773
EBUILD locale-2.0.5.ebuild 452 RMD160 aec862ff9e182fc2d0c6e865b37d2fc92ad8cf1c SHA1 7139846adf20fa5cb7301175cbe398593455b448 SHA256 2cb2b338a20e0f7156f5920b25e201a38b6da2c1cda20783a19747219c05996c
-MISC ChangeLog 3011 RMD160 ee42c34ab9d790784ff6ed46f3e8484fdad0f1a9 SHA1 a657888ded05122a84eed2fdd8b79a8ffbff4e31 SHA256 631035016168abc8160ed964b2bfa0f6d8b825eb2c7d891948fc0412d46fb70e
+MISC ChangeLog 3286 RMD160 6f5d1fde2060d6f1f114fe69fe882a86d47dbbee SHA1 670fa5acb40b7ec6b99f6e3949cc63bb6fd10600 SHA256 2da897ef6c0d8b5ae12da1ed07676a4ab7cba5f0665f19d166cb810fbdd4990c
MISC metadata.xml 158 RMD160 097f8145a9994f98be4971b43b23b9e5e8bccb66 SHA1 7ac646714b1ab83fda98f3ccdd8b48a31c148b27 SHA256 70b396ab3c7a63a81cb895b7728bd9eccdc9770afdb9919f2c54694b685f7032
-----BEGIN PGP SIGNATURE-----
-Version: GnuPG v2.0.16 (GNU/Linux)
+Version: GnuPG v2.0.17 (GNU/Linux)
-iF4EAREIAAYFAk0rSnQACgkQrnu0mw69JkpDyQD/Yj+dYj7/4zbypmuz0wV8XeYp
-unIgke1RD2yumqfQESsBAI5b3qaggcZfuabW/PbAhxz4DpNeCsN39kXNNm3Ilskq
-=Ow1B
+iF4EAREIAAYFAk2iGM4ACgkQ3Ca6Xy8+rvRoSwD6ArFPNXrF2PYIh0RWz0k5PaWF
+h0H36DtpMSm3deBte3gA/3tLZ6v3G4YgZ7Vpn1EkIwLLO58EFQ9TfynwWw68MHdH
+=euy6
-----END PGP SIGNATURE-----
diff --git a/dev-ruby/locale/files/locale-language-fixes.patch b/dev-ruby/locale/files/locale-language-fixes.patch
new file mode 100644
index 000000000000..e4398808bb65
--- /dev/null
+++ b/dev-ruby/locale/files/locale-language-fixes.patch
@@ -0,0 +1,246 @@
+Combined patch of upstream commits 4cbfbbc2..c6c01691,
+fixes multiple issues with an empty/unset/malformatted LANGUAGE env variable.
+
+Bugs 327677 and 330227 for instance are caused by this.
+Upstream: yes
+
+diff --git a/README.rdoc b/README.rdoc
+index 381032f..5705872 100644
+--- a/README.rdoc
++++ b/README.rdoc
+@@ -11,7 +11,7 @@ handle major locale ID standards.
+ * POSIX, CLDR, IETF(RFC4646, 3066(BCP47)), Win32 and Java language tags
+ and convert the tag string to each other.
+ * Auto detect Locale ID.
+- POSIX(Unix/Linux/*BSD), Win32, JRuby, CGI.
++ POSIX(Unix/Linux/*BSD), Win32, JRuby, CGI(CGI, Rack, others).
+
+ * Resources
+ * ISO 639-3 languages
+diff --git a/lib/locale.rb b/lib/locale.rb
+index f56de37..95b965a 100644
+--- a/lib/locale.rb
++++ b/lib/locale.rb
+@@ -236,9 +236,11 @@ module Locale
+ end
+
+ tags = []
+- (0...candidate_tags[0].size).each {|i|
+- tags += candidate_tags.collect{|v| v[i]}
+- }
++ unless candidate_tags.empty?
++ (0...candidate_tags[0].size).each {|i|
++ tags += candidate_tags.collect{|v| v[i]}
++ }
++ end
+ tags += default_tags
+ tags.uniq!
+
+diff --git a/lib/locale/driver/cgi.rb b/lib/locale/driver/cgi.rb
+index c1d1126..4035c78 100644
+--- a/lib/locale/driver/cgi.rb
++++ b/lib/locale/driver/cgi.rb
+@@ -50,7 +50,9 @@ module Locale
+ unless locales.size > 0
+ # HTTP_ACCEPT_LANGUAGE
+ if lang = req[:accept_language] and lang.size > 0
+- locales += lang.gsub(/\s/, "").split(/,/).map{|v| v.split(";q=")}.map{|j| [j[0], j[1] ? j[1].to_f : 1.0]}.sort{|a,b| -(a[1] <=> b[1])}.map{|v| Locale::Tag.parse(v[0])}
++ # 10.0 is for ruby-1.8.6 which have the bug of str.to_f.
++ # Normally, this should be 1.0.
++ locales += lang.gsub(/\s/, "").split(/,/).map{|v| v.split(";q=")}.map{|j| [j[0], j[1] ? j[1].to_f : 10.0]}.sort{|a,b| -(a[1] <=> b[1])}.map{|v| Locale::Tag.parse(v[0])}
+ end
+ end
+
+@@ -81,6 +83,7 @@ module Locale
+ # * accept_language: The value of HTTP_ACCEPT_LANGUAGE
+ # * accept_charset: The value of HTTP_ACCEPT_CHARSET
+ def set_request(query_langs, cookie_langs, accept_language, accept_charset)
++ Locale.clear
+ Thread.current[:current_request] = {
+ :query_langs => query_langs,
+ :cookie_langs => cookie_langs,
+diff --git a/lib/locale/driver/env.rb b/lib/locale/driver/env.rb
+index 9d0995f..a3e1b34 100644
+--- a/lib/locale/driver/env.rb
++++ b/lib/locale/driver/env.rb
+@@ -39,13 +39,16 @@ module Locale
+ # Gets the locales from environment variables. (LANGUAGE > LC_ALL > LC_MESSAGES > LANG)
+ # * Returns: an Array of the locale as Locale::Tag::Posix or nil.
+ def locales
+- if (locales = ENV["LANGUAGE"])
+- Locale::TagList.new(locales.split(/:/).collect{|v| Locale::Tag::Posix.parse(v)})
++ locales = ENV["LANGUAGE"]
++ if (locales != nil and locales.size > 0)
++ locs = locales.split(/:/).collect{|v| Locale::Tag::Posix.parse(v)}.compact
++ if locs.size > 0
++ return Locale::TagList.new(locs)
++ end
+ elsif (loc = locale)
+- Locale::TagList.new([loc])
+- else
+- nil
++ return Locale::TagList.new([loc])
+ end
++ nil
+ end
+
+ # Gets the charset from environment variable or return nil.
+diff --git a/lib/locale/driver/win32.rb b/lib/locale/driver/win32.rb
+index 2bb6fbc..2ac09f8 100644
+--- a/lib/locale/driver/win32.rb
++++ b/lib/locale/driver/win32.rb
+@@ -1,7 +1,7 @@
+ =begin
+ locale/win32.rb
+
+- Copyright (C) 2002-2008 Masao Mutoh
++ Copyright (C) 2002-2010 Masao Mutoh
+
+ You may redistribute it and/or modify it under the same
+ license terms as Ruby.
+@@ -13,8 +13,10 @@
+
+ require File.join(File.dirname(__FILE__), 'env')
+ require File.join(File.dirname(__FILE__), 'win32_table')
+-require 'dl/win32'
+
++unless Win32API
++ require 'dl/win32'
++end
+
+ module Locale
+ # Locale::Driver::Win32 module for win32.
+diff --git a/samples/rack/hello_rack.rb b/samples/rack/hello_rack.rb
+index d6cb160..0f458aa 100644
+--- a/samples/rack/hello_rack.rb
++++ b/samples/rack/hello_rack.rb
+@@ -1,14 +1,13 @@
+ require 'rubygems'
+ require 'rack'
+-require 'locale'
++require 'locale_rack'
+
+-Locale.init(:driver => :cgi)
+-
+ class HelloRackApp
++ include Locale::Rack
++
+ def call(env)
+ req = Rack::Request.new(env)
+- Locale.set_request(req["lang"], req.cookies["lang"],
+- env["HTTP_ACCEPT_LANGUAGE"], env["HTTP_ACCEPT_CHARSET"])
++ init_locale(env, req)
+ str = "Language tag candidates of your request order by the priority:\n\n"
+ str += Locale.candidates(:type => :rfc).map{|v| v.inspect + "\n"}.join
+ [200, {"Content-Type" => "text/plain", "Content-Length" => str.length.to_s}, [str]]
+diff --git a/samples/rack/locale_rack.rb b/samples/rack/locale_rack.rb
+new file mode 100644
+index 0000000..2b53a8a
+--- /dev/null
++++ b/samples/rack/locale_rack.rb
+@@ -0,0 +1,11 @@
++ require 'locale'
++ Locale.init(:driver => :cgi)
++
++ module Locale::Rack
++ def init_locale(env, req)
++ Locale.set_request([req["lang"]], [req.cookies["lang"]],
++ env["HTTP_ACCEPT_LANGUAGE"],
++ env["HTTP_ACCEPT_CHARSET"])
++ end
++ end
++
+diff --git a/test/test_detect_cgi.rb b/test/test_detect_cgi.rb
+index e2adbfc..ef5a090 100644
+--- a/test/test_detect_cgi.rb
++++ b/test/test_detect_cgi.rb
+@@ -213,4 +213,12 @@ class TestDetectCGI < Test::Unit::TestCase
+ Locale.default = "en"
+ Locale.set_app_language_tags(nil)
+ end
++
++ def test_request
++ Locale.set_request(["ja"], [""], "", "")
++ assert_equal common("ja", "en"), Locale.candidates
++
++ Locale.set_request(["en"], [""], "", "")
++ assert_equal common("en"), Locale.candidates #Cache should be cleared.
++ end
+ end
+diff --git a/test/test_detect_general.rb b/test/test_detect_general.rb
+index 08b912d..2367354 100644
+--- a/test/test_detect_general.rb
++++ b/test/test_detect_general.rb
+@@ -102,6 +102,35 @@ class TestDetectGeneral < Test::Unit::TestCase
+ assert_equal "Shift_JIS", Locale.charset
+ end
+
++ def test_language_strip
++ ENV["LC_ALL"] = "ja_JP.Shift_JIS"
++ ENV["LANGUAGE"] = nil
++
++ tags = Locale.current
++ assert_equal 1, tags.size
++ assert_equal Locale::Tag::Posix, tags[0].class
++ assert_equal "ja", tags.language
++ assert_equal "ja", tags[0].language
++ Locale.clear
++ ENV["LANGUAGE"] = ""
++
++ tags = Locale.current
++ assert_equal 1, tags.size
++ assert_equal Locale::Tag::Posix, tags[0].class
++ assert_equal "ja", tags.language
++ assert_equal "ja", tags[0].language
++ Locale.clear
++ ENV["LANGUAGE"] = "zh_CN.UTF-8:ja_JP"
++
++ tags = Locale.current
++ assert_equal 2, tags.size
++ assert_equal Locale::Tag::Posix, tags[0].class
++ assert_equal Locale::Tag::Posix, tags[1].class
++ assert_equal "zh", tags.language
++ assert_equal "zh", tags[0].language
++ assert_equal "ja", tags[1].language
++ end
++
+ def test_no_charset
+ ENV["LC_ALL"] = "cs_CZ"
+
+@@ -149,6 +178,24 @@ class TestDetectGeneral < Test::Unit::TestCase
+ Locale.set_default(nil)
+ end
+
++ def test_wrong_envs
++ ENV["LC_ALL"] = nil
++ ENV["LANGUAGE"] = "g"
++ Locale.default = "de"
++ assert_equal Locale::Tag.parse("de"), Locale.current[0]
++
++ ENV["LC_ALL"] = "f"
++ ENV["LANGUAGE"] = nil
++ Locale.default = "fr"
++ assert_equal Locale::Tag.parse("fr"), Locale.current[0]
++
++ ENV["LC_ALL"] = "j"
++ ENV["LANGUAGE"] = nil
++ Locale.default = nil
++ assert_equal Locale::Tag.parse("en"), Locale.current[0]
++
++ end
++
+ def test_clear
+ ENV["LC_ALL"] = "ja_JP.Shift_JIS"
+ ENV["LANGUAGE"] = nil
+diff --git a/test/test_driver_win32.rb b/test/test_driver_win32.rb
+index 604cd6e..35199e6 100644
+--- a/test/test_driver_win32.rb
++++ b/test/test_driver_win32.rb
+@@ -60,6 +60,6 @@ begin
+ assert_equal "CP1252", Locale::Driver::Win32.charset
+ end
+ end
+-rescue LoadError
++rescue LoadError, NameError
+ puts "win32 test was skipped."
+ end
diff --git a/dev-ruby/locale/locale-2.0.5-r2.ebuild b/dev-ruby/locale/locale-2.0.5-r2.ebuild
new file mode 100644
index 000000000000..d0bdb303b97a
--- /dev/null
+++ b/dev-ruby/locale/locale-2.0.5-r2.ebuild
@@ -0,0 +1,34 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-ruby/locale/locale-2.0.5-r2.ebuild,v 1.1 2011/04/10 20:53:19 a3li Exp $
+
+EAPI=2
+
+USE_RUBY="ruby18 ruby19 jruby ree18"
+
+RUBY_FAKEGEM_TASK_DOC="rerdoc"
+RUBY_FAKEGEM_DOCDIR="doc"
+RUBY_FAKEGEM_EXTRADOC="ChangeLog README.rdoc"
+
+RUBY_FAKEGEM_TASK_TEST="test"
+
+inherit ruby-fakegem
+
+DESCRIPTION="A pure ruby library which provides basic APIs for localization."
+HOMEPAGE="http://locale.rubyforge.org/"
+LICENSE="|| ( Ruby GPL-2 )"
+
+KEYWORDS="~alpha ~amd64 ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-macos"
+SLOT="0"
+IUSE=""
+
+ruby_add_bdepend "test? ( || ( virtual/ruby-test-unit dev-ruby/test-unit:2 ) )"
+
+RUBY_PATCHES=( "${FILESDIR}/${PN}-language-fixes.patch" )
+
+all_ruby_install() {
+ all_fakegem_install
+
+ insinto /usr/share/doc/${PF}
+ doins -r samples || die
+}