Hello community,

here is the log from the commit of package rubygem-msgpack for openSUSE:Factory 
checked in at 2019-03-27 16:17:54
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-msgpack (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-msgpack.new.25356 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-msgpack"

Wed Mar 27 16:17:54 2019 rev:8 rq:685130 version:1.2.9

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-msgpack/rubygem-msgpack.changes  
2019-03-04 09:20:24.120600692 +0100
+++ 
/work/SRC/openSUSE:Factory/.rubygem-msgpack.new.25356/rubygem-msgpack.changes   
    2019-03-27 16:18:02.415571815 +0100
@@ -1,0 +2,25 @@
+Thu Mar 14 10:59:24 UTC 2019 - Stephan Kulow <[email protected]>
+
+- updated to version 1.2.9
+ see installed ChangeLog
+
+  2019-03-13 version 1.2.9:
+  
+  * Hotfix release only for JRuby: 1.2.8-java was built incorrectly
+  
+  2019-03-11 version 1.2.8:
+  
+  * Fix a regression that MessagePack#unpack raises error if IO is assigned as 
the (only) argument
+  * Improve compatibility that MessagePack#pack returns nil if IO is assigned 
as 2nd argument
+
+-------------------------------------------------------------------
+Sat Mar  2 15:26:59 UTC 2019 - Stephan Kulow <[email protected]>
+
+- updated to version 1.2.7
+ see installed ChangeLog
+
+  2019-03-01 version 1.2.7:
+  
+  * Add Packer#write_bin and Packer#write_bin_header methods
+
+-------------------------------------------------------------------

Old:
----
  msgpack-1.2.6.gem

New:
----
  msgpack-1.2.9.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-msgpack.spec ++++++
--- /var/tmp/diff_new_pack.flXTtM/_old  2019-03-27 16:18:03.131571666 +0100
+++ /var/tmp/diff_new_pack.flXTtM/_new  2019-03-27 16:18:03.131571666 +0100
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-msgpack
-Version:        1.2.6
+Version:        1.2.9
 Release:        0
 %define mod_name msgpack
 %define mod_full_name %{mod_name}-%{version}

++++++ msgpack-1.2.6.gem -> msgpack-1.2.9.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ChangeLog new/ChangeLog
--- old/ChangeLog       2019-01-08 08:53:55.000000000 +0100
+++ new/ChangeLog       2019-03-13 02:38:52.000000000 +0100
@@ -1,3 +1,16 @@
+2019-03-13 version 1.2.9:
+
+* Hotfix release only for JRuby: 1.2.8-java was built incorrectly
+
+2019-03-11 version 1.2.8:
+
+* Fix a regression that MessagePack#unpack raises error if IO is assigned as 
the (only) argument
+* Improve compatibility that MessagePack#pack returns nil if IO is assigned as 
2nd argument
+
+2019-03-01 version 1.2.7:
+
+* Add Packer#write_bin and Packer#write_bin_header methods
+
 2019-01-08 verison 1.2.6:
 
 * Update Ruby version 2.6 dependency (especially for Windows environment)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/README.rdoc new/README.rdoc
--- old/README.rdoc     2019-01-08 08:53:55.000000000 +0100
+++ new/README.rdoc     2019-03-13 02:38:52.000000000 +0100
@@ -176,6 +176,14 @@
 
     bundle exec rake doc
 
+== How to build -java rubygems
+
+To build -java gems for JRuby, run:
+
+    rake build:java
+
+If this directory has Gemfile.lock (generated with MRI), remove it beforehand.
+
 == How to build -mingw32 rubygems
 
 MessagePack mingw32/64 rubygems build process uses 
{rake-compiler-dock}[https://github.com/rake-compiler/rake-compiler-dock]. Run:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Rakefile new/Rakefile
--- old/Rakefile        2019-01-08 08:53:55.000000000 +0100
+++ new/Rakefile        2019-03-13 02:38:52.000000000 +0100
@@ -62,6 +62,9 @@
 end
 
 namespace :build do
+  desc 'Build gem for JRuby after cleaning'
+  task :java => [:clean, :spec, :build]
+
   desc 'Build gems for Windows per rake-compiler-dock'
   task :windows do
     require 'rake_compiler_dock'
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/doclib/msgpack/packer.rb new/doclib/msgpack/packer.rb
--- old/doclib/msgpack/packer.rb        2019-01-08 08:53:55.000000000 +0100
+++ new/doclib/msgpack/packer.rb        2019-03-13 02:38:52.000000000 +0100
@@ -92,6 +92,12 @@
     end
 
     #
+    # Serializes a string object as binary data. Same as 
write("string".encode(Encoding::BINARY)).
+    #
+    def write_bin(obj)
+    end
+
+    #
     # Write a header of an array whose size is _n_.
     # For example, write_array_header(1).write(true) is same as write([ true 
]).
     #
