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 2022-04-12 21:43:20
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-ruby-dbus (Old)
and /work/SRC/openSUSE:Factory/.rubygem-ruby-dbus.new.1900 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-ruby-dbus"
Tue Apr 12 21:43:20 2022 rev:25 rq:968278 version:0.18.0.beta3
Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-ruby-dbus/rubygem-ruby-dbus.changes
2022-04-05 19:55:11.698406481 +0200
+++
/work/SRC/openSUSE:Factory/.rubygem-ruby-dbus.new.1900/rubygem-ruby-dbus.changes
2022-04-12 21:43:25.883618186 +0200
@@ -1,0 +2,8 @@
+Sun Apr 10 06:26:55 UTC 2022 - Martin Vidner <[email protected]>
+
+- 0.18.0.beta3
+ Bug fixes:
+ * Service-side properties: Fix Properties.Get, Properties.GetAll
+ for Array, Dict, and Variant types (gh#mvidner/ruby-dbus#105).
+
+-------------------------------------------------------------------
Old:
----
ruby-dbus-0.18.0.beta2.gem
New:
----
ruby-dbus-0.18.0.beta3.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-ruby-dbus.spec ++++++
--- /var/tmp/diff_new_pack.19TDwz/_old 2022-04-12 21:43:30.635563538 +0200
+++ /var/tmp/diff_new_pack.19TDwz/_new 2022-04-12 21:43:30.639563492 +0200
@@ -24,7 +24,7 @@
#
Name: rubygem-ruby-dbus
-Version: 0.18.0.beta2
+Version: 0.18.0.beta3
Release: 0
%define mod_name ruby-dbus
%define mod_full_name %{mod_name}-%{version}
++++++ ruby-dbus-0.18.0.beta2.gem -> ruby-dbus-0.18.0.beta3.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/NEWS.md new/NEWS.md
--- old/NEWS.md 2022-04-04 12:08:55.000000000 +0200
+++ new/NEWS.md 2022-04-10 19:57:37.000000000 +0200
@@ -2,6 +2,14 @@
## Unreleased
+## Ruby D-Bus 0.18.0.beta3 - 2022-04-10
+
+Bug fixes:
+ * Service-side properties: Fix Properties.Get, Properties.GetAll for Array,
+ Dict, and Variant types ([#105][]).
+
+[#105]: https://github.com/mvidner/ruby-dbus/pull/105
+
## Ruby D-Bus 0.18.0.beta2 - 2022-04-04
API:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/VERSION new/VERSION
--- old/VERSION 2022-04-04 12:08:55.000000000 +0200
+++ new/VERSION 2022-04-10 19:57:37.000000000 +0200
@@ -1 +1 @@
-0.18.0.beta2
+0.18.0.beta3
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/data.rb new/lib/dbus/data.rb
--- old/lib/dbus/data.rb 2022-04-04 12:08:55.000000000 +0200
+++ new/lib/dbus/data.rb 2022-04-10 19:57:37.000000000 +0200
@@ -165,6 +165,9 @@
# Represents integers
class Int < Fixed
+ # @!method self.range
+ # @return [Range] the full range of allowed values
+
# @param value [::Integer,DBus::Data::Int]
# @raise RangeError
def initialize(value)
@@ -174,10 +177,6 @@
super(value)
end
-
- def self.range
- raise NotImplementedError, "Abstract"
- end
end
# Byte.
@@ -542,7 +541,7 @@
Data.make_typed(member_type, i)
end
- new(items) # initialize(::Array<Data::Base>)
+ new(items, member_type: member_type) # initialize(::Array<Data::Base>)
end
# FIXME: should Data::Array be mutable?
@@ -603,8 +602,6 @@
# TODO: validation
raise unless value.size == member_types.size
- @member_types = member_types
-
items = member_types.zip(value).map do |item_type, item|
Data.make_typed(item_type, item)
end
@@ -643,14 +640,20 @@
# assert member_types.empty?
# decide on type of value
- new(value)
+ new(value, member_type: nil)
+ end
+
+ # @return [Type]
+ def self.type
+ # memoize
+ @type ||= Type.new(type_code).freeze
end
- # Note that for Variants type=="v",
+ # Note that for Variants type.to_s=="v",
# for the specific see {Variant#member_type}
# @return [Type] the exact type of this value
def type
- "v"
+ self.class.type
end
# @return [Type]
@@ -708,6 +711,22 @@
value
end
+ # @param value [::Object] (#size, #each)
+ # @param member_types [::Array<Type>]
+ # @return [DictEntry]
+ def self.from_typed(value, member_types:)
+ # assert member_types.size == 2
+ # TODO: duplicated from Struct. Inherit/delegate?
+ # TODO: validation
+ raise unless value.size == member_types.size
+
+ items = member_types.zip(value).map do |item_type, item|
+ Data.make_typed(item_type, item)
+ end
+
+ new(items, member_types: member_types) #
initialize(::Array<Data::Base>)
+ end
+
def initialize(value, member_types:)
@member_types = member_types
@type = nil
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/dbus/marshall.rb new/lib/dbus/marshall.rb
--- old/lib/dbus/marshall.rb 2022-04-04 12:08:55.000000000 +0200
+++ new/lib/dbus/marshall.rb 2022-04-10 19:57:37.000000000 +0200
@@ -102,6 +102,8 @@
packet = data_class.from_raw(value, mode: mode)
elsif data_class.basic?
size = aligned_read_value(data_class.size_class)
+ # @raw_msg.align(data_class.alignment)
+ # ^ is not necessary because we've just read a suitably-aligned *size*
value = @raw_msg.read(size)
nul = @raw_msg.read(1)
if nul != "\u0000"
@@ -250,7 +252,7 @@
when Type::ARRAY
append_array(type.child, val)
when Type::STRUCT, Type::DICT_ENTRY
- val = val.value if val.is_a?(Data::Struct)
+ val = val.value if val.is_a?(Data::Struct) ||
val.is_a?(Data::DictEntry)
unless val.is_a?(Array) || val.is_a?(Struct)
type_name = Type::TYPE_MAPPING[type.sigtype].first
raise TypeException, "#{type_name} expects an Array or Struct,
seen #{val.class}"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2022-04-04 12:08:55.000000000 +0200
+++ new/metadata 2022-04-10 19:57:37.000000000 +0200
@@ -1,14 +1,14 @@
--- !ruby/object:Gem::Specification
name: ruby-dbus
version: !ruby/object:Gem::Version
- version: 0.18.0.beta2
+ version: 0.18.0.beta3
platform: ruby
authors:
- Ruby DBus Team
autorequire:
bindir: bin
cert_chain: []
-date: 2022-04-04 00:00:00.000000000 Z
+date: 2022-04-10 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: rexml
@@ -197,6 +197,7 @@
- spec/type_spec.rb
- spec/value_spec.rb
- spec/variant_spec.rb
+- spec/zzz_quit_spec.rb
homepage: https://github.com/mvidner/ruby-dbus
licenses:
- LGPL-2.1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spec/data_spec.rb new/spec/data_spec.rb
--- old/spec/data_spec.rb 2022-04-04 12:08:55.000000000 +0200
+++ new/spec/data_spec.rb 2022-04-10 19:57:37.000000000 +0200
@@ -183,6 +183,14 @@
include_examples "constructor accepts plain or typed values", good
include_examples "constructor rejects values from this list", bad
+
+ describe ".alignment" do
+ # this overly specific test avoids a redundant alignment call
+ # in the production code
+ it "returns the correct value" do
+ expect(described_class.alignment).to eq 4
+ end
+ end
end
describe DBus::Data::ObjectPath do
@@ -198,6 +206,14 @@
include_examples "constructor accepts plain or typed values", good
include_examples "constructor rejects values from this list", bad
+
+ describe ".alignment" do
+ # this overly specific test avoids a redundant alignment call
+ # in the production code
+ it "returns the correct value" do
+ expect(described_class.alignment).to eq 4
+ end
+ end
end
describe DBus::Data::Signature do
@@ -215,6 +231,14 @@
include_examples "constructor accepts plain or typed values", good
include_examples "constructor rejects values from this list", bad
+
+ describe ".alignment" do
+ # this overly specific test avoids a redundant alignment call
+ # in the production code
+ it "returns the correct value" do
+ expect(described_class.alignment).to eq 1
+ end
+ end
end
end
@@ -238,6 +262,13 @@
include_examples "constructor (kwargs) accepts values", good
include_examples "constructor (kwargs) rejects values", bad
+
+ describe ".from_typed" do
+ it "creates new instance from given object and type" do
+ type = DBus::Type.new("s")
+ expect(described_class.from_typed(["test", "lest"], member_types:
[type])).to be_a(described_class)
+ end
+ end
end
describe DBus::Data::Struct do
@@ -287,9 +318,33 @@
include_examples "constructor (kwargs) accepts values", good
# include_examples "constructor (kwargs) rejects values", bad
+
+ describe ".from_typed" do
+ it "creates new instance from given object and type" do
+ type = DBus::Type.new("s")
+ expect(described_class.from_typed(["test", "lest"].freeze,
member_types: [type, type]))
+ .to be_a(described_class)
+ end
+ end
end
describe DBus::Data::Variant do
+ describe ".from_typed" do
+ it "creates new instance from given object and type" do
+ type = DBus::Type.new("s")
+ expect(described_class.from_typed("test", member_types: [type])).to
be_a(described_class)
+ end
+
+ it "ignores the member_types argument" do
+ type = DBus::Type.new("s")
+ # Base.from_typed is a generic interface with a fixed signature;
+ # So it must offer the member_types parameter, which is misleading
+ # for a Variant
+ value = described_class.from_typed("test", member_types: [type])
+ expect(value.type.to_s).to eq "v"
+ expect(value.member_type.to_s).to eq "s"
+ end
+ end
end
describe DBus::Data::DictEntry do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spec/property_spec.rb new/spec/property_spec.rb
--- old/spec/property_spec.rb 2022-04-04 12:08:55.000000000 +0200
+++ new/spec/property_spec.rb 2022-04-10 19:57:37.000000000 +0200
@@ -52,7 +52,7 @@
it "tests get all" do
all = @iface.all_properties
- expect(all.keys.sort).to eq(["MyStruct", "ReadMe", "ReadOrWriteMe"])
+ expect(all.keys.sort).to eq(["MyArray", "MyDict", "MyStruct", "MyVariant",
"ReadMe", "ReadOrWriteMe"])
end
it "tests get all on a V1 object" do
@@ -60,7 +60,7 @@
iface = obj["org.ruby.SampleInterface"]
all = iface.all_properties
- expect(all.keys.sort).to eq(["MyStruct", "ReadMe", "ReadOrWriteMe"])
+ expect(all.keys.sort).to eq(["MyArray", "MyDict", "MyStruct", "MyVariant",
"ReadMe", "ReadOrWriteMe"])
end
it "tests unknown property reading" do
@@ -147,4 +147,29 @@
expect(reply).to match(/variant\s+struct {\s+string "three"\s+string
"strings"\s+string "in a struct"\s+}/)
end
end
+
+ context "an array-typed property" do
+ it "gets read as an array" do
+ val = @iface["MyArray"]
+ expect(val).to eq([42, 43])
+ end
+ end
+
+ context "an dict-typed property" do
+ it "gets read as a hash" do
+ val = @iface["MyDict"]
+ expect(val).to eq({
+ "one" => 1,
+ "two" => "dva",
+ "three" => [3, 3, 3]
+ })
+ end
+ end
+
+ context "a variant-typed property" do
+ it "gets read at all" do
+ val = @iface["MyVariant"]
+ expect(val).to eq([42, 43])
+ end
+ end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spec/service_newapi.rb new/spec/service_newapi.rb
--- old/spec/service_newapi.rb 2022-04-04 12:08:55.000000000 +0200
+++ new/spec/service_newapi.rb 2022-04-10 19:57:37.000000000 +0200
@@ -13,16 +13,30 @@
class Test < DBus::Object
Point2D = Struct.new(:x, :y)
+ attr_writer :main_loop
+
INTERFACE = "org.ruby.SampleInterface"
def initialize(path)
super path
@read_me = "READ ME"
@read_or_write_me = "READ OR WRITE ME"
@my_struct = ["three", "strings", "in a struct"].freeze
+ @my_array = [42, 43]
+ @my_dict = {
+ "one" => 1,
+ "two" => "dva",
+ "three" => [3, 3, 3]
+ }
+ @my_variant = @my_array.dup
+ @main_loop = nil
end
# Create an interface aggregating all upcoming dbus_method defines.
dbus_interface INTERFACE do
+ dbus_method :quit, "" do
+ @main_loop&.quit
+ end
+
dbus_method :hello, "in name:s, in name2:s" do |name, name2|
puts "hello(#{name}, #{name2})"
end
@@ -94,6 +108,9 @@
dbus_reader :explosive, "s"
dbus_attr_reader :my_struct, "(sss)"
+ dbus_attr_reader :my_array, "aq"
+ dbus_attr_reader :my_dict, "a{sv}"
+ dbus_attr_reader :my_variant, "v"
end
# closing and reopening the same interface
@@ -193,6 +210,7 @@
puts "listening, with ruby-#{RUBY_VERSION}"
main = DBus::Main.new
main << bus
+myobj.main_loop = main
begin
main.run
rescue SystemCallError
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spec/spec_helper.rb new/spec/spec_helper.rb
--- old/spec/spec_helper.rb 2022-04-04 12:08:55.000000000 +0200
+++ new/spec/spec_helper.rb 2022-04-10 19:57:37.000000000 +0200
@@ -15,6 +15,8 @@
SimpleCov.add_filter "_spec.rb"
# do not cover the activesupport helpers
SimpleCov.add_filter "/core_ext/"
+ # measure all if/else branches on a line
+ SimpleCov.enable_coverage :branch
SimpleCov.start
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spec/zzz_quit_spec.rb new/spec/zzz_quit_spec.rb
--- old/spec/zzz_quit_spec.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/spec/zzz_quit_spec.rb 2022-04-10 19:57:37.000000000 +0200
@@ -0,0 +1,16 @@
+#!/usr/bin/env rspec
+# frozen_string_literal: true
+
+require_relative "spec_helper"
+require "dbus"
+
+describe "Quit the service" do
+ it "Tells the service to quit and waits, to collate coverage data" do
+ session_bus = DBus::ASessionBus.new
+ @svc = session_bus.service("org.ruby.service")
+ @obj = @svc.object("/org/ruby/MyInstance")
+ @obj.default_iface = "org.ruby.SampleInterface"
+ @obj.quit
+ sleep 3
+ end
+end