unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 35118@debbugs.gnu.org
Subject: [bug#35118] [PATCH 3/4] services: dbus: 'wrapped-dbus-service' accepts a list of variables.
Date: Wed,  3 Apr 2019 11:44:18 +0200	[thread overview]
Message-ID: <20190403094419.22802-3-ludo@gnu.org> (raw)
In-Reply-To: <20190403094419.22802-1-ludo@gnu.org>

* gnu/services/dbus.scm (wrapped-dbus-service): Replace 'variable' and
'value' by 'variables', and adjust code accordingly.
* gnu/services/desktop.scm (upower-dbus-service):
(geoclue-dbus-service, elogind-dbus-service): Adjust accordingly.
---
 gnu/services/dbus.scm    | 14 ++++++++++----
 gnu/services/desktop.scm | 12 ++++++------
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/gnu/services/dbus.scm b/gnu/services/dbus.scm
index 3d2dbb903c..35d7ff3c9c 100644
--- a/gnu/services/dbus.scm
+++ b/gnu/services/dbus.scm
@@ -231,14 +231,20 @@ and policy files.  For example, to allow avahi-daemon to use the system bus,
            (dbus-configuration (dbus dbus)
                                (services services))))
 
-(define (wrapped-dbus-service service program variable value)
+(define (wrapped-dbus-service service program variables)
   "Return a wrapper for @var{service}, a package containing a D-Bus service,
-where @var{program} is wrapped such that environment variable @var{variable}
-is set to @var{value} when the bus daemon launches it."
+where @var{program} is wrapped such that @var{variables}, a list of name/value
+tuples, are all set as environment variables when the bus daemon launches it."
   (define wrapper
     (program-file (string-append (package-name service) "-program-wrapper")
                   #~(begin
-                      (setenv #$variable #$value)
+                      (use-modules (ice-9 match))
+
+                      (for-each (match-lambda
+                                  ((variable value)
+                                   (setenv variable value)))
+                                '#$variables)
+
                       (apply execl (string-append #$service "/" #$program)
                              (string-append #$service "/" #$program)
                              (cdr (command-line))))))
diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index 230aeb324c..578095b146 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -217,8 +217,8 @@
 (define (upower-dbus-service config)
   (list (wrapped-dbus-service (upower-configuration-upower config)
                               "libexec/upowerd"
-                              "UPOWER_CONF_FILE_NAME"
-                              (upower-configuration-file config))))
+                              `(("UPOWER_CONF_FILE_NAME"
+                                 ,(upower-configuration-file config))))))
 
 (define (upower-shepherd-service config)
   "Return a shepherd service for UPower with CONFIG."
@@ -349,8 +349,8 @@ users are allowed."
 (define (geoclue-dbus-service config)
   (list (wrapped-dbus-service (geoclue-configuration-geoclue config)
                               "libexec/geoclue"
-                              "GEOCLUE_CONFIG_FILE"
-                              (geoclue-configuration-file config))))
+                              `(("GEOCLUE_CONFIG_FILE"
+                                 ,(geoclue-configuration-file config))))))
 
 (define %geoclue-accounts
   (list (user-group (name "geoclue") (system? #t))
@@ -702,8 +702,8 @@ include the @command{udisksctl} command, part of UDisks, and GNOME Disks."
 (define (elogind-dbus-service config)
   (list (wrapped-dbus-service (elogind-package config)
                               "libexec/elogind/elogind"
-                              "ELOGIND_CONF_FILE"
-                              (elogind-configuration-file config))))
+                              `(("ELOGIND_CONF_FILE"
+                                 ,(elogind-configuration-file config))))))
 
 (define (pam-extension-procedure config)
   "Return an extension for PAM-ROOT-SERVICE-TYPE that ensures that all the PAM
-- 
2.21.0

  parent reply	other threads:[~2019-04-03  9:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-03  9:41 [bug#35118] [PATCH 0/4] Add localed, fixing keyboard layout in GDM Ludovic Courtès
2019-04-03  9:44 ` [bug#35118] [PATCH 1/4] services: dbus: Add 'wrapped-dbus-service' Ludovic Courtès
2019-04-03  9:44   ` [bug#35118] [PATCH 2/4] gnu: Add localed, extracted from systemd Ludovic Courtès
2019-04-03  9:44   ` Ludovic Courtès [this message]
2019-04-03  9:44   ` [bug#35118] [PATCH 4/4] services: Add 'localed' service type and have GDM extend it Ludovic Courtès
2019-04-05 13:47 ` bug#35118: [PATCH 0/4] Add localed, fixing keyboard layout in GDM Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190403094419.22802-3-ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=35118@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).