@@ -110,6 +116,20 @@
     end
 
     #
+    # Write a header of a binary string whose size is _n_. Useful if you want 
to append large binary data without loading it into memory at once.
+    # For example,
+    # MessagePack::Packer.new(io).write_bin_header(12).flush
+    # io.write('chunk1')
+    # io.write('chunk2')
+    # is the same as
+    # write('chunk1chunk2'.encode(Encoding::BINARY)).
+    #
+    # @return [Packer] self
+    #
+    def write_bin_header(n)
+    end
+
+    #
     # Serializes _value_ as 32-bit single precision float into internal buffer.
     # _value_ will be approximated with the nearest possible single precision 
float, thus
     # being potentially lossy. However, the serialized string will only take 
up 5 bytes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/doclib/msgpack.rb new/doclib/msgpack.rb
--- old/doclib/msgpack.rb       2019-01-08 08:53:55.000000000 +0100
+++ new/doclib/msgpack.rb       2019-03-13 02:38:52.000000000 +0100
@@ -12,7 +12,7 @@
   #   @param obj [Object] object to be serialized
   #   @param io [IO]
   #   @param options [Hash]
-  #   @return [IO]
+  #   @return [nil]
   #
   # See Packer#initialize for supported options.
   #
@@ -31,7 +31,7 @@
   #   @param obj [Object] object to be serialized
   #   @param io [IO]
   #   @param options [Hash]
-  #   @return [IO]
+  #   @return [nil]
   #
   # See Packer#initialize for supported options.
   #
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ext/java/org/msgpack/jruby/Buffer.java 
new/ext/java/org/msgpack/jruby/Buffer.java
--- old/ext/java/org/msgpack/jruby/Buffer.java  2019-01-08 08:53:55.000000000 
+0100
+++ new/ext/java/org/msgpack/jruby/Buffer.java  2019-03-13 02:38:52.000000000 
+0100
@@ -179,6 +179,10 @@
     return skipCommon(ctx, length, true);
   }
 
+  public boolean hasIo() {
+    return io != null;
+  }
+
   @JRubyMethod(name = "to_s", alias = {"to_str"})
   public IRubyObject toS(ThreadContext ctx) {
     ensureReadMode();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ext/java/org/msgpack/jruby/Encoder.java 
new/ext/java/org/msgpack/jruby/Encoder.java
--- old/ext/java/org/msgpack/jruby/Encoder.java 2019-01-08 08:53:55.000000000 
+0100
+++ new/ext/java/org/msgpack/jruby/Encoder.java 2019-03-13 02:38:52.000000000 
+0100
@@ -91,6 +91,11 @@
     return readRubyString();
   }
 
+  public IRubyObject encodeBinHeader(int size) {
+    appendStringHeader(size, true);
+    return readRubyString();
+  }
+
   public IRubyObject encodeFloat32(RubyNumeric numeric) {
     appendFloat32(numeric);
     return readRubyString();
@@ -221,14 +226,7 @@
     buffer.putFloat(value);
   }
 
-  private void appendString(RubyString object) {
-    Encoding encoding = object.getEncoding();
-    boolean binary = !compatibilityMode && encoding == binaryEncoding;
-    if (encoding != utf8Encoding && encoding != binaryEncoding) {
-      object = (RubyString) ((RubyString) 
object).encode(runtime.getCurrentContext(), 
runtime.getEncodingService().getEncoding(utf8Encoding));
-    }
-    ByteList bytes = object.getByteList();
-    int length = bytes.length();
+  private void appendStringHeader(int length, boolean binary) {
     if (length < 32 && !binary) {
       ensureRemainingCapacity(1 + length);
       buffer.put((byte) (length | FIXSTR));
@@ -245,6 +243,17 @@
       buffer.put(binary ? BIN32 : STR32);
       buffer.putInt((int) length);
     }
+  }
+
+  private void appendString(RubyString object) {
+    Encoding encoding = object.getEncoding();
+    boolean binary = !compatibilityMode && encoding == binaryEncoding;
+    if (encoding != utf8Encoding && encoding != binaryEncoding) {
+      object = (RubyString) ((RubyString) 
object).encode(runtime.getCurrentContext(), 
runtime.getEncodingService().getEncoding(utf8Encoding));
+    }
+    ByteList bytes = object.getByteList();
+    int length = bytes.length();
+    appendStringHeader(length, binary);
     buffer.put(bytes.unsafeBytes(), bytes.begin(), length);
   }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ext/java/org/msgpack/jruby/Factory.java 
new/ext/java/org/msgpack/jruby/Factory.java
--- old/ext/java/org/msgpack/jruby/Factory.java 2019-01-08 08:53:56.000000000 
+0100
+++ new/ext/java/org/msgpack/jruby/Factory.java 2019-03-13 02:38:52.000000000 
+0100
@@ -54,7 +54,7 @@
     return Packer.newPacker(ctx, extensionRegistry(), hasSymbolExtType, args);
   }
 
