From patchwork Tue May 31 13:30:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 39692 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 35A6927BBEA; Tue, 31 May 2022 14:32:18 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id A832227BBE9 for ; Tue, 31 May 2022 14:32:17 +0100 (BST) Received: from localhost ([::1]:41406 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nw1yq-00005r-Rn for patchwork@mira.cbaines.net; Tue, 31 May 2022 09:32:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36540) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nw1yd-0008NO-04 for guix-patches@gnu.org; Tue, 31 May 2022 09:32:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:53219) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nw1yc-00034u-NC for guix-patches@gnu.org; Tue, 31 May 2022 09:32:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nw1yc-000861-KH for guix-patches@gnu.org; Tue, 31 May 2022 09:32:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55739] [PATCH 2/2] services: dbus: Add a VERBOSE? configuration option. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 31 May 2022 13:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55739 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55739@debbugs.gnu.org Cc: Maxim Cournoyer Received: via spool by 55739-submit@debbugs.gnu.org id=B55739.165400391431098 (code B ref 55739); Tue, 31 May 2022 13:32:02 +0000 Received: (at 55739) by debbugs.gnu.org; 31 May 2022 13:31:54 +0000 Received: from localhost ([127.0.0.1]:47115 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nw1yT-00085W-Jf for submit@debbugs.gnu.org; Tue, 31 May 2022 09:31:54 -0400 Received: from mail-qv1-f50.google.com ([209.85.219.50]:37616) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nw1yO-00084z-9N for 55739@debbugs.gnu.org; Tue, 31 May 2022 09:31:52 -0400 Received: by mail-qv1-f50.google.com with SMTP id b11so11970120qvv.4 for <55739@debbugs.gnu.org>; Tue, 31 May 2022 06:31:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TyV9o1FlkxaY0aiDEmAUAsDazRVkhkqfRRC7JY+0WTg=; b=DWCaj9bnm3j5erSviaCOqbtZkzsliPwrvEzDI6dzRaDL9dys27s7F/NNnxaMgjLQ2i L1HcQ3ZnIlYk42rnAEeUmBXE0W6JRHpqOgAEZAcb2VLA4vooPVBwSfidP/cz7FUiDxPT Qn2juoOECawcC6bmwUqBl3D8rfuh5Qg8PW4L9GYghBQjzICFE5e3zv3lZ8N64Eee9LyF 0ZXrAKUEHcqhB7UMHTJjpgNU89hmI+8ShC7ukNNH5E9RNxfyj7/mfamWqF74GLa2bxOY vFv5KTeHTaQUfmn9p2V/0YOsQKoOuDHQICyGM+G5PVmPrakXVdy7Y1ETspu930xC+UmZ HQvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TyV9o1FlkxaY0aiDEmAUAsDazRVkhkqfRRC7JY+0WTg=; b=tn3OUaB4Af0QScD8GSaaNrQmIcTrmDmeQ0QNVN23b2B5wCisinaGGXoQP4k9n07k8m tStg5OCUC3VXKXeBBfqypIjRpqPgmVAMmpNkjdjiYtkswAFD6A2u99KboBwczIJ8TDbq jDtcTaMuv8QtEbSKzJKL3kUg1N9vktrJrsSiv8StsdVukIq73Fmpy4U0s9dg8RcWE5zB qQJ3WsS01briMmemqAIkib/R/Y4y7vTxSO9BjhWlI4PrxEpbOnBJqhWw6oxcd7pSTkPo 3AB2fmajU8c6w/ZyFG0dDpnONwDsoIr7jptZAhLuc2diLDTc8qS9PIZQHmA4xK7tfyhV sTxg== X-Gm-Message-State: AOAM531XtKcMijEN/Y2dB5upxuMuNe25Y6p2koQsfTr9BbWw0254Wfcb tgSI/oTuDR44WTJakpnb0nKN63YUWiOPDw== X-Google-Smtp-Source: ABdhPJxPAIftHH8zFi2F4Mg5B3G8mz9AMYOwB/wFcd38Arqbmnp+pZ8rqwhB6+31187LH7xwGOAsOA== X-Received: by 2002:a05:6214:501c:b0:464:507a:bf3c with SMTP id jo28-20020a056214501c00b00464507abf3cmr8228511qvb.127.1654003907240; Tue, 31 May 2022 06:31:47 -0700 (PDT) Received: from localhost.localdomain (dsl-154-171.b2b2c.ca. [66.158.154.171]) by smtp.gmail.com with ESMTPSA id h8-20020a37c448000000b006a6278a2b31sm3995017qkm.75.2022.05.31.06.31.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 06:31:46 -0700 (PDT) From: Maxim Cournoyer Date: Tue, 31 May 2022 09:30:54 -0400 Message-Id: <20220531133054.29700-2-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220531133054.29700-1-maxim.cournoyer@gmail.com> References: <20220531133054.29700-1-maxim.cournoyer@gmail.com> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/services/dbus.scm ()[verbose?]: New field. (dbus-shepherd-service): Use it. (dbus-service)[verbose?]: Add argument and update doc. * doc/guix.texi (Desktop Services): Document it. --- doc/guix.texi | 9 +++++++-- gnu/services/dbus.scm | 22 +++++++++++++++++----- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 88e009fe7c..3e12af2067 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -21761,9 +21761,14 @@ The actual service definitions included in @code{%desktop-services} and provided by @code{(gnu services dbus)} and @code{(gnu services desktop)} are described below. -@deffn {Scheme Procedure} dbus-service [#:dbus @var{dbus}] [#:services '()] +@deffn {Scheme Procedure} dbus-service [#:dbus @var{dbus}] [#:services '()] @ + [#:verbose?] Return a service that runs the ``system bus'', using @var{dbus}, with -support for @var{services}. +support for @var{services}. When @var{verbose?} is true, it causes the +@samp{DBUS_VERBOSE} environment variable to be set to @samp{1}; a +verbose-enabled D-Bus package such as @code{dbus-verbose} should be +provided as @var{dbus} in this scenario. The verbose output is logged +to @file{/var/log/dbus-daemon.log}. @uref{https://dbus.freedesktop.org/, D-Bus} is an inter-process communication facility. Its system bus is used to allow system services to communicate diff --git a/gnu/services/dbus.scm b/gnu/services/dbus.scm index ef6b82c572..52cb1e3a51 100644 --- a/gnu/services/dbus.scm +++ b/gnu/services/dbus.scm @@ -53,7 +53,9 @@ (define-record-type* (dbus dbus-configuration-dbus ;file-like (default dbus)) (services dbus-configuration-services ;list of - (default '()))) + (default '())) + (verbose? dbus-configuration-verbose? ;boolean + (default #f))) (define (system-service-directory services) "Return the system service directory, containing @code{.service} files for @@ -191,7 +193,7 @@ (define (dbus-activation config) (define dbus-shepherd-service (match-lambda - (($ dbus) + (($ dbus _ verbose?) (list (shepherd-service (documentation "Run the D-Bus system daemon.") (provision '(dbus-system)) @@ -199,6 +201,12 @@ (define dbus-shepherd-service (start #~(make-forkexec-constructor (list (string-append #$dbus "/bin/dbus-daemon") "--nofork" "--system" "--syslog-only") + #$@(if verbose? + ;; Since the verbose output goes to the console, + ;; not syslog, add a log file to capture it. + '(#:environment-variables '("DBUS_VERBOSE=1") + #:log-file "/var/log/dbus-daemon.log") + '()) #:pid-file "/var/run/dbus/pid")) (stop #~(make-kill-destructor))))))) @@ -234,9 +242,12 @@ (define dbus-root-service-type bus. It allows programs and daemons to communicate and is also responsible for spawning (@dfn{activating}) D-Bus services on demand."))) -(define* (dbus-service #:key (dbus dbus) (services '())) +(define* (dbus-service #:key (dbus dbus) (services '()) verbose?) "Return a service that runs the \"system bus\", using @var{dbus}, with -support for @var{services}. +support for @var{services}. When @var{verbose?} is true, it causes the +@samp{DBUS_VERBOSE} environment variable to be set to @samp{1}; a +verbose-enabled D-Bus package such as @code{dbus-verbose} should be provided +as @var{dbus} in this scenario. @uref{http://dbus.freedesktop.org/, D-Bus} is an inter-process communication facility. Its system bus is used to allow system services to communicate and @@ -248,7 +259,8 @@ (define* (dbus-service #:key (dbus dbus) (services '())) @var{services} must be equal to @code{(list avahi)}." (service dbus-root-service-type (dbus-configuration (dbus dbus) - (services services)))) + (services services) + (verbose? verbose?)))) (define (wrapped-dbus-service service program variables) "Return a wrapper for @var{service}, a package containing a D-Bus service,