[DRE-commits] [ruby-soap4r] 03/03: Drop in-tree changes in favor of patch

Antonio Terceiro terceiro at moszumanska.debian.org
Mon Jan 6 21:07:41 UTC 2014


This is an automated email from the git hooks/post-receive script.

terceiro pushed a commit to branch master
in repository ruby-soap4r.

commit 7563b7cbef464242256be5e2a3fad673f6df82aa
Author: Antonio Terceiro <terceiro at debian.org>
Date:   Mon Jan 6 17:55:33 2014 -0300

    Drop in-tree changes in favor of patch
---
 debian/patches/drop-iconv-usage.patch | 62 +++++++++++++++++++++++++++++++++++
 debian/patches/series                 |  1 +
 lib/xsd/iconvcharset.rb               | 21 ++++++++++--
 test/xsd/test_iconvcharset.rb         | 20 -----------
 4 files changed, 82 insertions(+), 22 deletions(-)

diff --git a/debian/patches/drop-iconv-usage.patch b/debian/patches/drop-iconv-usage.patch
new file mode 100644
index 0000000..48efb06
--- /dev/null
+++ b/debian/patches/drop-iconv-usage.patch
@@ -0,0 +1,62 @@
+diff --git a/lib/xsd/iconvcharset.rb b/lib/xsd/iconvcharset.rb
+index 57733a8..7901098 100644
+--- a/lib/xsd/iconvcharset.rb
++++ b/lib/xsd/iconvcharset.rb
+@@ -5,29 +5,12 @@
+ # redistribute it and/or modify it under the same terms of Ruby's license;
+ # either the dual license version in 2003, or any later version.
+ 
+-
+-require 'iconv'
+-
+-
+ module XSD
+ 
+-
+ class IconvCharset
+   def self.safe_iconv(to, from, str)
+-    iconv = Iconv.new(to, from)
+-    out = ""
+-    begin
+-      out << iconv.iconv(str)
+-    rescue Iconv::IllegalSequence => e
+-      out << e.success
+-      ch, str = e.failed.split(//, 2)
+-      out << '?'
+-      warn("Failed to convert #{ch}")
+-      retry
+-    end
+-    return out
++    str.force_encoding(from).chars.map { |c| c.valid_encoding? && c || '?' }.join.encode(to)
+   end
+-end
+-
++end if RUBY_VERSION > '1.9'
+ 
+ end
+diff --git a/test/xsd/test_iconvcharset.rb b/test/xsd/test_iconvcharset.rb
+new file mode 100644
+index 0000000..452291c
+--- /dev/null
++++ b/test/xsd/test_iconvcharset.rb
+@@ -0,0 +1,20 @@
++# encoding: UTF-8
++
++require 'test/unit'
++require 'xsd/iconvcharset'
++
++class TestIconvCharset < Test::Unit::TestCase
++
++  def test_iso88591_utf8
++    assert_equal "á", XSD::IconvCharset.safe_iconv("utf-8", "iso-8859-1", "\xE1")
++  end
++
++  def test_utf8_iso88591
++    assert_equal "\xE1".force_encoding('iso-8859-1'), XSD::IconvCharset.safe_iconv("iso-8859-1", "utf-8", "á")
++  end
++
++  def test_invalid_encoding
++    assert_equal "á?á".encode('iso-8859-1'), XSD::IconvCharset.safe_iconv("iso-8859-1", "utf-8", "á\x8Dá".force_encoding('ascii-8bit'))
++  end
++
++end if RUBY_VERSION > '1.9'
diff --git a/debian/patches/series b/debian/patches/series
index c02b0e2..f646a34 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
+drop-iconv-usage.patch
 fix-failing-ruby2-tests
 dont-use-libxml-based-parser.patch
diff --git a/lib/xsd/iconvcharset.rb b/lib/xsd/iconvcharset.rb
index 7901098..57733a8 100644
--- a/lib/xsd/iconvcharset.rb
+++ b/lib/xsd/iconvcharset.rb
@@ -5,12 +5,29 @@
 # redistribute it and/or modify it under the same terms of Ruby's license;
 # either the dual license version in 2003, or any later version.
 
+
+require 'iconv'
+
+
 module XSD
 
+
 class IconvCharset
   def self.safe_iconv(to, from, str)
-    str.force_encoding(from).chars.map { |c| c.valid_encoding? && c || '?' }.join.encode(to)
+    iconv = Iconv.new(to, from)
+    out = ""
+    begin
+      out << iconv.iconv(str)
+    rescue Iconv::IllegalSequence => e
+      out << e.success
+      ch, str = e.failed.split(//, 2)
+      out << '?'
+      warn("Failed to convert #{ch}")
+      retry
+    end
+    return out
   end
-end if RUBY_VERSION > '1.9'
+end
+
 
 end
diff --git a/test/xsd/test_iconvcharset.rb b/test/xsd/test_iconvcharset.rb
deleted file mode 100644
index 452291c..0000000
--- a/test/xsd/test_iconvcharset.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# encoding: UTF-8
-
-require 'test/unit'
-require 'xsd/iconvcharset'
-
-class TestIconvCharset < Test::Unit::TestCase
-
-  def test_iso88591_utf8
-    assert_equal "á", XSD::IconvCharset.safe_iconv("utf-8", "iso-8859-1", "\xE1")
-  end
-
-  def test_utf8_iso88591
-    assert_equal "\xE1".force_encoding('iso-8859-1'), XSD::IconvCharset.safe_iconv("iso-8859-1", "utf-8", "á")
-  end
-
-  def test_invalid_encoding
-    assert_equal "á?á".encode('iso-8859-1'), XSD::IconvCharset.safe_iconv("iso-8859-1", "utf-8", "á\x8Dá".force_encoding('ascii-8bit'))
-  end
-
-end if RUBY_VERSION > '1.9'

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-soap4r.git



More information about the Pkg-ruby-extras-commits mailing list