-  @JRubyMethod(name = "unpacker", optional = 1)
+  @JRubyMethod(name = "unpacker", optional = 2)
   public Unpacker unpacker(ThreadContext ctx, IRubyObject[] args) {
     return Unpacker.newUnpacker(ctx, extensionRegistry(), args);
   }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ext/java/org/msgpack/jruby/Packer.java 
new/ext/java/org/msgpack/jruby/Packer.java
--- old/ext/java/org/msgpack/jruby/Packer.java  2019-01-08 08:53:56.000000000 
+0100
+++ new/ext/java/org/msgpack/jruby/Packer.java  2019-03-13 02:38:52.000000000 
+0100
@@ -21,6 +21,8 @@
 import org.jruby.util.TypeConverter;
 import org.msgpack.jruby.ExtensionValue;
 
+import org.jcodings.Encoding;
+
 import static org.jruby.runtime.Visibility.PRIVATE;
 
 @JRubyClass(name="MessagePack::Packer")
@@ -29,6 +31,7 @@
   private Buffer buffer;
   private Encoder encoder;
   private boolean hasSymbolExtType;
+  private Encoding binaryEncoding;
 
   public Packer(Ruby runtime, RubyClass type, ExtensionRegistry registry, 
boolean hasSymbolExtType) {
     super(runtime, type);
@@ -58,6 +61,7 @@
     this.encoder = new Encoder(ctx.getRuntime(), compatibilityMode, registry, 
hasSymbolExtType);
     this.buffer = new Buffer(ctx.getRuntime(), 
ctx.getRuntime().getModule("MessagePack").getClass("Buffer"));
     this.buffer.initialize(ctx, args);
+    this.binaryEncoding = 
ctx.getRuntime().getEncodingService().getAscii8bitEncoding();
     return this;
   }
 
@@ -141,6 +145,13 @@
     return write(ctx, obj);
   }
 
+  @JRubyMethod(name = "write_bin")
+  public IRubyObject writeBin(ThreadContext ctx, IRubyObject obj) {
+    checkType(ctx, obj, org.jruby.RubyString.class);
+    obj = ((org.jruby.RubyString) obj).encode(ctx, 
ctx.runtime.getEncodingService().getEncoding(binaryEncoding));
+    return write(ctx, obj);
+  }
+
   @JRubyMethod(name = "write_hash")
   public IRubyObject writeHash(ThreadContext ctx, IRubyObject obj) {
     checkType(ctx, obj, org.jruby.RubyHash.class);
@@ -209,8 +220,18 @@
     return this;
   }
 
+  @JRubyMethod(name = "write_bin_header")
+  public IRubyObject writeBinHeader(ThreadContext ctx, IRubyObject size) {
+    int s = (int) size.convertToInteger().getLongValue();
+    buffer.write(ctx, encoder.encodeBinHeader(s));
+    return this;
+  }
+
   @JRubyMethod(name = "full_pack")
   public IRubyObject fullPack(ThreadContext ctx) {
+    if (buffer.hasIo()) {
+      return null;
+    }
     return toS(ctx);
   }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ext/msgpack/packer_class.c 
new/ext/msgpack/packer_class.c
--- old/ext/msgpack/packer_class.c      2019-01-08 08:53:56.000000000 +0100
+++ new/ext/msgpack/packer_class.c      2019-03-13 02:38:52.000000000 +0100
@@ -165,6 +165,18 @@
     return self;
 }
 
+static VALUE Packer_write_bin(VALUE self, VALUE obj)
+{
+    PACKER(self, pk);
+    Check_Type(obj, T_STRING);
+
+    VALUE enc = rb_enc_from_encoding(rb_ascii8bit_encoding());
+    obj = rb_str_encode(obj, enc, 0, Qnil);
+
+    msgpack_packer_write_string_value(pk, obj);
+    return self;
+}
+
 static VALUE Packer_write_array(VALUE self, VALUE obj)
 {
     PACKER(self, pk);
@@ -232,6 +244,13 @@
     return self;
 }
 
