diff options
author | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2022-05-29 23:46:35 -0400 |
---|---|---|
committer | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2022-06-10 23:52:33 -0400 |
commit | 85b4dabd94d53f8179f31a42046cd83fc3a352fc (patch) | |
tree | 44eccc43dabd037b6a70cb91b7ebf24e56dad646 /gnu/packages/glib.scm | |
parent | b8edfdb0083003f6bd8f2fa084743c9ffcf50909 (diff) | |
download | guix-85b4dabd94d53f8179f31a42046cd83fc3a352fc.tar guix-85b4dabd94d53f8179f31a42046cd83fc3a352fc.tar.gz |
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'.
Diffstat (limited to 'gnu/packages/glib.scm')
-rw-r--r-- | gnu/packages/glib.scm | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/gnu/packages/glib.scm b/gnu/packages/glib.scm index 09d5a03555..732b1aea8a 100644 --- a/gnu/packages/glib.scm +++ b/gnu/packages/glib.scm @@ -9,7 +9,7 @@ ;;; Copyright © 2017 Petter <petter@mykolab.ch> ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr> ;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com> -;;; Copyright © 2019, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com> +;;; Copyright © 2019, 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com> ;;; Copyright © 2019 Giacomo Leidi <goodoldpaul@autistici.org> ;;; Copyright © 2019, 2020, 2021 Marius Bakke <marius@gnu.org> ;;; Copyright © 2020 Nicolò Balzarotti <nicolo@nixo.xyz> @@ -176,6 +176,23 @@ or through unencrypted TCP/IP suitable for use behind a firewall with shared NFS home directories.") (license license:gpl2+))) ; or Academic Free License 2.1 +;;; This variant is used for the Jami service: it provides an entry point to +;;; further customize the configuration of the D-Bus instance run by the +;;; jami-dbus-session service. +(define-public dbus-for-jami + (hidden-package + (package/inherit dbus + (name "dbus-for-jami") + (arguments + (substitute-keyword-arguments (package-arguments dbus) + ((#:phases phases) + `(modify-phases ,phases + (add-after 'unpack 'customize-config + (lambda _ + (substitute* "bus/session.conf.in" + (("@SYSCONFDIR_FROM_PKGDATADIR@/dbus-1/session-local.conf") + "/var/run/jami/session-local.conf"))))))))))) + (define glib (package (name "glib") |