[DRE-commits] [SCM] ruby-builder.git branch, master, updated. upstream/3.0.0-18-g9d3de3f
=?UTF-8?Q?Marc=20Dequ=C3=A8nes=20?=(Duck)
Duck at DuckCorp.org
Wed Jan 25 19:52:01 UTC 2012
The following commit has been merged in the master branch:
commit 7c57131d5100b09dc86b56ff296fccc82d6f1ca8
Author: Marc Dequènes (Duck) <Duck at DuckCorp.org>
Date: Wed Jan 25 19:49:49 2012 +0100
[fix] added patches from Flameeyes in #646657
diff --git a/debian/changelog b/debian/changelog
index 0542dfb..0329c55 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,9 +1,17 @@
ruby-builder (3.0.0-2) unstable; urgency=low
+ [ Cédric Boutillier ]
* Build-depends and depends on ruby-blankslate (and removed embedded
copy).
- -- Cédric Boutillier <cedric.boutillier at gmail.com> Sat, 21 Jan 2012 16:44:24 +0100
+ [ Marc Dequènes (Duck) ]
+ * Added patches from Diego Elio Pettenò <flameeyes at flameeyes.eu>:
+ - ruby-builder_dummy_encodings_973b558: fix problems with dummy encoding
+ (Closes: #646657)
+ - ruby-builder_fast_xs_rails_workaround_a24436e: workaround fast_xs
+ limitations (no encoding parameter for to_xs method)
+
+ -- Marc Dequènes (Duck) <Duck at DuckCorp.org> Wed, 25 Jan 2012 19:42:25 +0100
ruby-builder (3.0.0-1) unstable; urgency=low
diff --git a/debian/patches/ruby-builder_dummy_encodings_973b558 b/debian/patches/ruby-builder_dummy_encodings_973b558
new file mode 100644
index 0000000..338764b
--- /dev/null
+++ b/debian/patches/ruby-builder_dummy_encodings_973b558
@@ -0,0 +1,51 @@
+commit 973b558e48a5af79a7239ff53f0ef2d913d8e64f
+Author: Diego Elio Pettenò <flameeyes at flameeyes.eu>
+Date: Wed Jan 25 03:04:23 2012 +0100
+
+ Fix tests with Ruby 1.9.3, where UTF-16 is a supported encoding.
+
+ While the UTF-16 encoding is supported, it's a dummy encoding, so regexp
+ matching is not properly implemented, so there is not much we can do but
+ reject dummy encodings altogether.
+
+diff --git a/lib/builder/xmlbase.rb b/lib/builder/xmlbase.rb
+index 1a1e5f9..0c9798f 100644
+--- a/lib/builder/xmlbase.rb
++++ b/lib/builder/xmlbase.rb
+@@ -122,7 +122,9 @@ module Builder
+ def _escape(text)
+ result = XChar.encode(text)
+ begin
+- result.encode(@encoding)
++ encoding = ::Encoding::find(@encoding)
++ raise Exception if encoding.dummy?
++ result.encode(encoding)
+ rescue
+ # if the encoding can't be supported, use numeric character references
+ result.
+diff --git a/test/test_markupbuilder.rb b/test/test_markupbuilder.rb
+index 63864ad..2d9b853 100644
+--- a/test/test_markupbuilder.rb
++++ b/test/test_markupbuilder.rb
+@@ -446,13 +446,20 @@ class TestIndentedXmlMarkup < Test::Unit::TestCase
+ end
+ end
+
+- def test_use_entities_if_kcode_is_utf_but_encoding_is_something_else
++ def test_use_entities_if_kcode_is_utf_but_encoding_is_dummy_encoding
+ xml = Builder::XmlMarkup.new
+ xml.instruct!(:xml, :encoding => 'UTF-16')
+ xml.p(encode("\xE2\x80\x99", 'UTF8'))
+ assert_match(%r(<p>’</p>), xml.target!) #
+ end
+
++ def test_use_entities_if_kcode_is_utf_but_encoding_is_unsupported_encoding
++ xml = Builder::XmlMarkup.new
++ xml.instruct!(:xml, :encoding => 'UCS-2')
++ xml.p(encode("\xE2\x80\x99", 'UTF8'))
++ assert_match(%r(<p>’</p>), xml.target!) #
++ end
++
+ def test_use_utf8_if_encoding_defaults_and_kcode_is_utf8
+ xml = Builder::XmlMarkup.new
+ xml.p(encode("\xE2\x80\x99",'UTF8'))
diff --git a/debian/patches/ruby-builder_fast_xs_rails_workaround_a24436e b/debian/patches/ruby-builder_fast_xs_rails_workaround_a24436e
new file mode 100644
index 0000000..b761c9c
--- /dev/null
+++ b/debian/patches/ruby-builder_fast_xs_rails_workaround_a24436e
@@ -0,0 +1,28 @@
+commit a24436e68baff6cccda8f4f259375f14d2bd0f4c (HEAD, refs/remotes/origin/master, refs/remotes/origin/HEAD, refs/heads/master)
+Author: Diego Elio Pettenò <flameeyes at flameeyes.eu>
+Date: Wed Jan 25 03:07:26 2012 +0100
+
+ Fix _escape when activesupport and fast_xs/hpricot are loaded.
+
+ The to_xs method implemented by fast_xs (which is also used by hpricot)
+ does not accept an encoding parameter, so rely on the original_xs in that
+ context.
+
+diff --git a/lib/builder/xmlbase.rb b/lib/builder/xmlbase.rb
+index 0c9798f..06f8807 100644
+--- a/lib/builder/xmlbase.rb
++++ b/lib/builder/xmlbase.rb
+@@ -134,7 +134,12 @@ module Builder
+ end
+ else
+ def _escape(text)
+- text.to_xs((@encoding != 'utf-8' or $KCODE != 'UTF8'))
++ # original_xs is defined by activesupport when fast_xs is
++ # loaded; since fast_xs (as of version 0.8.0) does not accept
++ # the encode parameter, use the original function if present.
++ toxs_method = ::String.method_defined?(:original_xs) ? :original_xs : :to_xs
++
++ text.send(toxs_method, (@encoding != 'utf-8' or $KCODE != 'UTF8'))
+ end
+ end
+
diff --git a/debian/patches/series b/debian/patches/series
index e3aaa49..b879d52 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,3 @@
test_blankslate_fix_ruby_1.9
+ruby-builder_dummy_encodings_973b558
+ruby-builder_fast_xs_rails_workaround_a24436e
--
ruby-builder.git
More information about the Pkg-ruby-extras-commits
mailing list