diff --git a/doc/dbus/Makefile b/doc/dbus/Makefile index 7195475146..435844c6bd 100644 --- a/doc/dbus/Makefile +++ b/doc/dbus/Makefile @@ -2,52 +2,15 @@ distdir=../dist/dbus tmpdir=./tmp # build HTML for GitHub pages -all: ${distdir} ${tmpdir} - for f in org.opensuse.Agama*.doc.xml; do \ - echo $$f; \ - gdbus-codegen \ - --interface-prefix=org.opensuse.Agama. \ - --output-directory=${tmpdir} \ - --generate-docbook=ref \ - $$f; \ - docbook=${tmpdir}/ref-$${f%.doc.xml}.xml; \ - xmlto -o ${distdir} --skip-validation html-nochunks $$docbook; \ - done - ./make-index > index.html - cp index.html ${distdir} +all: + ./build-docs "${distdir}" "${tmpdir}" -# 'foo 2> >(grep ... >&2)' greps stderr and keeps it as stderr -NO_COMMENTS=xmlstarlet canonic --without-comments 2> >(grep -v 'Attempt to load network entity' >&2) -# bash because of the >() process substitution -SHELL=/bin/bash +clean: + rm -rf "${distdir}" "${tmpdir}" # check that the implementation and documentation haven't diverged -# TODO: factor out a script to decouple Make syntax from the rest diff: check -check: ${tmpdir} - ALL_GOOD=true; \ - for doc_xml in org.opensuse.Agama*.doc.xml; do \ - IFACE=$${doc_xml%.doc.xml}; \ - bus_xml=bus/$$IFACE.bus.xml; \ - doc_iface=${tmpdir}/$$IFACE.doc.iface.xml; \ - bus_iface=${tmpdir}/$$IFACE.bus.iface.xml; \ - \ - echo "Diffing $$IFACE"; \ - \ - $(NO_COMMENTS) \ - $${doc_xml} \ - > $${doc_iface}; \ - xmlstarlet ed \ - -d "//interface[@name!='$$IFACE']" \ - $${bus_xml} \ - | $(NO_COMMENTS) - \ - > $${bus_iface}; \ - diff --ignore-blank-lines --ignore-trailing-space -u $${doc_iface} $${bus_iface} || ALL_GOOD=false; \ - done; \ - $$ALL_GOOD - @echo "NO DIFF, YAY" +check: + ./compare-impl-and-docs "${tmpdir}" -${distdir}: - mkdir -p $@ -${tmpdir}: - mkdir -p $@ +.PHONY: all diff check \ No newline at end of file diff --git a/doc/dbus/build-docs b/doc/dbus/build-docs new file mode 100755 index 0000000000..0513a8ca21 --- /dev/null +++ b/doc/dbus/build-docs @@ -0,0 +1,36 @@ +#!/bin/sh +# Build HTML for GitHub pages +set -eu + +# Workflow: +# gdbus-codegen (glib2-devel.rpm) +# - reads *.doc.xml introspection with comments +# - writes ref-*.xml, DocBook refentry pieces +# xmlto +# - reads ref-*.xml +# - writes *.html + +# TODO opt in for a repo-wide shellcheck + +# TODO help message +distdir=$1 +tmpdir=$2 +mkdir -p "$distdir" "$tmpdir" + +for f in org.opensuse.Agama*.doc.xml; do + echo "$f" + gdbus-codegen \ + --interface-prefix=org.opensuse.Agama. \ + --output-directory="$tmpdir" \ + --generate-docbook=ref \ + "$f" + docbook="$tmpdir/ref-${f%.doc.xml}.xml" + xmlto \ + -o "$distdir" \ + --skip-validation \ + --stringparam html.stylesheet=refentry-agama.css \ + html-nochunks \ + "$docbook" +done +./make-index > "$distdir"/index.html +cp refentry-agama.css "$distdir" diff --git a/doc/dbus/bus/README.md b/doc/dbus/bus/README.md index 36328c2abe..47d3fbb0c1 100644 --- a/doc/dbus/bus/README.md +++ b/doc/dbus/bus/README.md @@ -4,6 +4,8 @@ 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. + testing_using_container.sh, + (cd doc/dbus/bus; ./seed.sh) 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 @@ -19,4 +21,4 @@ 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? +`AGAMA_MAINFRAME_COSPLAY` flag? diff --git a/doc/dbus/bus/org.opensuse.Agama.Manager1.bus.xml b/doc/dbus/bus/org.opensuse.Agama.Manager1.bus.xml index 945966dedd..805c7c39f7 100644 --- a/doc/dbus/bus/org.opensuse.Agama.Manager1.bus.xml +++ b/doc/dbus/bus/org.opensuse.Agama.Manager1.bus.xml @@ -35,7 +35,6 @@ - @@ -47,10 +46,16 @@ + + + + + + diff --git a/doc/dbus/bus/org.opensuse.Agama.Software1.bus.xml b/doc/dbus/bus/org.opensuse.Agama.Software1.bus.xml index b2c21475f8..3ca7a2b966 100644 --- a/doc/dbus/bus/org.opensuse.Agama.Software1.bus.xml +++ b/doc/dbus/bus/org.opensuse.Agama.Software1.bus.xml @@ -29,6 +29,9 @@ + + + @@ -42,7 +45,8 @@ - + + @@ -68,15 +72,23 @@ + + - + + + + + + + diff --git a/doc/dbus/bus/org.opensuse.Agama.Storage1.bus.xml b/doc/dbus/bus/org.opensuse.Agama.Storage1.bus.xml index 4e727c41cc..063fa00f54 100644 --- a/doc/dbus/bus/org.opensuse.Agama.Storage1.bus.xml +++ b/doc/dbus/bus/org.opensuse.Agama.Storage1.bus.xml @@ -1,12 +1,24 @@ - + - - - - - - + + + + + + + + + + + + + + + + + + + @@ -28,42 +40,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -105,9 +81,6 @@ - - - @@ -130,6 +103,9 @@ + + + @@ -144,7 +120,7 @@ - + @@ -157,18 +133,24 @@ - + - + + + + + + + diff --git a/doc/dbus/bus/org.opensuse.Agama.Users1.bus.xml b/doc/dbus/bus/org.opensuse.Agama.Users1.bus.xml index fcb0439338..6e13b3a3c7 100644 --- a/doc/dbus/bus/org.opensuse.Agama.Users1.bus.xml +++ b/doc/dbus/bus/org.opensuse.Agama.Users1.bus.xml @@ -1,6 +1,10 @@ - + + + + + + @@ -22,18 +26,6 @@ - - - - - - - - - - - - @@ -64,4 +56,11 @@ + + + + + + + diff --git a/doc/dbus/bus/org.opensuse.Agama1.Locale.bus.xml b/doc/dbus/bus/org.opensuse.Agama1.Locale.bus.xml index 5170b7aaa0..7c2523d947 100644 --- a/doc/dbus/bus/org.opensuse.Agama1.Locale.bus.xml +++ b/doc/dbus/bus/org.opensuse.Agama1.Locale.bus.xml @@ -1,34 +1,58 @@ + + + + + + @@ -37,46 +61,6 @@ - - - - - - - - - - - - diff --git a/doc/dbus/bus/org.opensuse.Agama1.LocaleMixin.bus.xml b/doc/dbus/bus/org.opensuse.Agama1.LocaleMixin.bus.xml new file mode 120000 index 0000000000..4db8ffd295 --- /dev/null +++ b/doc/dbus/bus/org.opensuse.Agama1.LocaleMixin.bus.xml @@ -0,0 +1 @@ +org.opensuse.Agama.Manager1.bus.xml \ No newline at end of file diff --git a/doc/dbus/bus/org.opensuse.Agama1.Manager.bus.xml b/doc/dbus/bus/org.opensuse.Agama1.Manager.bus.xml deleted file mode 100644 index 060c3de4d2..0000000000 --- a/doc/dbus/bus/org.opensuse.Agama1.Manager.bus.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/dbus/bus/org.opensuse.Agama1.Questions.Generic.bus.xml b/doc/dbus/bus/org.opensuse.Agama1.Questions.Generic.bus.xml index 0bc9fe9d10..2145b26d8b 100644 --- a/doc/dbus/bus/org.opensuse.Agama1.Questions.Generic.bus.xml +++ b/doc/dbus/bus/org.opensuse.Agama1.Questions.Generic.bus.xml @@ -1,34 +1,58 @@ + + + + + + diff --git a/doc/dbus/bus/org.opensuse.Agama1.Questions.WithPassword.bus.xml b/doc/dbus/bus/org.opensuse.Agama1.Questions.WithPassword.bus.xml index f9dd49994c..7e85448d49 100644 --- a/doc/dbus/bus/org.opensuse.Agama1.Questions.WithPassword.bus.xml +++ b/doc/dbus/bus/org.opensuse.Agama1.Questions.WithPassword.bus.xml @@ -1,34 +1,58 @@ + + + + + + diff --git a/doc/dbus/bus/org.opensuse.Agama1.Questions.bus.xml b/doc/dbus/bus/org.opensuse.Agama1.Questions.bus.xml index 6a85392d5c..5e7a93cccc 100644 --- a/doc/dbus/bus/org.opensuse.Agama1.Questions.bus.xml +++ b/doc/dbus/bus/org.opensuse.Agama1.Questions.bus.xml @@ -1,11 +1,25 @@ + + @@ -28,29 +42,49 @@ + + + + + @@ -83,6 +117,7 @@ diff --git a/doc/dbus/compare-impl-and-docs b/doc/dbus/compare-impl-and-docs new file mode 100755 index 0000000000..e6c2fbb996 --- /dev/null +++ b/doc/dbus/compare-impl-and-docs @@ -0,0 +1,40 @@ +#!/bin/sh +# check that the implementation and documentation haven't diverged +set -eu + +# TODO help message +tmpdir=$1 +mkdir -p "$tmpdir" + +NO_COMMENTS="xmlstarlet --quiet canonic --without-comments" +ALL_GOOD=true +for doc_xml in org.opensuse.Agama*.doc.xml; do + IFACE="${doc_xml%.doc.xml}" + bus_xml=bus/$IFACE.bus.xml + doc_iface="$tmpdir"/$IFACE.doc.iface.xml + bus_iface="$tmpdir"/$IFACE.bus.iface.xml + + echo "Diffing $IFACE" + + ${NO_COMMENTS} \ + "$doc_xml" \ + > "$doc_iface" + + xmlstarlet ed \ + -d "//interface[@name!='$IFACE']" \ + "$bus_xml" \ + | ${NO_COMMENTS} - \ + > "$bus_iface" + + # using ALL_GOOD means show diffs for all interfaces, not only the first one + diff --ignore-blank-lines --ignore-trailing-space -u "$doc_iface" "$bus_iface" || ALL_GOOD=false +done + +if $ALL_GOOD; then + echo "NO DIFF, YAY" +else + echo "error: In the above diff, ignore the whitespace changes." + echo "error: Observe the API changes and make sure they are documented in *.doc.xml" + # fail the check + false +fi diff --git a/doc/dbus/make-index b/doc/dbus/make-index index 4c97fe442e..42d7aed5e3 100755 --- a/doc/dbus/make-index +++ b/doc/dbus/make-index @@ -1,6 +1,12 @@ #!/bin/sh -echo "" -echo "Agama D-Bus API" +cat < + +Agama D-Bus API + + +EOS + echo "
    " for F in tmp/ref-*.xml; do F=${F#tmp/} @@ -9,4 +15,4 @@ for F in tmp/ref-*.xml; do echo " >${F#ref-}" done echo "
" -echo "up" +echo "up" diff --git a/doc/dbus/org.opensuse.Agama1.Manager.doc.xml b/doc/dbus/org.opensuse.Agama.Manager1.doc.xml similarity index 93% rename from doc/dbus/org.opensuse.Agama1.Manager.doc.xml rename to doc/dbus/org.opensuse.Agama.Manager1.doc.xml index 13dd26b9a5..bf427e393a 100644 --- a/doc/dbus/org.opensuse.Agama1.Manager.doc.xml +++ b/doc/dbus/org.opensuse.Agama.Manager1.doc.xml @@ -1,7 +1,7 @@ - - + + @@ -10,12 +10,10 @@ - - - + --> + - - - - + --> + + diff --git a/doc/dbus/org.opensuse.Agama.Software1.doc.xml b/doc/dbus/org.opensuse.Agama.Software1.doc.xml index 0080f876ff..fd558b2317 100644 --- a/doc/dbus/org.opensuse.Agama.Software1.doc.xml +++ b/doc/dbus/org.opensuse.Agama.Software1.doc.xml @@ -4,67 +4,68 @@ + + + + - - - - + + - - - - - - - + + @@ -76,12 +77,11 @@ - @@ -96,6 +96,8 @@ + + diff --git a/doc/dbus/org.opensuse.Agama.Storage1.ISCSI.Initiator.doc.xml b/doc/dbus/org.opensuse.Agama.Storage1.ISCSI.Initiator.doc.xml index 8773ecb5e3..43aab40345 100644 --- a/doc/dbus/org.opensuse.Agama.Storage1.ISCSI.Initiator.doc.xml +++ b/doc/dbus/org.opensuse.Agama.Storage1.ISCSI.Initiator.doc.xml @@ -2,11 +2,6 @@ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> - - - - - diff --git a/doc/dbus/org.opensuse.Agama.Storage1.ISCSI.doc.xml b/doc/dbus/org.opensuse.Agama.Storage1.ISCSI.doc.xml index ce66e330e6..a6347c9c60 100644 --- a/doc/dbus/org.opensuse.Agama.Storage1.ISCSI.doc.xml +++ b/doc/dbus/org.opensuse.Agama.Storage1.ISCSI.doc.xml @@ -4,17 +4,11 @@ - - diff --git a/doc/dbus/org.opensuse.Agama.Storage1.Proposal.Calculator.doc.xml b/doc/dbus/org.opensuse.Agama.Storage1.Proposal.Calculator.doc.xml index 14068f2812..211a0a2453 100644 --- a/doc/dbus/org.opensuse.Agama.Storage1.Proposal.Calculator.doc.xml +++ b/doc/dbus/org.opensuse.Agama.Storage1.Proposal.Calculator.doc.xml @@ -2,24 +2,19 @@ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> - - - - - - - - - + + --> + + - - + + --> + - - diff --git a/doc/dbus/org.opensuse.Agama.Storage1.Proposal.doc.xml b/doc/dbus/org.opensuse.Agama.Storage1.Proposal.doc.xml index 9b7bea10ab..43a693dfe6 100644 --- a/doc/dbus/org.opensuse.Agama.Storage1.Proposal.doc.xml +++ b/doc/dbus/org.opensuse.Agama.Storage1.Proposal.doc.xml @@ -1,11 +1,15 @@ diff --git a/doc/dbus/org.opensuse.Agama.Storage1.ZFCP.Controller.doc.xml b/doc/dbus/org.opensuse.Agama.Storage1.ZFCP.Controller.doc.xml index 04e45a262b..ee145c498d 100644 --- a/doc/dbus/org.opensuse.Agama.Storage1.ZFCP.Controller.doc.xml +++ b/doc/dbus/org.opensuse.Agama.Storage1.ZFCP.Controller.doc.xml @@ -2,88 +2,89 @@ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> - + - - + - + - - - + - - - + + + diff --git a/doc/dbus/org.opensuse.Agama.Storage1.ZFCP.Disk.doc.xml b/doc/dbus/org.opensuse.Agama.Storage1.ZFCP.Disk.doc.xml index 3862cc309e..95c710aae1 100644 --- a/doc/dbus/org.opensuse.Agama.Storage1.ZFCP.Disk.doc.xml +++ b/doc/dbus/org.opensuse.Agama.Storage1.ZFCP.Disk.doc.xml @@ -2,22 +2,27 @@ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> diff --git a/doc/dbus/org.opensuse.Agama.Storage1.ZFCP.Manager.doc.xml b/doc/dbus/org.opensuse.Agama.Storage1.ZFCP.Manager.doc.xml index b7e40f85ef..d56330773e 100644 --- a/doc/dbus/org.opensuse.Agama.Storage1.ZFCP.Manager.doc.xml +++ b/doc/dbus/org.opensuse.Agama.Storage1.ZFCP.Manager.doc.xml @@ -3,11 +3,13 @@ diff --git a/doc/dbus/org.opensuse.Agama.Storage1.doc.xml b/doc/dbus/org.opensuse.Agama.Storage1.doc.xml index 8c1a49df11..898a145059 100644 --- a/doc/dbus/org.opensuse.Agama.Storage1.doc.xml +++ b/doc/dbus/org.opensuse.Agama.Storage1.doc.xml @@ -2,25 +2,23 @@ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> - - - - - - - + + --> + - - - - + + --> + - - + + --> + - - - + + --> + - - - - + + --> + + + + - - - - - - - - - - - diff --git a/doc/dbus/org.opensuse.Agama1.LocaleMixin.doc.xml b/doc/dbus/org.opensuse.Agama1.LocaleMixin.doc.xml new file mode 100644 index 0000000000..1f0ae415a3 --- /dev/null +++ b/doc/dbus/org.opensuse.Agama1.LocaleMixin.doc.xml @@ -0,0 +1,16 @@ + + + + + + + + + + diff --git a/doc/dbus/org.opensuse.Agama1.Progress.doc.xml b/doc/dbus/org.opensuse.Agama1.Progress.doc.xml index 1a1a3ed0e0..02779d19b0 100644 --- a/doc/dbus/org.opensuse.Agama1.Progress.doc.xml +++ b/doc/dbus/org.opensuse.Agama1.Progress.doc.xml @@ -26,5 +26,11 @@ Whether the progress has finished. --> + + + diff --git a/doc/dbus/org.opensuse.Agama1.Questions.Generic.doc.xml b/doc/dbus/org.opensuse.Agama1.Questions.Generic.doc.xml index a58f40cbab..2a0f9ef8bf 100644 --- a/doc/dbus/org.opensuse.Agama1.Questions.Generic.doc.xml +++ b/doc/dbus/org.opensuse.Agama1.Questions.Generic.doc.xml @@ -1,6 +1,10 @@ + diff --git a/doc/dbus/org.opensuse.Agama1.Registration.doc.xml b/doc/dbus/org.opensuse.Agama1.Registration.doc.xml index fa510b0eaa..bd87e3ab63 100644 --- a/doc/dbus/org.opensuse.Agama1.Registration.doc.xml +++ b/doc/dbus/org.opensuse.Agama1.Registration.doc.xml @@ -1,25 +1,24 @@ - - - - - - + + + - - + + --> + diff --git a/doc/dbus/refentry-agama.css b/doc/dbus/refentry-agama.css new file mode 100644 index 0000000000..54efb2e0c6 --- /dev/null +++ b/doc/dbus/refentry-agama.css @@ -0,0 +1,19 @@ +body +{ + font-family: cantarell, sans-serif; +} +@media screen { + body + { + max-width: 60em; + } +} +@media screen and (min-width: 60em) { + /* screen larger than 60em */ + body { margin: auto; } +} +.synopsis, .programlisting { + background: rgba(238, 238, 236, 0.5); + border: solid 1px rgb(238, 238, 236); + padding: 0.5em; +} diff --git a/service/lib/agama/dbus/storage/manager.rb b/service/lib/agama/dbus/storage/manager.rb index 7f96b546b9..ab9c5b4c51 100644 --- a/service/lib/agama/dbus/storage/manager.rb +++ b/service/lib/agama/dbus/storage/manager.rb @@ -76,7 +76,7 @@ def initialize(backend, service_status: nil, logger: nil) register_iscsi_callbacks register_software_callbacks - add_s390_interfaces if Yast::Arch.s390 + add_s390_interfaces if Yast::Arch.s390 || ENV["AGAMA_MAINFRAME_COSPLAY"] == "1" end def locale=(locale) diff --git a/service/lib/agama/storage/dasd/format_operation.rb b/service/lib/agama/storage/dasd/format_operation.rb index 03d6a2eb85..097c9fcde7 100644 --- a/service/lib/agama/storage/dasd/format_operation.rb +++ b/service/lib/agama/storage/dasd/format_operation.rb @@ -20,8 +20,8 @@ # find current contact information at www.suse.com. require "yast" -require "y2s390" -require "y2s390/format_process" +require "y2s390" unless ENV["AGAMA_MAINFRAME_COSPLAY"] == "1" +require "y2s390/format_process" unless ENV["AGAMA_MAINFRAME_COSPLAY"] == "1" module Agama module Storage diff --git a/service/lib/agama/storage/dasd/manager.rb b/service/lib/agama/storage/dasd/manager.rb index 8ed847f4ed..91767b2a97 100644 --- a/service/lib/agama/storage/dasd/manager.rb +++ b/service/lib/agama/storage/dasd/manager.rb @@ -20,7 +20,7 @@ # find current contact information at www.suse.com. require "yast" -require "y2s390" +require "y2s390" unless ENV["AGAMA_MAINFRAME_COSPLAY"] == "1" require "agama/storage/dasd/enable_operation" require "agama/storage/dasd/disable_operation" require "agama/storage/dasd/diag_operation" @@ -53,7 +53,7 @@ class Manager # @param logger [Logger, nil] def initialize(logger: nil) @logger = logger || ::Logger.new($stdout) - @devices = Y2S390::DasdsCollection.new([]) + @devices = Y2S390::DasdsCollection.new([]) unless ENV["AGAMA_MAINFRAME_COSPLAY"] == "1" @on_probe_callbacks = [] @on_refresh_callbacks = [] diff --git a/service/lib/agama/storage/zfcp/manager.rb b/service/lib/agama/storage/zfcp/manager.rb index 354247f682..0594a74706 100644 --- a/service/lib/agama/storage/zfcp/manager.rb +++ b/service/lib/agama/storage/zfcp/manager.rb @@ -20,7 +20,7 @@ # find current contact information at www.suse.com. require "yast" -require "y2s390/zfcp" +require "y2s390/zfcp" unless ENV["AGAMA_MAINFRAME_COSPLAY"] == "1" require "y2storage/storage_manager" require "agama/storage/zfcp/controller" require "agama/storage/zfcp/disk" diff --git a/setup-services.sh b/setup-services.sh index 9368ae8578..425f30f726 100755 --- a/setup-services.sh +++ b/setup-services.sh @@ -129,6 +129,15 @@ fi ) +# See "Install DocBook tooling" in .github/workflows/github-pages.yml +# glib2-devel has gdbus-codegen +$SUDO $ZYPPER install \ + docbook-xsl-stylesheets \ + glib2-devel \ + xmlstarlet \ + xmlto \ + || exit 1 + # Rust service, CLI and auto-installation. # Only install cargo if it is not available (avoid conflicts with rustup) @@ -240,6 +249,10 @@ else $SUDO systemctl start NetworkManager fi +# Let seed.sh see s390 D-Bus interfaces +sed -i -e '/^AGAMA_MAINFRAME_COSPLAY=/d' /run/agama/environment.conf +echo AGAMA_MAINFRAME_COSPLAY=${AGAMA_MAINFRAME_COSPLAY:-0} >> /run/agama/environment.conf + # systemd reload and start of service ( $SUDO systemctl daemon-reload