ruby-dbus 0.18.0.beta3 → 0.18.0.beta4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/NEWS.md +10 -0
- data/VERSION +1 -1
- data/lib/dbus/marshall.rb +12 -3
- data/spec/data/marshall.yaml +28 -0
- data/spec/packet_marshaller_spec.rb +7 -0
- data/spec/property_spec.rb +30 -1
- data/spec/service_newapi.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6e093b55c88614ceebd2cfd0c09a5bba3886b8c561b8e153c034d9249ae5a08
|
4
|
+
data.tar.gz: a2b2931d1b3b9ae560cc6204e297a7daceec2ec85a065a2782cbbeed34286f5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66e7ad826a0f1ef5bb1abba72a6f76f02fbd4c13c7e7f14caf3abd71946ba4e5a0b9cc16950d60a22eb2d994d73c78306d270296af90f2bf9aa2aaaf4f85dab3
|
7
|
+
data.tar.gz: 4641ca7b18414d7cf58d786ab05d3d3bc3a50d40311b1b5650b6f44a1bfcf0b1cca373eee4445b5cd6e0eb70a42407b244d93c09371d9ea985a66d6d4c79c0d7
|
data/NEWS.md
CHANGED
@@ -2,6 +2,16 @@
|
|
2
2
|
|
3
3
|
## Unreleased
|
4
4
|
|
5
|
+
## Ruby D-Bus 0.18.0.beta4 - 2022-04-21
|
6
|
+
|
7
|
+
Bug fixes:
|
8
|
+
* Service-side properties: Fix Properties.Get, Properties.GetAll for
|
9
|
+
properties that contain arrays, on other than outermost level ([#109][]).
|
10
|
+
* Sending variants: fixed make_variant to correctly guess the signature
|
11
|
+
for UInt64 and number-keyed hashes/dictionaries.
|
12
|
+
|
13
|
+
[#109]: https://github.com/mvidner/ruby-dbus/pull/109
|
14
|
+
|
5
15
|
## Ruby D-Bus 0.18.0.beta3 - 2022-04-10
|
6
16
|
|
7
17
|
Bug fixes:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.18.0.
|
1
|
+
0.18.0.beta4
|
data/lib/dbus/marshall.rb
CHANGED
@@ -250,6 +250,7 @@ module DBus
|
|
250
250
|
when Type::VARIANT
|
251
251
|
append_variant(val)
|
252
252
|
when Type::ARRAY
|
253
|
+
val = val.value if val.is_a?(Data::Array)
|
253
254
|
append_array(type.child, val)
|
254
255
|
when Type::STRUCT, Type::DICT_ENTRY
|
255
256
|
val = val.value if val.is_a?(Data::Struct) || val.is_a?(Data::DictEntry)
|
@@ -353,15 +354,23 @@ module DBus
|
|
353
354
|
elsif value.is_a? Hash
|
354
355
|
h = {}
|
355
356
|
value.each_key { |k| h[k] = make_variant(value[k]) }
|
356
|
-
|
357
|
+
key_type = if value.empty?
|
358
|
+
"s"
|
359
|
+
else
|
360
|
+
t, = make_variant(value.first.first)
|
361
|
+
t
|
362
|
+
end
|
363
|
+
["a{#{key_type}v}", h]
|
357
364
|
elsif value.respond_to? :to_str
|
358
365
|
["s", value.to_str]
|
359
366
|
elsif value.respond_to? :to_int
|
360
367
|
i = value.to_int
|
361
|
-
if
|
368
|
+
if Data::Int32.range.cover?(i)
|
362
369
|
["i", i]
|
363
|
-
|
370
|
+
elsif Data::Int64.range.cover?(i)
|
364
371
|
["x", i]
|
372
|
+
else
|
373
|
+
["t", i]
|
365
374
|
end
|
366
375
|
end
|
367
376
|
end
|
data/spec/data/marshall.yaml
CHANGED
@@ -1534,6 +1534,34 @@
|
|
1534
1534
|
- [0xDE, 0xAD, 0xBE, 0xEF]
|
1535
1535
|
exc: DBus::InvalidPacketException
|
1536
1536
|
msg: ''
|
1537
|
+
- sig: a{oq}
|
1538
|
+
end: little
|
1539
|
+
buf:
|
1540
|
+
# body size
|
1541
|
+
- [0, 0, 0, 0]
|
1542
|
+
# padding
|
1543
|
+
- [0, 0, 0, 0]
|
1544
|
+
val: {}
|
1545
|
+
- sig: a{oq}
|
1546
|
+
end: little
|
1547
|
+
buf:
|
1548
|
+
# body size
|
1549
|
+
- [26, 0, 0, 0]
|
1550
|
+
# dict_entry padding
|
1551
|
+
- [0, 0, 0, 0]
|
1552
|
+
# key, padding, value
|
1553
|
+
- [2, 0, 0, 0, "/7", 0]
|
1554
|
+
- 0
|
1555
|
+
- [7, 0]
|
1556
|
+
# dict_entry padding
|
1557
|
+
- [0, 0, 0, 0, 0, 0]
|
1558
|
+
# key, padding, value
|
1559
|
+
- [2, 0, 0, 0, "/9", 0]
|
1560
|
+
- 0
|
1561
|
+
- [9, 0]
|
1562
|
+
val:
|
1563
|
+
/7: 7
|
1564
|
+
/9: 9
|
1537
1565
|
- sig: "(qq)"
|
1538
1566
|
end: little
|
1539
1567
|
buf:
|
@@ -29,6 +29,13 @@ describe DBus::PacketMarshaller do
|
|
29
29
|
subject.append(signature, t.val)
|
30
30
|
expect(subject.packet).to eq(expected)
|
31
31
|
end
|
32
|
+
|
33
|
+
it "writes a '#{signature}' with typed value #{t.val.inspect} (#{endianness})" do
|
34
|
+
subject = described_class.new(endianness: endianness)
|
35
|
+
typed_val = DBus::Data.make_typed(signature, t.val)
|
36
|
+
subject.append(signature, typed_val)
|
37
|
+
expect(subject.packet).to eq(expected)
|
38
|
+
end
|
32
39
|
end
|
33
40
|
end
|
34
41
|
end
|
data/spec/property_spec.rb
CHANGED
@@ -4,6 +4,14 @@
|
|
4
4
|
require_relative "spec_helper"
|
5
5
|
require "dbus"
|
6
6
|
|
7
|
+
# FIXME: factor out DBus::TestFixtures::Value in spec_helper
|
8
|
+
require "ostruct"
|
9
|
+
require "yaml"
|
10
|
+
|
11
|
+
data_dir = File.expand_path("data", __dir__)
|
12
|
+
marshall_yaml_s = File.read("#{data_dir}/marshall.yaml")
|
13
|
+
marshall_yaml = YAML.safe_load(marshall_yaml_s)
|
14
|
+
|
7
15
|
describe "PropertyTest" do
|
8
16
|
before(:each) do
|
9
17
|
@session_bus = DBus::ASessionBus.new
|
@@ -168,8 +176,29 @@ describe "PropertyTest" do
|
|
168
176
|
|
169
177
|
context "a variant-typed property" do
|
170
178
|
it "gets read at all" do
|
171
|
-
|
179
|
+
obj = @svc.object("/org/ruby/MyDerivedInstance")
|
180
|
+
iface = obj["org.ruby.SampleInterface"]
|
181
|
+
val = iface["MyVariant"]
|
172
182
|
expect(val).to eq([42, 43])
|
173
183
|
end
|
174
184
|
end
|
185
|
+
|
186
|
+
context "marshall.yaml round-trip via a VARIANT property" do
|
187
|
+
marshall_yaml.each do |test|
|
188
|
+
t = OpenStruct.new(test)
|
189
|
+
next if t.val.nil?
|
190
|
+
|
191
|
+
# Round trips do not work yet because the properties
|
192
|
+
# must present a plain Ruby value so the exact D-Bus type is lost.
|
193
|
+
# Round trips will work once users can declare accepting DBus::Data
|
194
|
+
# in properties and method arguments.
|
195
|
+
it "Sets #{t.sig.inspect}:#{t.val.inspect} and Gets something back" do
|
196
|
+
before = DBus::Data.make_typed(t.sig, t.val)
|
197
|
+
expect { @iface["MyVariant"] = before }.to_not raise_error
|
198
|
+
expect { _after = @iface["MyVariant"] }.to_not raise_error
|
199
|
+
# round-trip:
|
200
|
+
# expect(after).to eq(before.value)
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
175
204
|
end
|
data/spec/service_newapi.rb
CHANGED
@@ -107,10 +107,10 @@ class Test < DBus::Object
|
|
107
107
|
end
|
108
108
|
dbus_reader :explosive, "s"
|
109
109
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
110
|
+
dbus_attr_accessor :my_struct, "(sss)"
|
111
|
+
dbus_attr_accessor :my_array, "aq"
|
112
|
+
dbus_attr_accessor :my_dict, "a{sv}"
|
113
|
+
dbus_attr_accessor :my_variant, "v"
|
114
114
|
end
|
115
115
|
|
116
116
|
# closing and reopening the same interface
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-dbus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.18.0.
|
4
|
+
version: 0.18.0.beta4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ruby DBus Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-04-
|
11
|
+
date: 2022-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rexml
|