Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,19 @@ jobs:
# disable unused repositories to have faster refresh
run: zypper modifyrepo -d repo-non-oss repo-openh264 repo-update && ( zypper ref || zypper ref || zypper ref )

- name: Install Ruby development files
run: zypper --non-interactive install gcc gcc-c++ make openssl-devel ruby-devel npm augeas-devel
- name: Install Ruby development files and XML tooling
run: zypper --non-interactive install gcc gcc-c++ make openssl-devel ruby-devel npm augeas-devel xmlstarlet

- name: Install RubyGems dependencies
run: bundle config set --local with 'development' && bundle install

- name: Generate doc
run: bundle exec yardoc --fail-on-warning

- name: Check that introspected API and its docs have not diverged
run: make -C ../doc check


integration-tests:
timeout-minutes: 60
runs-on: ubuntu-latest
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ jobs:
sudo apt-get update
sudo apt-get --assume-yes --no-install-recommends install xmlto docbook-xsl xmlstarlet

- name: Check that introspected API and its docs have not diverged
run: make -C doc check

- name: Build HTML via DocBook
run: make -C doc

Expand Down
2 changes: 1 addition & 1 deletion doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ all:
cp index.html dist

check:
$(MAKE) -C dbus diff
$(MAKE) -C dbus check
3 changes: 2 additions & 1 deletion doc/dbus/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ SHELL=/bin/bash

# check that the implementation and documentation haven't diverged
# TODO: factor out a script to decouple Make syntax from the rest
diff: ${tmpdir}
diff: check
check: ${tmpdir}
ALL_GOOD=true; \
for doc_xml in org.opensuse.Agama*.doc.xml; do \
IFACE=$${doc_xml%.doc.xml}; \
Expand Down
23 changes: 22 additions & 1 deletion doc/dbus/bus/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,22 @@
FIXME: describe how to maintain these (semi)automatically
The `*.bus.xml` files here are produced by introspecting actual objects
exported by the Agama services.

The files are produced by `seed.sh`.
- FIXME: run it in CI.
- FIXME: make it easy to run it *and* commit the result to git.

