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-05-18 15:18:16
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-ruby-dbus (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-ruby-dbus.new.1533 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-ruby-dbus"

Thu May 18 15:18:16 2023 rev:35 rq:1087530 version:0.22.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-ruby-dbus/rubygem-ruby-dbus.changes      
2023-04-09 18:39:02.609081578 +0200
+++ 
/work/SRC/openSUSE:Factory/.rubygem-ruby-dbus.new.1533/rubygem-ruby-dbus.changes
    2023-05-18 15:18:20.625554285 +0200
@@ -1,0 +2,22 @@
+Wed May 17 08:29:42 UTC 2023 - Martin Vidner <mvid...@suse.com>
+
+- 0.22.1
+ Bug fixes:
+ * Fix OBS building by disabling IPv6 tests, gh#mvidner/ruby-dbus#134.
+
+-------------------------------------------------------------------
+Mon May  8 19:06:21 UTC 2023 - Martin Vidner <mvid...@suse.com>
+
+- 0.22.0
+ Features:
+ * Enable using nokogiri without rexml (by Dominik Andreas Schorpp,
+   gh#mvidner/ruby-dbus#132)
+ Bug fixes:
+ * Respect DBUS_SYSTEM_BUS_ADDRESS environment variable.
+ Other:
+ * For NameRequestError, mention who is the other owner.
+ * Session bus autolaunch still does not work, but: don't try launchd except
+   on macOS, and improve the error message.
+ * examples/gdbus split off to its own repository
+
+-------------------------------------------------------------------

Old:
----
  ruby-dbus-0.21.0.gem

New:
----
  ruby-dbus-0.22.1.gem

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

Other differences:
------------------
++++++ rubygem-ruby-dbus.spec ++++++
--- /var/tmp/diff_new_pack.elx17a/_old  2023-05-18 15:18:21.857560550 +0200
+++ /var/tmp/diff_new_pack.elx17a/_new  2023-05-18 15:18:21.861560571 +0200
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-ruby-dbus
-Version:        0.21.0
+Version:        0.22.1
 Release:        0
 %define mod_name ruby-dbus
 %define mod_full_name %{mod_name}-%{version}

++++++ ruby-dbus-0.21.0.gem -> ruby-dbus-0.22.1.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/NEWS.md new/NEWS.md
--- old/NEWS.md 2023-04-08 09:43:08.000000000 +0200
+++ new/NEWS.md 2023-05-17 10:39:40.000000000 +0200
@@ -2,6 +2,30 @@
 
 ## Unreleased
 
+## Ruby D-Bus 0.22.1 - 2023-05-17
+
+Bug fixes:
+ * Fix OBS building by disabling IPv6 tests, [#134][].
+
+[#134]: https://github.com/mvidner/ruby-dbus/pull/134
+
+## Ruby D-Bus 0.22.0 - 2023-05-08
+
+Features:
+ * Enable using nokogiri without rexml (by Dominik Andreas Schorpp, [#132][])
+
+Bug fixes:
+ * Respect DBUS_SYSTEM_BUS_ADDRESS environment variable.
+
+Other:
+ * For NameRequestError, mention who is the other owner.
+ * Session bus autolaunch still does not work, but: don't try launchd except
+   on macOS, and improve the error message.
+ * examples/gdbus split off to its own repository,
+   https://github.com/mvidner/dbus-gui-gtk
+
+[#132]: https://github.com/mvidner/ruby-dbus/pull/132
+
 ## Ruby D-Bus 0.21.0 - 2023-04-08
 
 Features:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/VERSION new/VERSION
--- old/VERSION 2023-04-08 09:43:08.000000000 +0200
+++ new/VERSION 2023-05-17 10:39:40.000000000 +0200
@@ -1 +1 @@
-0.21.0
+0.22.1
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/examples/gdbus/gdbus new/examples/gdbus/gdbus
--- old/examples/gdbus/gdbus    2023-04-08 09:43:08.000000000 +0200
+++ new/examples/gdbus/gdbus    1970-01-01 01:00:00.000000000 +0100
@@ -1,264 +0,0 @@
-#!/usr/bin/env ruby
-# frozen_string_literal: true
-
-#
-# This is a quite complex example using internal lower level API.
-# Not a good starting point, but might be usefull if you want to do tricky
-# stuff.
-# -- Arnaud
-
-require "dbus"
-require "gtk2"
-
-ENABLE_SYSTEM = false
-
-class MethodCallWindow
-  def initialize(pwindow, intf, meth)
-    @intf = intf
-    @meth = meth
-    @entries = []
-    @dialog = Gtk::Dialog.new(meth.name, pwindow,
-                              Gtk::Dialog::MODAL | Gtk::Dialog::NO_SEPARATOR,
-                              [Gtk::Stock::OK, Gtk::Dialog::RESPONSE_OK],
-                              [Gtk::Stock::CANCEL, 
Gtk::Dialog::RESPONSE_CANCEL])
-
-    @meth.params.each do |param|
-      shbox = Gtk::HBox.new(true, 0)
-      label = Gtk::Label.new("#{param[0]} (#{param[1]})")
-      input = Gtk::Entry.new
-      @entries << input
-      shbox.pack_start(label, true, true, 0)
-      shbox.pack_start(input, true, true, 0)
-      @dialog.vbox.pack_start(shbox, true, true, 0)
-      @dialog.vbox.show_all
-    end
-  end
-
-  def run
-    on_ok if @dialog.run == Gtk::Dialog::RESPONSE_OK
-    @dialog.destroy
-  end
-
-  def on_ok
-    bus = @intf.object.bus
-    m = DBus::Message.new(DBus::Message::METHOD_CALL)
-    m.path = @intf.object.path
-    m.interface = @intf.name
-    m.destination = @intf.object.destination
-    m.member = @meth.name
-    m.sender = bus.unique_name
-    @meth.params.each_with_index do |param, idx|
-      entry = @entries[idx]
-      data = nil
-      case param[1]
-      when "u", "i"
-        data = entry.text.to_i
-      when "s"
-        data = entry.text
-      when /^a/
-        begin
-          data = eval(entry.text)
-        rescue
-          puts "Incorrect data: #{data}"
-        end
-      end
-      m.add_param(param[1], data)
-    end
-    bus.send_sync_or_async(m) do |retm|
-      if retm.is_a?(DBus::Error)
-        puts "Error: #{retm.inspect}"
-      else
-        puts "Method #{m.member} returns: #{retm.params.inspect}"
-      end
-    end
-  end
-end
-
-class DBusUI
-  def initialize
-    @glade = Gtk::Builder.new
-    @glade << "gdbus.glade"
-
-    @sessiontreeview = @glade.get_object("sessiontreeview")
-    setup_treeview_renderer(@sessiontreeview, "D-Bus Objects")
-    @sessiontreeview.selection.signal_connect("changed") do |selection|
-      on_treeview_selection_changed(selection)
-    end
-
-    @systemtreeview = @glade.get_object("systemtreeview")
-    setup_treeview_renderer(@systemtreeview, "D-Bus Objects")
-    @systemtreeview.selection.signal_connect("changed") do |selection|
-      on_treeview_selection_changed(selection)
-    end
-
-    @methsigtreeview = @glade.get_object("methsigtreeview")
-    # ierk
-    setup_methodview_renderer(@methsigtreeview)
-    @methsigtreeview.signal_connect("row-activated") do |view, path, column|
-      on_method_activated(view, path, column)
-    end
-
-    @window = @glade.get_object("window1")
-    @window.show_all
-    start_buses
-  end
-
-  def beautify_method(meth)
-    # Damn, this need to be rewritten :p
-    s = "#{meth.name}("
-    case meth
-    when DBus::Method
-      s += (meth.params.collect { |a| "in #{a[0]}:#{a[1]}" } +
-            meth.rets.collect { |a| "out #{a[0]}:#{a[1]}" }).join(", ")
-    when DBus::Signal
-      s += (meth.params.collect { |a| "in #{a[0]}:#{a[1]}" }).join(", ")
-    end
-    s += ")"
-    s
-  end
-
-  def on_treeview_selection_changed(selection)
-    selected = selection.selected
-    model = Gtk::ListStore.new(String, String, DBus::Method,
-                               DBus::ProxyObjectInterface)
-    @methsigtreeview.model = model
-    return unless selected
-
-    intf = selected[1]
-    return unless intf
-
-    intf.methods.keys.sort.each do |mi|
-      m = intf.methods[mi]
-      subiter = model.append
-      subiter[0] = beautify_method(m)
-      subiter[1] = "M"
-      subiter[2] = m
-      subiter[3] = intf
-    end
-    intf.signals.keys.sort.each do |mi|
-      m = intf.signals[mi]
-      subiter = model.append
-      subiter[0] = beautify_method(m)
-      subiter[1] = "S"
-      subiter[2] = m
-      subiter[3] = intf
-    end
-  end
-
-  def on_method_activated(view, path, _column)
-    name = view.model.get_iter(path)[0]
-    puts "Clicked on: #{name.inspect}"
-    type = view.model.get_iter(path)[1]
-    case type
-    when "M"
-      method = view.model.get_iter(path)[2]
-      intf = view.model.get_iter(path)[3]
-      MethodCallWindow.new(@window, intf, method).run
-    when "S"
-      signal = view.model.get_iter(path)[2]
-      intf = view.model.get_iter(path)[3]
-      mr = DBus::MatchRule.new.from_signal(intf, signal)
-      puts "*** Registering matchrule: #{mr} ***"
-      intf.object.bus.add_match(mr) do |sig|
-        puts "Got #{sig.member}(#{sig.params.join(",")})"
-      end
-    end
-  end
-
-  def on_sessiontreeview_row_activated(view, path, _column)
-    name = view.model.get_iter(path)[0]
-    puts "Clicked on: #{name.inspect}"
-  end
-
-  def on_window_delete_event(_window, _event)
-    Gtk.main_quit
-  end
-
-  def setup_methodview_renderer(treeview)
-    renderer = Gtk::CellRendererText.new
-    _col_offset = treeview.insert_column(-1, "T", renderer, "text" => 1)
-    col_offset = treeview.insert_column(-1, "Name", renderer, "text" => 0)
-    column = treeview.get_column(col_offset - 1)
-    column.clickable = true
-  end
-
-  def setup_treeview_renderer(treeview, str)
-    renderer = Gtk::CellRendererText.new
-    col_offset = treeview.insert_column(-1, str, renderer, "text" => 0)
-    column = treeview.get_column(col_offset - 1)
-    column.clickable = true
-  end
-
-  def process_input(bus)
-    # THIS is the bad ass loop
-    # we should return to the glib main loop from time to time. Anyone with a
-    # proper way to handle it ?
-    bus.update_buffer
-    bus.messages.each do |msg|
-      bus.process(msg)
-    end
-  end
-
-  def start_buses
-    # call glibize to get dbus messages from the glib mainloop
-    DBus::SessionBus.instance.glibize
-    DBus::SystemBus.instance.glibize if ENABLE_SYSTEM
-
-    DBus::SessionBus.instance.proxy.ListNames do |_msg, names|
-      fill_treeview(DBus::SessionBus.instance, @sessiontreeview, names)
-    end
-
-    return unless ENABLE_SYSTEM
-
-    DBus::SystemBus.instance.proxy.ListNames do |_msg, names|
-      fill_treeview(DBus::SystemBus.instance, @systemtreeview, names)
-    end
-  end
-
-  def walk_node(model, iter, node)
-    node.each_pair do |key, val|
-      subiter = model.append(iter)
-      subiter[0] = key
-      walk_node(model, subiter, val)
-    end
-
-    return if node.object.nil?
-
-    node.object.interfaces.sort.each do |ifname|
-      subiter = model.append(iter)
-      subiter[0] = ifname
-      subiter[1] = node.object[ifname]
-    end
-  end
-
-  def introspect_services(model, bus)
-    el = @introspect_array.shift
-    if el !~ /^:/
-      iter = model.append(nil)
-      iter[0] = el
-      puts "introspecting: #{el}"
-      begin
-        service = bus.service(el).introspect
-        walk_node(model, iter, service.root)
-      rescue Exception => e
-        puts "DBus Error:"
-        puts e.backtrace.join("\n")
-      end
-    end
-
-    !@introspect_array.empty?
-  end
-
-  def fill_treeview(bus, treeview, array)
-    model = Gtk::TreeStore.new(String, DBus::ProxyObjectInterface)
-    treeview.model = model
-    @introspect_array = array.sort
-    Gtk.idle_add { introspect_services(model, bus) }
-  end
-
-  def main
-    Gtk.main
-  end
-end
-
-DBusUI.new.main
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/examples/gdbus/gdbus.glade 
new/examples/gdbus/gdbus.glade
--- old/examples/gdbus/gdbus.glade      2023-04-08 09:43:08.000000000 +0200
+++ new/examples/gdbus/gdbus.glade      1970-01-01 01:00:00.000000000 +0100
@@ -1,98 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<interface>
-  <!-- interface-requires gtk+ 2.6 -->
-  <!-- interface-naming-policy toplevel-contextual -->
-  <object class="GtkWindow" id="window1">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
-    <property name="title" translatable="yes">GD-Bus</property>
-    <property name="default_width">500</property>
-    <property name="default_height">400</property>
-    <signal name="delete-event" handler="on_window_delete_event" swapped="no"/>
-    <child>
-      <object class="GtkHPaned" id="hpaned1">
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <child>
-          <object class="GtkNotebook" id="notebook1">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <child>
-              <object class="GtkScrolledWindow" id="scrolledwindow3">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="shadow_type">in</property>
-                <child>
-                  <object class="GtkTreeView" id="sessiontreeview">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <signal name="row-activated" 
handler="on_sessiontreeview_row_activated" swapped="no"/>
-                  </object>
-                </child>
-              </object>
-            </child>
-            <child type="tab">
-              <object class="GtkLabel" id="label1">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label" translatable="yes">Session</property>
-              </object>
-              <packing>
-                <property name="tab_fill">False</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkScrolledWindow" id="scrolledwindow5">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="shadow_type">in</property>
-                <child>
-                  <object class="GtkTreeView" id="systemtreeview">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                  </object>
-                </child>
-              </object>
-              <packing>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child type="tab">
-              <object class="GtkLabel" id="label2">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label" translatable="yes">System</property>
-              </object>
-              <packing>
-                <property name="position">1</property>
-                <property name="tab_fill">False</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="resize">False</property>
-            <property name="shrink">True</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkScrolledWindow" id="scrolledwindow4">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="shadow_type">in</property>
-            <child>
-              <object class="GtkTreeView" id="methsigtreeview">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <signal name="row-activated" handler="on_method_activated" 
swapped="no"/>
-              </object>
-            </child>
-          </object>
-          <packing>
-            <property name="resize">False</property>
-            <property name="shrink">True</property>
-          </packing>
-        </child>
-      </object>
-    </child>
-  </object>
-</interface>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/examples/gdbus/launch.sh new/examples/gdbus/launch.sh
--- old/examples/gdbus/launch.sh        2023-04-08 09:43:08.000000000 +0200
+++ new/examples/gdbus/launch.sh        1970-01-01 01:00:00.000000000 +0100
@@ -1,4 +0,0 @@
-#!/bin/sh
-set -e
-# for the lazy typer
-ruby -w -I ../../lib gdbus
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/dbus/auth.rb new/lib/dbus/auth.rb
--- old/lib/dbus/auth.rb        2023-04-08 09:43:08.000000000 +0200
+++ new/lib/dbus/auth.rb        2023-05-17 10:39:40.000000000 +0200
@@ -8,8 +8,6 @@
 # License, version 2.1 as published by the Free Software Foundation.
 # See the file "COPYING" for the exact licensing terms.
 
-require "rbconfig"
-
 module DBus
   # Exception raised when authentication fails somehow.
   class AuthenticationFailed < StandardError
@@ -183,7 +181,7 @@
       # that may carry credentials.
       # @return [void]
       def send_nul_byte
-        if RbConfig::CONFIG["target_os"] =~ /freebsd/
+        if Platform.freebsd?
           @socket.sendmsg(0.chr, 0, nil, [:SOCKET, :SCM_CREDS, ""])
         else
           @socket.write(0.chr)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/dbus/bus.rb new/lib/dbus/bus.rb
--- old/lib/dbus/bus.rb 2023-04-08 09:43:08.000000000 +0200
+++ new/lib/dbus/bus.rb 2023-05-17 10:39:40.000000000 +0200
@@ -318,10 +318,13 @@
 <node>
   <interface name="org.freedesktop.DBus.Introspectable">
     <method name="Introspect">
-      <arg name="data" direction="out" type="s"/>
+      <arg direction="out" type="s"/>
     </method>
   </interface>
   <interface name="org.freedesktop.DBus">
+    <method name="Hello">
+      <arg direction="out" type="s"/>
+    </method>
     <method name="RequestName">
       <arg direction="in" type="s"/>
       <arg direction="in" type="u"/>
@@ -336,8 +339,8 @@
       <arg direction="in" type="u"/>
       <arg direction="out" type="u"/>
     </method>
-    <method name="Hello">
-      <arg direction="out" type="s"/>
+    <method name="UpdateActivationEnvironment">
+      <arg direction="in" type="a{ss}"/>
     </method>
     <method name="NameHasOwner">
       <arg direction="in" type="s"/>
@@ -371,12 +374,29 @@
       <arg direction="in" type="s"/>
       <arg direction="out" type="u"/>
     </method>
+    <method name="GetAdtAuditSessionData">
+      <arg direction="in" type="s"/>
+      <arg direction="out" type="ay"/>
+    </method>
     <method name="GetConnectionSELinuxSecurityContext">
       <arg direction="in" type="s"/>
       <arg direction="out" type="ay"/>
     </method>
     <method name="ReloadConfig">
     </method>
+    <method name="GetId">
+      <arg direction="out" type="s"/>
+    </method>
+    <method name="GetConnectionCredentials">
+      <arg direction="in" type="s"/>
+      <arg direction="out" type="a{sv}"/>
+    </method>
+    <property name="Features" type="as" access="read">
+      <annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" 
value="const"/>
+    </property>
+    <property name="Interfaces" type="as" access="read">
+      <annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" 
value="const"/>
+    </property>
     <signal name="NameOwnerChanged">
       <arg type="s"/>
       <arg type="s"/>
@@ -480,7 +500,15 @@
       proxy.RequestName(name, NAME_FLAG_REPLACE_EXISTING) do |rmsg, r|
         # check and report errors first
         raise rmsg if rmsg.is_a?(Error)
-        raise NameRequestError unless r == REQUEST_NAME_REPLY_PRIMARY_OWNER
+
+        details = if r == REQUEST_NAME_REPLY_IN_QUEUE
+                    other = proxy.GetNameOwner(name).first
+                    other_creds = proxy.GetConnectionCredentials(other).first
+                    "already owned by #{other}, #{other_creds.inspect}"
+                  else
+                    "error code #{r}"
+                  end
+        raise NameRequestError, "Could not request #{name}, #{details}" unless 
r == REQUEST_NAME_REPLY_PRIMARY_OWNER
       end
       @service = Service.new(name, self)
       @service
@@ -702,7 +730,8 @@
     def self.session_bus_address
       ENV["DBUS_SESSION_BUS_ADDRESS"] ||
         address_from_file ||
-        "launchd:env=DBUS_LAUNCHD_SESSION_BUS_SOCKET"
+        ("launchd:env=DBUS_LAUNCHD_SESSION_BUS_SOCKET" if Platform.macos?) ||
+        (raise NotImplementedError, "Cannot find session bus; sorry, haven't 
figured out autolaunch yet")
     end
 
     def self.address_from_file
@@ -732,6 +761,9 @@
     include Singleton
   end
 
+  # Default socket name for the system bus.
+  SYSTEM_BUS_ADDRESS = "unix:path=/var/run/dbus/system_bus_socket"
+
   # = D-Bus system bus class
   #
   # The system bus is a system-wide bus mostly used for global or
@@ -742,9 +774,13 @@
   class ASystemBus < Connection
     # Get the default system bus.
     def initialize
-      super(SYSTEM_BUS_ADDRESS)
+      super(self.class.system_bus_address)
       send_hello
     end
+
+    def self.system_bus_address
+      ENV["DBUS_SYSTEM_BUS_ADDRESS"] || SYSTEM_BUS_ADDRESS
+    end
   end
 
   # = D-Bus remote (TCP) bus class
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/dbus/platform.rb new/lib/dbus/platform.rb
--- old/lib/dbus/platform.rb    1970-01-01 01:00:00.000000000 +0100
+++ new/lib/dbus/platform.rb    2023-05-17 10:39:40.000000000 +0200
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+# This file is part of the ruby-dbus project
+# Copyright (C) 2023 Martin Vidner
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License, version 2.1 as published by the Free Software Foundation.
+# See the file "COPYING" for the exact licensing terms.
+
+require "rbconfig"
+
+module DBus
+  # Platform detection
+  module Platform
+    module_function
+
+    def freebsd?
+      RbConfig::CONFIG["target_os"] =~ /freebsd/
+    end
+
+    def macos?
+      RbConfig::CONFIG["target_os"] =~ /darwin/
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/dbus/proxy_object.rb new/lib/dbus/proxy_object.rb
--- old/lib/dbus/proxy_object.rb        2023-04-08 09:43:08.000000000 +0200
+++ new/lib/dbus/proxy_object.rb        2023-05-17 10:39:40.000000000 +0200
@@ -126,8 +126,9 @@
     # It uses _default_iface_ which must have been set.
     # @return [void]
     def on_signal(name, &block)
-      # TODO: improve
-      raise NoMethodError unless @default_iface && has_iface?(@default_iface)
+      unless @default_iface && has_iface?(@default_iface)
+        raise NoMethodError, "undefined signal `#{name}' for DBus interface 
`#{@default_iface}' on object `#{@path}'"
+      end
 
       @interfaces[@default_iface].on_signal(name, &block)
     end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/dbus/xml.rb new/lib/dbus/xml.rb
--- old/lib/dbus/xml.rb 2023-04-08 09:43:08.000000000 +0200
+++ new/lib/dbus/xml.rb 2023-05-17 10:39:40.000000000 +0200
@@ -11,11 +11,17 @@
 # License, version 2.1 as published by the Free Software Foundation.
 # See the file "COPYING" for the exact licensing terms.
 
-# TODO: check if it is slow, make replaceable
-require "rexml/document"
+# Our gemspec says rexml is needed and nokogiri is optional
+# but in fact either will do
+
 begin
   require "nokogiri"
 rescue LoadError
+  begin
+    require "rexml/document"
+  rescue LoadError
+    raise LoadError, "cannot load nokogiri OR rexml/document"
+  end
 end
 
 module DBus
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/dbus.rb new/lib/dbus.rb
--- old/lib/dbus.rb     2023-04-08 09:43:08.000000000 +0200
+++ new/lib/dbus.rb     2023-05-17 10:39:40.000000000 +0200
@@ -41,6 +41,7 @@
 require_relative "dbus/object"
 require_relative "dbus/object_manager"
 require_relative "dbus/object_path"
+require_relative "dbus/platform"
 require_relative "dbus/proxy_object"
 require_relative "dbus/proxy_object_factory"
 require_relative "dbus/proxy_object_interface"
@@ -53,9 +54,6 @@
 #
 # Module containing all the D-Bus modules and classes.
 module DBus
-  # Default socket name for the system bus.
-  SYSTEM_BUS_ADDRESS = "unix:path=/var/run/dbus/system_bus_socket"
-
   # 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-04-08 09:43:08.000000000 +0200
+++ new/metadata        2023-05-17 10:39:40.000000000 +0200
@@ -1,14 +1,14 @@
 --- !ruby/object:Gem::Specification
 name: ruby-dbus
 version: !ruby/object:Gem::Version
-  version: 0.21.0
+  version: 0.22.1
 platform: ruby
 authors:
 - Ruby DBus Team
-autorequire:
+autorequire: 
 bindir: bin
 cert_chain: []
-date: 2023-04-08 00:00:00.000000000 Z
+date: 2023-05-17 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: rexml
@@ -124,9 +124,6 @@
 - doc/Tutorial.md
 - examples/doc/README.md
 - examples/doc/_extract_examples
-- examples/gdbus/gdbus
-- examples/gdbus/gdbus.glade
-- examples/gdbus/launch.sh
 - examples/no-introspect/nm-test.rb
 - examples/no-introspect/tracker-test.rb
 - examples/rhythmbox/playpause.rb
@@ -157,6 +154,7 @@
 - lib/dbus/object.rb
 - lib/dbus/object_manager.rb
 - lib/dbus/object_path.rb
+- lib/dbus/platform.rb
 - lib/dbus/proxy_object.rb
 - lib/dbus/proxy_object_factory.rb
 - lib/dbus/proxy_object_interface.rb
@@ -186,6 +184,7 @@
 - spec/object_spec.rb
 - spec/packet_marshaller_spec.rb
 - spec/packet_unmarshaller_spec.rb
+- spec/platform_spec.rb
 - spec/property_spec.rb
 - spec/proxy_object_interface_spec.rb
 - spec/proxy_object_spec.rb
@@ -211,7 +210,7 @@
 licenses:
 - LGPL-2.1
 metadata: {}
-post_install_message:
+post_install_message: 
 rdoc_options: []
 require_paths:
 - lib
@@ -226,8 +225,8 @@
     - !ruby/object:Gem::Version
       version: '0'
 requirements: []
-rubygems_version: 3.3.0.dev
-signing_key:
+rubygems_version: 3.3.26
+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/ruby-dbus.gemspec new/ruby-dbus.gemspec
--- old/ruby-dbus.gemspec       2023-04-08 09:43:08.000000000 +0200
+++ new/ruby-dbus.gemspec       2023-05-17 10:39:40.000000000 +0200
@@ -22,9 +22,10 @@
 
   s.required_ruby_version = ">= 2.4.0"
 
-  s.add_dependency "rexml"
-
-  # This is optional
+  # Either of rexml and nokogiri is required
+  # but AFAIK gemspec cannot express that.
+  # Nokogiri is recommended as rexml is dead slow.
+  s.add_runtime_dependency "rexml"
   # s.add_runtime_dependency "nokogiri"
 
   s.add_development_dependency "packaging_rake_tasks"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/bus_and_xml_backend_spec.rb 
new/spec/bus_and_xml_backend_spec.rb
--- old/spec/bus_and_xml_backend_spec.rb        2023-04-08 09:43:08.000000000 
+0200
+++ new/spec/bus_and_xml_backend_spec.rb        2023-05-17 10:39:40.000000000 
+0200
@@ -5,7 +5,9 @@
 require_relative "spec_helper"
 
 require "rubygems"
-require "nokogiri"
+# If we have nokogiri, rexml is normally omitted
+# but here we include it for test coverage
+require "rexml"
 require "dbus"
 
 describe "BusAndXmlBackendTest" do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/platform_spec.rb new/spec/platform_spec.rb
--- old/spec/platform_spec.rb   1970-01-01 01:00:00.000000000 +0100
+++ new/spec/platform_spec.rb   2023-05-17 10:39:40.000000000 +0200
@@ -0,0 +1,14 @@
+#!/usr/bin/env rspec
+# frozen_string_literal: true
+
+require_relative "spec_helper"
+require "dbus"
+
+describe DBus::Platform do
+  describe ".macos?" do
+    # code coverage chasing, as other tests mock it out
+    it "doesn't crash" do
+      expect { described_class.macos? }.to_not raise_error
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/session_bus_spec.rb new/spec/session_bus_spec.rb
--- old/spec/session_bus_spec.rb        2023-04-08 09:43:08.000000000 +0200
+++ new/spec/session_bus_spec.rb        2023-05-17 10:39:40.000000000 +0200
@@ -4,6 +4,23 @@
 require_relative "spec_helper"
 require "dbus"
 
+describe DBus::ASystemBus do
+  describe "#initialize" do
+    it "will use DBUS_SYSTEM_BUS_ADDRESS or the well known address" do
+      expect(ENV)
+        .to receive(:[])
+        .with("DBUS_SYSTEM_BUS_ADDRESS")
+        .and_return(nil)
+      expect(DBus::MessageQueue)
+        .to receive(:new)
+        .with("unix:path=/var/run/dbus/system_bus_socket")
+      expect_any_instance_of(described_class).to receive(:send_hello)
+
+      described_class.new
+    end
+  end
+end
+
 describe DBus::ASessionBus do
   subject(:dbus_session_bus_address) { "unix:abstract=/tmp/dbus-foo,guid=123" }
 
@@ -18,6 +35,22 @@
       ENV["DBUS_SESSION_BUS_ADDRESS"] = dbus_session_bus_address
       expect(DBus::ASessionBus.session_bus_address).to 
eq(dbus_session_bus_address)
     end
+
+    it "uses launchd on macOS when ENV and file fail" do
+      ENV["DBUS_SESSION_BUS_ADDRESS"] = nil
+      expect(described_class).to receive(:address_from_file).and_return(nil)
+      expect(DBus::Platform).to receive(:macos?).and_return(true)
+
+      expect(described_class.session_bus_address).to start_with "launchd:"
+    end
+
+    it "raises a readable exception when all addresses fail" do
+      ENV["DBUS_SESSION_BUS_ADDRESS"] = nil
+      expect(described_class).to receive(:address_from_file).and_return(nil)
+      expect(DBus::Platform).to receive(:macos?).and_return(false)
+
+      expect { described_class.session_bus_address }.to 
raise_error(NotImplementedError, /Cannot find session bus/)
+    end
   end
 
   describe "#address_from_file" do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/signal_spec.rb new/spec/signal_spec.rb
--- old/spec/signal_spec.rb     2023-04-08 09:43:08.000000000 +0200
+++ new/spec/signal_spec.rb     2023-05-17 10:39:40.000000000 +0200
@@ -103,4 +103,14 @@
   it "tests removing a nonexistent rule" do
     @obj.on_signal "DoesNotExist"
   end
+
+  describe DBus::ProxyObject do
+    describe "#on_signal" do
+      it "raises a descriptive error when the default_iface is wrong" do
+        @obj.default_iface = "org.ruby.NoSuchInterface"
+        expect { @obj.on_signal("Foo") {} }
+          .to raise_error(NoMethodError, /undefined signal.*interface 
`org.ruby.NoSuchInterface'/)
+      end
+    end
+  end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/tools/dbus-launch-simple 
new/spec/tools/dbus-launch-simple
--- old/spec/tools/dbus-launch-simple   2023-04-08 09:43:08.000000000 +0200
+++ new/spec/tools/dbus-launch-simple   2023-05-17 10:39:40.000000000 +0200
@@ -16,9 +16,9 @@
     # wait for the daemon to print the info
     TRIES=0
     while [ ! -s $AF -o ! -s $PF ]; do
-       sleep 0.1
-       TRIES=`expr $TRIES + 1`
-       if [ $TRIES -gt 100 ]; then echo "dbus-daemon failed?"; exit 1; fi
+        sleep 0.1
+        TRIES=`expr $TRIES + 1`
+        if [ $TRIES -gt 100 ]; then echo "dbus-daemon failed?"; exit 1; fi
     done
     DBUS_SESSION_BUS_PID=$(cat $PF)
     export DBUS_SESSION_BUS_ADDRESS=$(cat $AF)
@@ -26,10 +26,10 @@
 #    dbus-monitor &
 }
 
-my_dbus_launch
-
 # Clean up at exit.
 trap "kill \$KILLS; rm -rf \$RM_FILES" EXIT TERM INT
 
+my_dbus_launch
+
 # run the payload; the return value is passed on
 "$@"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/tools/dbus-limited-session.conf 
new/spec/tools/dbus-limited-session.conf
--- old/spec/tools/dbus-limited-session.conf    2023-04-08 09:43:08.000000000 
+0200
+++ new/spec/tools/dbus-limited-session.conf    2023-05-17 10:39:40.000000000 
+0200
@@ -21,7 +21,17 @@
   <allow_anonymous/>
   -->
 
+  <!-- Give clients a variety of addresses to connect to -->
   <listen>unix:tmpdir=/tmp</listen>
+  <listen>unix:dir=/tmp</listen>
+  <!-- runtime will happily steal the actual session bus! -->
+  <!--
+  <listen>unix:runtime=yes</listen>
+  -->
+  <!-- openSUSE Build Service does not set up IPv6 at build time -->
+  <!--
+  <listen>tcp:host=%3a%3a1,family=ipv6</listen>
+  -->
   <listen>tcp:host=127.0.0.1</listen>
 
   <standard_session_servicedirs />

Reply via email to