Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package rubygem-ruby-dbus for 
openSUSE:Factory checked in at 2023-04-09 18:39:01
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-ruby-dbus (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-ruby-dbus.new.19717 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-ruby-dbus"

Sun Apr  9 18:39:01 2023 rev:34 rq:1077973 version:0.21.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-ruby-dbus/rubygem-ruby-dbus.changes      
2023-03-24 15:16:07.661531707 +0100
+++ 
/work/SRC/openSUSE:Factory/.rubygem-ruby-dbus.new.19717/rubygem-ruby-dbus.changes
   2023-04-09 18:39:02.609081578 +0200
@@ -1,0 +2,12 @@
+Sat Apr  8 07:36:20 UTC 2023 - Martin Vidner <[email protected]>
+
+- 0.21.0
+ Features:
+ * Respect env RUBY_DBUS_ENDIANNESS=B (or =l) for outgoing messages.
+
+ Bug fixes:
+ * Reduce socket buffer allocations (gh#mvidner/ruby-dbus#129).
+ * Message#marshall speedup: don't marshall the body twice.
+
+
+-------------------------------------------------------------------

Old:
----
  ruby-dbus-0.20.0.gem

New:
----
  ruby-dbus-0.21.0.gem

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

Other differences:
------------------
++++++ rubygem-ruby-dbus.spec ++++++
--- /var/tmp/diff_new_pack.DrWI28/_old  2023-04-09 18:39:03.485086534 +0200
+++ /var/tmp/diff_new_pack.DrWI28/_new  2023-04-09 18:39:03.493086579 +0200
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-ruby-dbus
-Version:        0.20.0
+Version:        0.21.0
 Release:        0
 %define mod_name ruby-dbus
 %define mod_full_name %{mod_name}-%{version}

++++++ ruby-dbus-0.20.0.gem -> ruby-dbus-0.21.0.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/NEWS.md new/NEWS.md
--- old/NEWS.md 2023-03-21 16:51:02.000000000 +0100
+++ new/NEWS.md 2023-04-08 09:43:08.000000000 +0200
@@ -2,6 +2,17 @@
 
 ## Unreleased
 
+## Ruby D-Bus 0.21.0 - 2023-04-08
+
+Features:
+ * Respect env RUBY_DBUS_ENDIANNESS=B (or =l) for outgoing messages.
+
+Bug fixes:
+ * Reduce socket buffer allocations ([#129][]).
+ * Message#marshall speedup: don't marshall the body twice.
+
+[#129]: https://github.com/mvidner/ruby-dbus/pull/129
+
 ## Ruby D-Bus 0.20.0 - 2023-03-21
 
 Features:
@@ -82,7 +93,7 @@
    when declaring properties ([#117][]).
 
 [#115]: https://github.com/mvidner/ruby-dbus/issues/115
-[#117]: https://github.com/mvidner/ruby-dbus/pulls/117
+[#117]: https://github.com/mvidner/ruby-dbus/pull/117
 
 ## Ruby D-Bus 0.18.0.beta7 - 2022-05-29
 
@@ -450,7 +461,7 @@
  * Handle more ways which tell us that a bus connection has died.
 
 [#3]: https://github.com/mvidner/ruby-dbus/issue/3
-[bsc#617350]: https://bugzilla.novell.com/show_bug.cgi?id=617350
+[bsc#617350]: https://bugzilla.suse.com/show_bug.cgi?id=617350
 
 ## Ruby D-Bus 0.3.0 - 2010-03-28
 
@@ -518,8 +529,8 @@
  * Fixed an endless sleep in DBus::Main.run ([bsc#537401][]).
  * Added details to PacketMarshaller exceptions ([bsc#538050][]).
 
-[bsc#537401]: https://bugzilla.novell.com/show_bug.cgi?id=537401
-[bsc#538050]: https://bugzilla.novell.com/show_bug.cgi?id=538050
+[bsc#537401]: https://bugzilla.suse.com/show_bug.cgi?id=537401
+[bsc#538050]: https://bugzilla.suse.com/show_bug.cgi?id=538050
 
 ## Ruby D-Bus "I'm not dead" 0.2.9 - 2009-08-26
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/VERSION new/VERSION
--- old/VERSION 2023-03-21 16:51:02.000000000 +0100
+++ new/VERSION 2023-04-08 09:43:08.000000000 +0200
@@ -1 +1 @@
-0.20.0
+0.21.0
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/dbus/message.rb new/lib/dbus/message.rb
--- old/lib/dbus/message.rb     2023-03-21 16:51:02.000000000 +0100
+++ new/lib/dbus/message.rb     2023-04-08 09:43:08.000000000 +0200
@@ -10,6 +10,8 @@
 # License, version 2.1 as published by the Free Software Foundation.
 # See the file "COPYING" for the exact licensing terms.
 
+require_relative "raw_message"
+
 # = D-Bus main module
 #
 # Module containing all the D-Bus modules and classes.
@@ -144,6 +146,10 @@
       @params << [type, val]
     end
 
+    # "l" or "B"
+    ENDIANNESS_CHAR = ENV.fetch("RUBY_DBUS_ENDIANNESS", HOST_END)
+    ENDIANNESS = RawMessage.endianness(ENDIANNESS_CHAR)
+
     # FIXME: what are these? a message element constant enumeration?
     # See method below, in a message, you have and array of optional parameters
     # that come with an index, to determine their meaning. The values are in
@@ -165,14 +171,14 @@
         raise InvalidDestinationName
       end
 
-      params = PacketMarshaller.new
-      @params.each do |param|
-        params.append(param[0], param[1])
+      params_marshaller = PacketMarshaller.new(endianness: ENDIANNESS)
+      @params.each do |type, value|
+        params_marshaller.append(type, value)
       end
-      @body_length = params.packet.bytesize
+      @body_length = params_marshaller.packet.bytesize
 
-      marshaller = PacketMarshaller.new
-      marshaller.append(Type::BYTE, HOST_END.ord)
+      marshaller = PacketMarshaller.new(endianness: ENDIANNESS)
+      marshaller.append(Type::BYTE, ENDIANNESS_CHAR.ord)
       marshaller.append(Type::BYTE, @message_type)
       marshaller.append(Type::BYTE, @flags)
       marshaller.append(Type::BYTE, @protocol)
@@ -191,10 +197,8 @@
       marshaller.append("a(yv)", headers)
 
       marshaller.align(8)
-      @params.each do |param|
-        marshaller.append(param[0], param[1])
-      end
-      marshaller.packet
+
+      marshaller.packet + params_marshaller.packet
     end
 
     # Unmarshall a packet contained in the buffer _buf_ and set the
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/dbus/message_queue.rb 
new/lib/dbus/message_queue.rb
--- old/lib/dbus/message_queue.rb       2023-03-21 16:51:02.000000000 +0100
+++ new/lib/dbus/message_queue.rb       2023-04-08 09:43:08.000000000 +0200
@@ -18,10 +18,15 @@
     # The socket that is used to connect with the bus.
     attr_reader :socket
 
+    # The buffer size for messages.
+    MSG_BUF_SIZE = 4096
+
     def initialize(address)
       DBus.logger.debug "MessageQueue: #{address}"
       @address = address
       @buffer = ""
+      # Reduce allocations by using a single buffer for our socket
+      @read_buffer = String.new(capacity: MSG_BUF_SIZE)
       @is_tcp = false
       @mutex = Mutex.new
       connect
@@ -157,15 +162,12 @@
       ret
     end
 
-    # The buffer size for messages.
-    MSG_BUF_SIZE = 4096
-
     # Fill (append) the buffer from data that might be available on the
     # socket.
     # @return [void]
     # @raise EOFError
     def buffer_from_socket_nonblock
-      @buffer += @socket.read_nonblock(MSG_BUF_SIZE)
+      @buffer += @socket.read_nonblock(MSG_BUF_SIZE, @read_buffer)
     rescue EOFError
       raise # the caller expects it
     rescue Errno::EAGAIN
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/dbus.rb new/lib/dbus.rb
--- old/lib/dbus.rb     2023-03-21 16:51:02.000000000 +0100
+++ new/lib/dbus.rb     2023-04-08 09:43:08.000000000 +0200
@@ -10,6 +10,21 @@
 # License, version 2.1 as published by the Free Software Foundation.
 # See the file "COPYING" for the exact licensing terms.
 
+module DBus
+  # Byte signifying big endianness.
+  BIG_END = "B"
+  # Byte signifying little endianness.
+  LIL_END = "l"
+
+  # Byte signifying the host's endianness.
+  HOST_END = if [0x01020304].pack("L").unpack1("V") == 0x01020304
+               LIL_END
+             else
+               BIG_END
+             end
+end
+# ^ That's because dbus/message needs HOST_END early
+
 require_relative "dbus/api_options"
 require_relative "dbus/auth"
 require_relative "dbus/bus"
@@ -41,18 +56,6 @@
   # Default socket name for the system bus.
   SYSTEM_BUS_ADDRESS = "unix:path=/var/run/dbus/system_bus_socket"
 
-  # Byte signifying big endianness.
-  BIG_END = "B"
-  # Byte signifying little endianness.
-  LIL_END = "l"
-
-  # Byte signifying the host's endianness.
-  HOST_END = if [0x01020304].pack("L").unpack1("V") == 0x01020304
-               LIL_END
-             else
-               BIG_END
-             end
-
   # Comparing symbols is faster than strings
   # @return [:little,:big]
   HOST_ENDIANNESS = RawMessage.endianness(HOST_END)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2023-03-21 16:51:02.000000000 +0100
+++ new/metadata        2023-04-08 09:43:08.000000000 +0200
@@ -1,14 +1,14 @@
 --- !ruby/object:Gem::Specification
 name: ruby-dbus
 version: !ruby/object:Gem::Version
-  version: 0.20.0
+  version: 0.21.0
 platform: ruby
 authors:
 - Ruby DBus Team
-autorequire: 
+autorequire:
 bindir: bin
 cert_chain: []
-date: 2023-03-21 00:00:00.000000000 Z
+date: 2023-04-08 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: rexml
@@ -189,6 +189,7 @@
 - spec/property_spec.rb
 - spec/proxy_object_interface_spec.rb
 - spec/proxy_object_spec.rb
+- spec/raw_message_spec.rb
 - spec/server_robustness_spec.rb
 - spec/server_spec.rb
 - spec/service_newapi.rb
@@ -210,7 +211,7 @@
 licenses:
 - LGPL-2.1
 metadata: {}
-post_install_message: 
+post_install_message:
 rdoc_options: []
 require_paths:
 - lib
@@ -226,7 +227,7 @@
       version: '0'
 requirements: []
 rubygems_version: 3.3.0.dev
-signing_key: 
+signing_key:
 specification_version: 4
 summary: Ruby module for interaction with D-Bus
 test_files: []
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/raw_message_spec.rb new/spec/raw_message_spec.rb
--- old/spec/raw_message_spec.rb        1970-01-01 01:00:00.000000000 +0100
+++ new/spec/raw_message_spec.rb        2023-04-08 09:43:08.000000000 +0200
@@ -0,0 +1,32 @@
+#!/usr/bin/env rspec
+# frozen_string_literal: true
+
+require_relative "spec_helper"
+require "dbus"
+
+# Pedantic full coverage test.
+# The happy paths are covered via calling classes
+describe DBus::RawMessage do
+  describe ".endianness" do
+    it "returns :little for 'l'" do
+      expect(described_class.endianness("l")).to eq :little
+    end
+
+    it "returns :big for 'B'" do
+      expect(described_class.endianness("B")).to eq :big
+    end
+
+    it "raises for other strings" do
+      expect { described_class.endianness("m") }
+        .to raise_error(DBus::InvalidPacketException, /Incorrect endianness/)
+    end
+  end
+
+  describe "#align" do
+    it "raises for values other than 1 2 4 8" do
+      subject = described_class.new("l")
+      expect { subject.align(3) }.to raise_error(ArgumentError)
+      expect { subject.align(16) }.to raise_error(ArgumentError)
+    end
+  end
+end

Reply via email to