[DRE-commits] [ruby-oj] 01/01: Port to Ruby 2.3

Antonio Terceiro terceiro at moszumanska.debian.org
Wed Feb 24 14:06:29 UTC 2016


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

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

commit a208a99ba00b5bc14ccd4cded43b5b978aa93baa
Author: Antonio Terceiro <terceiro at debian.org>
Date:   Wed Feb 24 11:01:44 2016 -0300

    Port to Ruby 2.3
---
 debian/changelog                                 |   8 ++
 debian/patches/0001-Updated-for-Ruby-2.3.0.patch | 107 +++++++++++++++++++++++
 debian/patches/series                            |   1 +
 3 files changed, 116 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 88344b1..3a6daf4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+ruby-oj (2.12.10-4) unstable; urgency=medium
+
+  * Team upload.
+  * Add Ruby 2.3 patch from upstream (0001-Updated-for-Ruby-2.3.0.patch)
+    (Closes: #815771)
+
+ -- Antonio Terceiro <terceiro at debian.org>  Wed, 24 Feb 2016 11:00:03 -0300
+
 ruby-oj (2.12.10-3) unstable; urgency=medium
 
   * Team upload.
diff --git a/debian/patches/0001-Updated-for-Ruby-2.3.0.patch b/debian/patches/0001-Updated-for-Ruby-2.3.0.patch
new file mode 100644
index 0000000..1d623ea
--- /dev/null
+++ b/debian/patches/0001-Updated-for-Ruby-2.3.0.patch
@@ -0,0 +1,107 @@
+From 03592a272976a7a6ffa4248cdfebddde59213bb7 Mon Sep 17 00:00:00 2001
+From: Peter Ohler <peter at ohler.com>
+Date: Thu, 31 Dec 2015 11:38:12 -0800
+Subject: [PATCH] Updated for Ruby 2.3.0.
+
+---
+ ext/oj/extconf.rb |  1 +
+ ext/oj/fast.c     |  4 ++++
+ ext/oj/reader.c   |  5 +++--
+ test/test_scp.rb  | 20 +++++++++++++++++---
+ 6 files changed, 28 insertions(+), 6 deletions(-)
+
+--- a/ext/oj/extconf.rb
++++ b/ext/oj/extconf.rb
+@@ -34,6 +34,7 @@ dflags = {
+   'USE_RB_MUTEX' => (is_windows && !('1' == version[0] && '8' == version[1])) ? 1 : 0,
+   'DATETIME_1_8' => ('ruby' == type && ('1' == version[0] && '8' == version[1])) ? 1 : 0,
+   'NO_TIME_ROUND_PAD' => ('rubinius' == type) ? 1 : 0,
++  'HAS_DATA_OBJECT_WRAP' => ('ruby' == type && '2' == version[0] && '3' <= version[1]) ? 1 : 0,
+ }
+ # This is a monster hack to get around issues with 1.9.3-p0 on CentOS 5.4. SO
+ # some reason math.h and string.h contents are not processed. Might be a
+--- a/ext/oj/fast.c
++++ b/ext/oj/fast.c
+@@ -813,7 +813,11 @@ parse_json(VALUE clas, char *json, int g
+     }
+ #endif
+     // last arg is free func void* func(void*)
++#if HAS_DATA_OBJECT_WRAP
++    doc->self = rb_data_object_wrap(clas, doc, 0, free_doc_cb);
++#else
+     doc->self = rb_data_object_alloc(clas, doc, 0, free_doc_cb);
++#endif
+     rb_gc_register_address(&doc->self);
+     doc->json = json;
+     DATA_PTR(doc->self) = doc;
+--- a/ext/oj/reader.c
++++ b/ext/oj/reader.c
+@@ -109,7 +109,7 @@ int
+ oj_reader_read(Reader reader) {
+     int		err;
+     size_t	shift = 0;
+-    
++
+     if (0 == reader->read_func) {
+ 	return -1;
+     }
+@@ -165,7 +165,7 @@ rescue_cb(VALUE rbuf, VALUE err) {
+     if (rb_eTypeError != clas && rb_eEOFError != clas) {
+ 	Reader	reader = (Reader)rbuf;
+ 
+-	rb_raise(err, "at line %d, column %d\n", reader->line, reader->col);
++	rb_raise(clas, "at line %d, column %d\n", reader->line, reader->col);
+     }
+     return Qfalse;
+ }
+@@ -185,6 +185,7 @@ partial_io_cb(VALUE rbuf) {
+     }
+     str = StringValuePtr(rstr);
+     cnt = RSTRING_LEN(rstr);
++    //printf("*** partial read %lu bytes, str: '%s'\n", cnt, str);
+     strcpy(reader->tail, str);
+     reader->read_end = reader->tail + cnt;
+ 
+--- a/test/test_scp.rb
++++ b/test/test_scp.rb
+@@ -73,6 +73,7 @@ class AllHandler < Oj::ScHandler
+ end # AllHandler
+ 
+ class Closer < AllHandler
++  attr_accessor :io
+   def initialize(io)
+     super()
+     @io = io
+@@ -341,7 +342,13 @@ class ScpTest < Minitest::Test
+                       [:hash_set, 'one', true]], handler.calls)
+       else
+         read_io.close
+-        write_io.write json
++        write_io.write json[0..11]
++        sleep(0.1)
++        begin
++          write_io.write json[12..-1]
++        rescue Exception => e
++          # ignore, should fail to write
++        end
+         write_io.close
+         Process.exit(0)
+       end
+@@ -358,8 +365,15 @@ class ScpTest < Minitest::Test
+     end
+     Thread.start(json) do |j|
+       c = server.accept()
+-      c.puts json
+-      c.close
++      c.puts json[0..11]
++      10.times {
++        break if c.closed?
++        sleep(0.1)
++      }
++      unless c.closed?
++        c.puts json[12..-1]
++        c.close
++      end
+     end
+     begin
+       sock = TCPSocket.new('localhost', 8080)
diff --git a/debian/patches/series b/debian/patches/series
index 50c2cb6..cb4b9e9 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 01_dont_mess_with_loadpath.patch
 02_avoid_name_conflict_with_ext.patch
 03_find_test_helper.patch
+0001-Updated-for-Ruby-2.3.0.patch

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



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