guix/gnu/build
Maxim Cournoyer 85b4dabd94
services: jami: Modernize to adjust to Shepherd 0.9+ changes.
This partially fixes <https://issues.guix.gnu.org/54786>, allowing the 'jami'
and 'jami-provisioning' system tests to pass again.

In version 0.9.0, Shepherd constructors are now run concurrently, via
cooperative scheduling (Guile Fibers).  The Jami service previously relied on
blocking sleeps while polling for D-Bus services to become ready after forking
a process; this wouldn't work anymore since while blocking the service process
wouldn't be given the chance to finish starting.  The new reliance on Fibers
in Shepherd's fork+exec-command in the helper 'send-dbus' procedure also meant
that it wouldn't work outside of Shepherd anymore.  Finally, the
'start-service' Shepherd procedure used in the test suite would cause the Jami
daemon to be spawned multiple times (a bug introduced in Shepherd 0.9.0).

To fix/simplify these problems, this change does the following:

1. Use the Guile AC/D-Bus library for D-Bus communication, which simplify
things, such as avoiding the need to fork 'dbus-send' processes.

2. The non-blocking 'sleep' version of Fiber is used for the 'with-retries'
waiting syntax.

3. A 'dbus' package variant is used to adjust the session bus configuration,
tailoring it for the use case at hand.

4. Avoid start-service in the tests, preferring 'jami-service-available?' for
now.

* gnu/build/jami-service.scm (parse-dbus-reply, strip-quotes)
(deserialize-item, serialize-boolean, dbus-dict->alist)
(dbus-array->list, parse-account-ids, parse-account-details)
(parse-contacts): Delete procedures.
(%send-dbus-binary, %send-dbus-bus, %send-dbus-user, %send-dbus-group)
(%send-dbus-debug): Delete parameters.
(jami-service-running?): New procedure.
(send-dbus/configuration-manager): Rename to...
(call-configuration-manager-method): ... this.  Turn METHOD into a positional
argument.  Turn ARGUMENTS into an optional argument.  Invoke
`call-dbus-method' instead of `send-dbus', adjusting callers accordingly.
(get-account-ids, id->account-details, id->account-details)
(id->volatile-account-details, username->id, add-account remove-account)
(username->contacts, remove-contact, add-contact, set-account-details)
(set-all-moderators, username->all-moderators?, username->moderators)
(set-moderator): Adjust accordingly.
(with-retries, send-dbus, dbus-available-services)
(dbus-service-available?): Move to ...
* gnu/build/dbus-service.scm: ... this new module.
(send-dbus): Rewrite to use the Guile AC/D-Bus library.
(%dbus-query-timeout, sleep*): New variables.
(%current-dbus-connection): New parameter.
(initialize-dbus-connection!, argument->signature-type)
(call-dbus-method): New procedures.
(dbus-available-services): Adjust accordingly.
* gnu/local.mk (GNU_SYSTEM_MODULES): Register new module.
* gnu/packages/glib.scm (dbus-for-jami): New variable.
* gnu/services/telephony.scm: (jami-configuration)[dbus]: Default to
dbus-for-jami.
(jami-dbus-session-activation): Write a D-Bus daemon configuration file at
'/var/run/jami/session-local.conf'.
(jami-shepherd-services): Add the closure of guile-ac-d-bus and guile-fibers
as extensions.  Adjust imported modules.  Remove no longer used parameters.
<jami-dbus-session>: Use a PID file, avoiding the need for the manual
synchronization.
<jami>:  Set DBUS_SESSION_BUS_ADDRESS environment variable.  Poll using
'jami-service-available?' instead of 'dbus-service-available?'.
* gnu/tests/telephony.scm (run-jami-test): Add needed Guile extensions.  Set
DBUS_SESSION_BUS_ADDRESS environment variable.  Adjust all tests to use
'jami-service-available?' to determine if the service is started rather than
the now problematic Shepherd's 'start-service'.
2022-06-10 23:52:33 -04:00
..
accounts.scm
activation.scm initrd: Use non-hyphenated kernel command-line parameter names. 2022-03-01 10:30:17 -05:00
bootloader.scm
chromium-extension.scm
cross-toolchain.scm
dbus-service.scm services: jami: Modernize to adjust to Shepherd 0.9+ changes. 2022-06-10 23:52:33 -04:00
file-systems.scm file-systems: Invoke fsck tools with 'system*/tty'. 2022-04-08 18:14:35 +02:00
hurd-boot.scm initrd: Use non-hyphenated kernel command-line parameter names. 2022-03-01 10:30:17 -05:00
image.scm image: Add fat32 support. 2022-05-31 14:51:13 +02:00
install.scm
jami-service.scm services: jami: Modernize to adjust to Shepherd 0.9+ changes. 2022-06-10 23:52:33 -04:00
linux-boot.scm initrd: Honor rootfstype and rootflags command-line parameters. 2022-03-01 10:30:18 -05:00
linux-container.scm linux-container: Add #:child-is-pid1? parameter to 'call-with-container'. 2022-05-01 21:30:35 +02:00
linux-initrd.scm
linux-modules.scm
locale.scm
marionette.scm marionette: Add #:address parameter to 'wait-for-tcp-port'. 2022-05-22 21:56:40 +02:00
secret-service.scm secret-service: Allow cooperative scheduling when Fibers is used. 2022-04-07 00:08:56 +02:00
shepherd.scm Add (guix least-authority). 2022-05-01 21:30:35 +02:00
svg.scm