+static VALUE Packer_write_bin_header(VALUE self, VALUE n)
+{
+    PACKER(self, pk);
+    msgpack_packer_write_bin_header(pk, NUM2UINT(n));
+    return self;
+}
+
 static VALUE Packer_write_float32(VALUE self, VALUE numeric)
 {
     if(!rb_obj_is_kind_of(numeric, rb_cNumeric)) {
@@ -416,6 +435,7 @@
     rb_define_method(cMessagePack_Packer, "write_false", Packer_write_false, 
0);
     rb_define_method(cMessagePack_Packer, "write_float", Packer_write_float, 
1);
     rb_define_method(cMessagePack_Packer, "write_string", Packer_write_string, 
1);
+    rb_define_method(cMessagePack_Packer, "write_bin", Packer_write_bin, 1);
     rb_define_method(cMessagePack_Packer, "write_array", Packer_write_array, 
1);
     rb_define_method(cMessagePack_Packer, "write_hash", Packer_write_hash, 1);
     rb_define_method(cMessagePack_Packer, "write_symbol", Packer_write_symbol, 
1);
@@ -423,6 +443,7 @@
     rb_define_method(cMessagePack_Packer, "write_extension", 
Packer_write_extension, 1);
     rb_define_method(cMessagePack_Packer, "write_array_header", 
Packer_write_array_header, 1);
     rb_define_method(cMessagePack_Packer, "write_map_header", 
Packer_write_map_header, 1);
+    rb_define_method(cMessagePack_Packer, "write_bin_header", 
Packer_write_bin_header, 1);
     rb_define_method(cMessagePack_Packer, "write_ext", Packer_write_ext, 2);
     rb_define_method(cMessagePack_Packer, "write_float32", 
Packer_write_float32, 1);
     rb_define_method(cMessagePack_Packer, "flush", Packer_flush, 0);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/msgpack/version.rb new/lib/msgpack/version.rb
--- old/lib/msgpack/version.rb  2019-01-08 08:53:56.000000000 +0100
+++ new/lib/msgpack/version.rb  2019-03-13 02:38:52.000000000 +0100
@@ -1,5 +1,5 @@
 module MessagePack
-  VERSION = "1.2.6"
+  VERSION = "1.2.9"
 
   # NOTE for msgpack-ruby maintainer:
   # Check these things to release new binaryes for new Ruby versions 
(especially for Windows):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/msgpack.rb new/lib/msgpack.rb
--- old/lib/msgpack.rb  2019-01-08 08:53:56.000000000 +0100
+++ new/lib/msgpack.rb  2019-03-13 02:38:52.000000000 +0100
@@ -20,15 +20,16 @@
 
 module MessagePack
   DefaultFactory = MessagePack::Factory.new
+  DEFAULT_EMPTY_PARAMS = {}.freeze
 
   def load(src, param = nil)
     unpacker = nil
 
     if src.is_a? String
-      unpacker = DefaultFactory.unpacker param
+      unpacker = DefaultFactory.unpacker param || DEFAULT_EMPTY_PARAMS
       unpacker.feed src
     else
-      unpacker = DefaultFactory.unpacker src, param
+      unpacker = DefaultFactory.unpacker src, param || DEFAULT_EMPTY_PARAMS
     end
 
     unpacker.full_unpack
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2019-01-08 08:53:55.000000000 +0100
+++ new/metadata        2019-03-13 02:38:52.000000000 +0100
@@ -1,7 +1,7 @@
 --- !ruby/object:Gem::Specification
 name: msgpack
 version: !ruby/object:Gem::Version
-  version: 1.2.6
+  version: 1.2.9
 platform: ruby
 authors:
 - Sadayuki Furuhashi
@@ -10,7 +10,7 @@
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2019-01-08 00:00:00.000000000 Z
+date: 2019-03-13 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: bundler
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/cruby/buffer_spec.rb 
new/spec/cruby/buffer_spec.rb
--- old/spec/cruby/buffer_spec.rb       2019-01-08 08:53:56.000000000 +0100
+++ new/spec/cruby/buffer_spec.rb       2019-03-13 02:38:52.000000000 +0100
@@ -1,6 +1,11 @@
 require 'spec_helper'
 require 'random_compat'
 
+require 'stringio'
+if defined?(Encoding)
+  Encoding.default_external = 'ASCII-8BIT'
+end
+
 describe Buffer do
   STATIC_EXAMPLES = {}
   STATIC_EXAMPLES[:empty01] = ''
@@ -45,7 +50,7 @@
         b.read(n)
         s.slice!(0, n)
       end
-      key = :"random#{"%02d"%i}"
+      key = :"random#{"%02d" % i}"
       cases[key] = b
       examples[key] = s
     end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/msgpack_spec.rb new/spec/msgpack_spec.rb
--- old/spec/msgpack_spec.rb    2019-01-08 08:53:56.000000000 +0100
+++ new/spec/msgpack_spec.rb    2019-03-13 02:38:52.000000000 +0100
@@ -168,4 +168,47 @@
       end
     end
   end
+
+  context 'when the source is na IO-like object' do
+    require 'tempfile'
+    require 'stringio'
+
+    it 'work with IO destination object as 2nd argument of MessagePack.pack' do
+      Tempfile.create("pack-test") do |io|
+        return_value = MessagePack.pack(utf8enc('hello world'), io)
+        return_value.should be_nil
+
+        io.rewind
+        io.read.force_encoding(Encoding::ASCII_8BIT).should eq("\xABhello 
world".force_encoding(Encoding::ASCII_8BIT))
+      end
+    end
+
+    it 'work with IO-like StringIO destination object as 2nd argument of 
MessagePack.pack' do
+      io = StringIO.new
+      return_value = MessagePack.pack(utf8enc('hello world'), io)
+      return_value.should be_nil
+
+      io.rewind
+      io.read.force_encoding(Encoding::ASCII_8BIT).should eq("\xABhello 
world".force_encoding(Encoding::ASCII_8BIT))
+    end
+
+    it 'work with IO source object as source of MessagePack.unpack' do
+      Tempfile.create("unpack-test") do |io|
+        MessagePack.pack(utf8enc('hello world'), io)
+        io.rewind
+
+        return_value = MessagePack.unpack(io)
+        return_value.should eq(utf8enc('hello world'))
+      end
+    end
+
+    it 'work with IO-like StringIO object of MessagePack.unpack' do
+      io = StringIO.new
+      MessagePack.pack(utf8enc('hello world'), io)
+      io.rewind
+
+      return_value = MessagePack.unpack(io)
+      return_value.should eq(utf8enc('hello world'))
+    end
+  end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/packer_spec.rb new/spec/packer_spec.rb
--- old/spec/packer_spec.rb     2019-01-08 08:53:56.000000000 +0100
+++ new/spec/packer_spec.rb     2019-03-13 02:38:52.000000000 +0100
@@ -134,6 +134,41 @@
     packer.to_s.should == "\x81"
   end
 
+  it 'write_bin_header 0' do
+    packer.write_bin_header(0)
+    packer.to_s.should == "\xC4\x00"
+  end
+
+  it 'write_bin_header 255' do
+    packer.write_bin_header(255)
+    packer.to_s.should == "\xC4\xFF"
+  end
+
+  it 'write_bin_header 256' do
+    packer.write_bin_header(256)
+    packer.to_s.should == "\xC5\x01\x00"
+  end
+
+  it 'write_bin_header 65535' do
+    packer.write_bin_header(65535)
+    packer.to_s.should == "\xC5\xFF\xFF"
+  end
+
+  it 'write_bin_header 65536' do
+    packer.write_bin_header(65536)
+    packer.to_s.should == "\xC6\x00\x01\x00\x00"
+  end
+
+  it 'write_bin_header 999999' do
+    packer.write_bin_header(999999)
+    packer.to_s.should == "\xC6\x00\x0F\x42\x3F"
+  end
+
+  it 'write_bin' do
+    packer.write_bin("hello")
+    packer.to_s.should == "\xC4\x05hello"
+  end
+
   describe '#write_float32' do
     tests = [
       ['small floats', 3.14, "\xCA\x40\x48\xF5\xC3"],
@@ -193,6 +228,7 @@
     packer = MessagePack::Packer.new
     expect { packer.write_float "hello" }.to raise_error(TypeError)
     expect { packer.write_string 1 }.to raise_error(TypeError)
+    expect { packer.write_bin 1 }.to raise_error(TypeError)
     expect { packer.write_array "hello" }.to raise_error(TypeError)
     expect { packer.write_hash "hello" }.to raise_error(TypeError)
     expect { packer.write_symbol "hello" }.to raise_error(TypeError)


Reply via email to