Each file name represents a D-Bus **interface** that we want to document.
That is why some files have symlinks pointing to them (and why you see no
`org.freedesktop.DBus.*` filenames, we don't need to document those interfaces)

The interfaces implemented in Rust already have documentation in them
(courtesy of Rust macro magic) but it is not in the exact format that
`gdbus-codegen` understands :sob:.

You are expected to copy a new `foo.bus.xml` to `../foo.doc.xml`, remove the
`<interface>` elements other than `foo`, and add meaningful documentation.
Run `make check`.

FIXME: Storage1.ZFCP and Storage1.DASD needs an s390 machine to run,
we should expose them on x86 too (returning errors), perhaps guarded by an
`AGAMA_IGNORE_ARCH` flag?
37 changes: 34 additions & 3 deletions doc/dbus/bus/org.opensuse.Agama.Locale1.bus.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,29 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.freedesktop.DBus.Introspectable">
<method name="Introspect">
<arg type="s" direction="out"/>
<interface name="org.freedesktop.DBus.Properties">
<method name="Get">
<arg name="interface_name" type="s" direction="in"/>
<arg name="property_name" type="s" direction="in"/>
<arg type="v" direction="out"/>
</method>
<method name="Set">
<arg name="interface_name" type="s" direction="in"/>
<arg name="property_name" type="s" direction="in"/>
<arg name="value" type="v" direction="in"/>
</method>
<method name="GetAll">
<arg name="interface_name" type="s" direction="in"/>
<arg type="a{sv}" direction="out"/>
</method>
<!--
Emits the `org.freedesktop.DBus.Properties.PropertiesChanged` signal.
-->
<signal name="PropertiesChanged">
<arg name="interface_name" type="s"/>
<arg name="changed_properties" type="a{sv}"/>
<arg name="invalidated_properties" type="as"/>
</signal>
</interface>
<interface name="org.opensuse.Agama.Locale1">
<!--
Expand All @@ -29,5 +48,17 @@
<property name="Timezone" type="s" access="readwrite"/>
<property name="VConsoleKeyboard" type="s" access="readwrite"/>
</interface>
<interface name="org.freedesktop.DBus.Introspectable">
<method name="Introspect">
<arg type="s" direction="out"/>
</method>
</interface>
<interface name="org.freedesktop.DBus.Peer">
<method name="Ping">
</method>
<method name="GetMachineId">
<arg type="s" direction="out"/>
</method>
</interface>
</node>

50 changes: 31 additions & 19 deletions doc/dbus/bus/org.opensuse.Agama.Questions1.Generic.bus.xml
Original file line number Diff line number Diff line change
@@ -1,37 +1,49 @@

<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node name="/org/opensuse/Agama/Questions1/1">
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.freedesktop.DBus.Properties">
<method name="Get">
<arg name="interface_name" direction="in" type="s"/>
<arg name="property_name" direction="in" type="s"/>
<arg name="value" direction="out" type="v"/>
<arg name="interface_name" type="s" direction="in"/>
<arg name="property_name" type="s" direction="in"/>
<arg type="v" direction="out"/>
</method>
<method name="Set">
<arg name="interface_name" direction="in" type="s"/>
<arg name="property_name" direction="in" type="s"/>
<arg name="val" direction="in" type="v"/>
<arg name="interface_name" type="s" direction="in"/>
<arg name="property_name" type="s" direction="in"/>
<arg name="value" type="v" direction="in"/>
</method>
<method name="GetAll">
<arg name="interface_name" direction="in" type="s"/>
<arg name="value" direction="out" type="a{sv}"/>
<arg name="interface_name" type="s" direction="in"/>
<arg type="a{sv}" direction="out"/>
</method>
<!--
Emits the `org.freedesktop.DBus.Properties.PropertiesChanged` signal.
-->
<signal name="PropertiesChanged">
<arg name="interface" type="s"/>
<arg name="interface_name" type="s"/>
<arg name="changed_properties" type="a{sv}"/>
<arg name="invalidated_properties" type="as"/>
</signal>
</interface>
<interface name="org.freedesktop.DBus.Peer">
<method name="Ping">
</method>
<method name="GetMachineId">
<arg type="s" direction="out"/>
</method>
</interface>
<interface name="org.opensuse.Agama.Questions1.Generic">
<property name="Answer" type="s" access="readwrite"/>
<property name="DefaultOption" type="s" access="read"/>
<property name="Id" type="u" access="read"/>
<property name="Options" type="as" access="read"/>
<property name="Text" type="s" access="read"/>
</interface>
<interface name="org.freedesktop.DBus.Introspectable">
<method name="Introspect">
<arg name="xml_data" direction="out" type="s"/>
<arg type="s" direction="out"/>
</method>
</interface>
<interface name="org.opensuse.Agama.Questions1">
<property type="u" name="Id" access="read"/>
<property type="s" name="Text" access="read"/>
<property type="as" name="Options" access="read"/>
<property type="s" name="DefaultOption" access="read"/>
<property type="s" name="Answer" access="readwrite"/>
</interface>
</node>

62 changes: 37 additions & 25 deletions doc/dbus/bus/org.opensuse.Agama.Questions1.LuksActivation.bus.xml
Original file line number Diff line number Diff line change
@@ -1,41 +1,53 @@

<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node name="/org/opensuse/Agama/Questions1/2">
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.freedesktop.DBus.Introspectable">
<method name="Introspect">
<arg type="s" direction="out"/>
</method>
</interface>
<interface name="org.freedesktop.DBus.Peer">
<method name="Ping">
</method>
<method name="GetMachineId">
<arg type="s" direction="out"/>
</method>
</interface>
<interface name="org.opensuse.Agama.Questions1.Generic">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Questions1.Generic is defined three times (Questions1.bus.xml, Questions1.Generic.bus.xml and Questions1.LuksActivation.bus.xml). Is that expected? I am not sure if that is the best way for documenting objects with dynamic interfaces.

Copy link
Copy Markdown
Contributor

@joseivanlopez joseivanlopez Jun 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, I think the file names could be misleading. For example, I would expect that doc/dbus/bus/org.opensuse.Agama.Questions1.Generic.bus.xml defines the Questions1.Generic interface, but it defines all the interfaces of an object that only includes Questions1.Generic interface.

I would expect to have both, object docs and interface docs. And an object doc only includes the name of the interfaces, for example:

doc/dbus/objects/question/generic.xml
<node name="/org/opensuse/Agama/Storage1/questions/[0-9]+">
  <interface name="org.freedesktop.DBus.Introspectable" />
  <interface name="org.freedesktop.DBus.Peer" />
  <interface name="org.opensuse.Agama.Questions1.Generic" />
</node

doc/dbus/objects/question/luks_activation.xml
<node name="/org/opensuse/Agama/Storage1/questions/[0-9]+>
  <interface name="org.freedesktop.DBus.Introspectable" />
  <interface name="org.freedesktop.DBus.Peer" />
  <interface name="org.opensuse.Agama.Questions1.Generic" />
  <interface name="org.opensuse.Agama.Questions1.LuksActivation" />
</node

doc/dbus/interfaces/org.opensuse.Agama.Questions1.Generic.xml
<interface name="org.opensuse.Agama.Questions1.Generic">
  <property name="Answer" type="s" access="readwrite"/>
  <property name="DefaultOption" type="s" access="read"/>
  <property name="Id" type="u" access="read"/>
  <property name="Options" type="as" access="read"/>
  <property name="Text" type="s" access="read"/>
</interface>

In general, something similar to what UDisks2 does. What do you think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Questions1.Generic is defined three times (Questions1.bus.xml, Questions1.Generic.bus.xml and Questions1.LuksActivation.bus.xml).

Well no, it is documented once in .doc.xml, and mentioned in the introspection output of a generic question, and of a Luks question which must include it because it is a subclass. I'll improve bus/README.md about this.

ooAQ1.Generic.doc.xml
bus/ooAQ1.Generic.bus.xml
bus/ooAQ1.LuksActivation.bus.xml

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect to have both, object docs and interface docs.

Very good point, I have so far concentrated on the automated part and limited the output to the interfaces.
We also need documenting the objects (object trees) and which interfaces they implement. Probably some manually written pieces.

<property name="Answer" type="s" access="readwrite"/>
<property name="DefaultOption" type="s" access="read"/>
<property name="Id" type="u" access="read"/>
<property name="Options" type="as" access="read"/>
<property name="Text" type="s" access="read"/>
</interface>
<interface name="org.freedesktop.DBus.Properties">
<method name="Get">
<arg name="interface_name" direction="in" type="s"/>
<arg name="property_name" direction="in" type="s"/>
<arg name="value" direction="out" type="v"/>
<arg name="interface_name" type="s" direction="in"/>
<arg name="property_name" type="s" direction="in"/>
<arg type="v" direction="out"/>
</method>
<method name="Set">
<arg name="interface_name" direction="in" type="s"/>
<arg name="property_name" direction="in" type="s"/>
<arg name="val" direction="in" type="v"/>
<arg name="interface_name" type="s" direction="in"/>
<arg name="property_name" type="s" direction="in"/>
<arg name="value" type="v" direction="in"/>
</method>
<method name="GetAll">
<arg name="interface_name" direction="in" type="s"/>
<arg name="value" direction="out" type="a{sv}"/>
<arg name="interface_name" type="s" direction="in"/>
<arg type="a{sv}" direction="out"/>
</method>
<!--
Emits the `org.freedesktop.DBus.Properties.PropertiesChanged` signal.
-->
<signal name="PropertiesChanged">
<arg name="interface" type="s"/>
<arg name="interface_name" type="s"/>
<arg name="changed_properties" type="a{sv}"/>
<arg name="invalidated_properties" type="as"/>
</signal>
</interface>
<interface name="org.freedesktop.DBus.Introspectable">
<method name="Introspect">
<arg name="xml_data" direction="out" type="s"/>
</method>
</interface>
<interface name="org.opensuse.Agama.Questions1">
<property type="u" name="Id" access="read"/>
<property type="s" name="Text" access="read"/>
<property type="as" name="Options" access="read"/>
<property type="s" name="DefaultOption" access="read"/>
<property type="s" name="Answer" access="readwrite"/>
</interface>
<interface name="org.opensuse.Agama.Questions1.LuksActivation">
<property type="s" name="Password" access="readwrite"/>
<property type="u" name="Attempt" access="read"/>
<property name="Attempt" type="y" access="read"/>
<property name="Password" type="s" access="readwrite"/>
</interface>
</node>

Loading