From unknown Sun Jun 22 11:49:36 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#45040] [PATCH] service: Add shepherd discover action. Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 04 Dec 2020 09:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 45040 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 45040@debbugs.gnu.org Cc: Mathieu Othacehe X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16070756748020 (code B ref -1); Fri, 04 Dec 2020 09:55:02 +0000 Received: (at submit) by debbugs.gnu.org; 4 Dec 2020 09:54:34 +0000 Received: from localhost ([127.0.0.1]:42735 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kl7nN-00025I-PT for submit@debbugs.gnu.org; Fri, 04 Dec 2020 04:54:34 -0500 Received: from lists.gnu.org ([209.51.188.17]:40998) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kl7nM-000259-4t for submit@debbugs.gnu.org; Fri, 04 Dec 2020 04:54:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48006) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kl7nL-0007Cm-SH for guix-patches@gnu.org; Fri, 04 Dec 2020 04:54:31 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:34765) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kl7nK-0000eZ-GD for guix-patches@gnu.org; Fri, 04 Dec 2020 04:54:31 -0500 Received: from [2a01:e0a:19b:d9a0:ec50:e664:fea6:2900] (port=35040 helo=localhost.localdomain) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kl7nJ-0004eG-5Y; Fri, 04 Dec 2020 04:54:29 -0500 From: Mathieu Othacehe Date: Fri, 4 Dec 2020 10:54:17 +0100 Message-Id: <20201204095417.195976-1-othacehe@gnu.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * gnu/services/base.scm (shepherd-discover-action): New procedure, (guix-shepherd-service)[]: add it, []: honor it. * doc/guix.texi (Invoking guix-daemon): Document it. --- doc/guix.texi | 8 ++++++++ gnu/services/base.scm | 32 ++++++++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 1493c68e27..4fc1dffe98 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -1602,6 +1602,14 @@ Servers may serve substitute over HTTP, unencrypted, so anyone on the LAN can see what software you’re installing. @end enumerate +It is also possible to enable or disable substitute servers discovery at +run-time by running: + +@example +herd discover guix-daemon on +herd discover guix-daemon off +@end example + @item --disable-deduplication @cindex deduplication Disable automatic file ``deduplication'' in the store. diff --git a/gnu/services/base.scm b/gnu/services/base.scm index d0d88e18a6..709d011f53 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -1568,6 +1568,27 @@ proxy of 'guix-daemon'...~%") (environ environment) #t))))) +(define shepherd-discover-action + ;; Shepherd action to enable or disable substitute servers discovery. + (shepherd-action + (name 'discover) + (documentation + "Enable or disable substitute servers discovery and restart the +'guix-daemon'.") + (procedure #~(lambda* (_ status) + (let ((environment (environ))) + (if (and status + (string=? status "on")) + (begin + (format #t "enable substitute servers discovery~%") + (setenv "discover" "on")) + (begin + (format #t "disable substitute servers discovery~%") + (unsetenv "discover"))) + (action 'guix-daemon 'restart) + (environ environment) + #t))))) + (define (guix-shepherd-service config) "Return a for the Guix daemon service with CONFIG." (match-record config @@ -1579,7 +1600,8 @@ proxy of 'guix-daemon'...~%") (documentation "Run the Guix daemon.") (provision '(guix-daemon)) (requirement '(user-processes)) - (actions (list shepherd-set-http-proxy-action)) + (actions (list shepherd-set-http-proxy-action + shepherd-discover-action)) (modules '((srfi srfi-1) (ice-9 match) (gnu build shepherd))) @@ -1594,6 +1616,9 @@ proxy of 'guix-daemon'...~%") ;; the 'set-http-proxy' action. (or (getenv "http_proxy") #$http-proxy)) + (define discover? + (or (getenv "discover") #$discover?)) + ;; Start the guix-daemon from a container, when supported, ;; to solve an installation issue. See the comment below for ;; more details. @@ -1608,9 +1633,8 @@ proxy of 'guix-daemon'...~%") #$@(if use-substitutes? '() '("--no-substitutes")) - #$@(if discover? - '("--discover=yes") - '()) + (string-append "--discover=" + (if discover? "yes" "no")) "--substitute-urls" #$(string-join substitute-urls) #$@extra-options -- 2.29.2 From unknown Sun Jun 22 11:49:36 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#45040] [PATCH] service: Add shepherd discover action. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 06 Dec 2020 22:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45040 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Mathieu Othacehe Cc: 45040@debbugs.gnu.org Received: via spool by 45040-submit@debbugs.gnu.org id=B45040.160729286025666 (code B ref 45040); Sun, 06 Dec 2020 22:15:01 +0000 Received: (at 45040) by debbugs.gnu.org; 6 Dec 2020 22:14:20 +0000 Received: from localhost ([127.0.0.1]:51595 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1km2IN-0006fu-Vk for submit@debbugs.gnu.org; Sun, 06 Dec 2020 17:14:20 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57630) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1km2IM-0006fd-5k for 45040@debbugs.gnu.org; Sun, 06 Dec 2020 17:14:18 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:44476) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1km2IH-0006YL-24 for 45040@debbugs.gnu.org; Sun, 06 Dec 2020 17:14:13 -0500 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=45498 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1km2IG-0002hj-6k; Sun, 06 Dec 2020 17:14:12 -0500 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20201204095417.195976-1-othacehe@gnu.org> Date: Sun, 06 Dec 2020 23:14:11 +0100 In-Reply-To: <20201204095417.195976-1-othacehe@gnu.org> (Mathieu Othacehe's message of "Fri, 4 Dec 2020 10:54:17 +0100") Message-ID: <874kky4m6k.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi! Mathieu Othacehe skribis: > * gnu/services/base.scm (shepherd-discover-action): New procedure, > (guix-shepherd-service)[]: add it, > []: honor it. > * doc/guix.texi (Invoking guix-daemon): Document it. [...] > +It is also possible to enable or disable substitute servers discovery at s/servers/server/ > +run-time by running: > + > +@example > +herd discover guix-daemon on > +herd discover guix-daemon off Should it be =E2=80=9Cdiscovery=E2=80=9D instead of =E2=80=9Cdiscover=E2=80= =9D? Hmm=E2=80=A6 Anyway, LGTM! Thanks, Ludo=E2=80=99. From unknown Sun Jun 22 11:49:36 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Mathieu Othacehe Subject: bug#45040: closed (Re: [bug#45040] [PATCH] service: Add shepherd discover action.) Message-ID: References: <87sg8iuf4b.fsf@gnu.org> <20201204095417.195976-1-othacehe@gnu.org> X-Gnu-PR-Message: they-closed 45040 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 45040@debbugs.gnu.org Date: Mon, 07 Dec 2020 09:43:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1607334182-19626-1" This is a multi-part message in MIME format... ------------=_1607334182-19626-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #45040: [PATCH] service: Add shepherd discover action. which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 45040@debbugs.gnu.org. --=20 45040: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D45040 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1607334182-19626-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 45040-done) by debbugs.gnu.org; 7 Dec 2020 09:42:23 +0000 Received: from localhost ([127.0.0.1]:52426 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kmD2E-00055e-Ku for submit@debbugs.gnu.org; Mon, 07 Dec 2020 04:42:22 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56262) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kmD2C-00055R-UE for 45040-done@debbugs.gnu.org; Mon, 07 Dec 2020 04:42:21 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:51509) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kmD27-0005YN-CK; Mon, 07 Dec 2020 04:42:15 -0500 Received: from [2a01:e0a:19b:d9a0:34f0:bcad:cad1:16d6] (port=58352 helo=cervin) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kmD25-0005Av-GB; Mon, 07 Dec 2020 04:42:14 -0500 From: Mathieu Othacehe To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#45040] [PATCH] service: Add shepherd discover action. References: <20201204095417.195976-1-othacehe@gnu.org> <874kky4m6k.fsf@gnu.org> Date: Mon, 07 Dec 2020 10:42:12 +0100 In-Reply-To: <874kky4m6k.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Sun, 06 Dec 2020 23:14:11 +0100") Message-ID: <87sg8iuf4b.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 45040-done Cc: 45040-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hey, > s/servers/server/ Fixed! >> +run-time by running: >> + >> +@example >> +herd discover guix-daemon on >> +herd discover guix-daemon off > > Should it be =E2=80=9Cdiscovery=E2=80=9D instead of =E2=80=9Cdiscover=E2= =80=9D? Hmm=E2=80=A6 The guix-daemon option is called "discover" so I would keep it that way, but I also hesitated. Pushed as e461d3b750080b03f3deea0b44b99c2fda9767ab. Thanks for reviewing, Mathieu ------------=_1607334182-19626-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 4 Dec 2020 09:54:34 +0000 Received: from localhost ([127.0.0.1]:42735 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kl7nN-00025I-PT for submit@debbugs.gnu.org; Fri, 04 Dec 2020 04:54:34 -0500 Received: from lists.gnu.org ([209.51.188.17]:40998) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kl7nM-000259-4t for submit@debbugs.gnu.org; Fri, 04 Dec 2020 04:54:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48006) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kl7nL-0007Cm-SH for guix-patches@gnu.org; Fri, 04 Dec 2020 04:54:31 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:34765) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kl7nK-0000eZ-GD for guix-patches@gnu.org; Fri, 04 Dec 2020 04:54:31 -0500 Received: from [2a01:e0a:19b:d9a0:ec50:e664:fea6:2900] (port=35040 helo=localhost.localdomain) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kl7nJ-0004eG-5Y; Fri, 04 Dec 2020 04:54:29 -0500 From: Mathieu Othacehe To: guix-patches@gnu.org Subject: [PATCH] service: Add shepherd discover action. Date: Fri, 4 Dec 2020 10:54:17 +0100 Message-Id: <20201204095417.195976-1-othacehe@gnu.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit Cc: Mathieu Othacehe X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * gnu/services/base.scm (shepherd-discover-action): New procedure, (guix-shepherd-service)[]: add it, []: honor it. * doc/guix.texi (Invoking guix-daemon): Document it. --- doc/guix.texi | 8 ++++++++ gnu/services/base.scm | 32 ++++++++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 1493c68e27..4fc1dffe98 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -1602,6 +1602,14 @@ Servers may serve substitute over HTTP, unencrypted, so anyone on the LAN can see what software you’re installing. @end enumerate +It is also possible to enable or disable substitute servers discovery at +run-time by running: + +@example +herd discover guix-daemon on +herd discover guix-daemon off +@end example + @item --disable-deduplication @cindex deduplication Disable automatic file ``deduplication'' in the store. diff --git a/gnu/services/base.scm b/gnu/services/base.scm index d0d88e18a6..709d011f53 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -1568,6 +1568,27 @@ proxy of 'guix-daemon'...~%") (environ environment) #t))))) +(define shepherd-discover-action + ;; Shepherd action to enable or disable substitute servers discovery. + (shepherd-action + (name 'discover) + (documentation + "Enable or disable substitute servers discovery and restart the +'guix-daemon'.") + (procedure #~(lambda* (_ status) + (let ((environment (environ))) + (if (and status + (string=? status "on")) + (begin + (format #t "enable substitute servers discovery~%") + (setenv "discover" "on")) + (begin + (format #t "disable substitute servers discovery~%") + (unsetenv "discover"))) + (action 'guix-daemon 'restart) + (environ environment) + #t))))) + (define (guix-shepherd-service config) "Return a for the Guix daemon service with CONFIG." (match-record config @@ -1579,7 +1600,8 @@ proxy of 'guix-daemon'...~%") (documentation "Run the Guix daemon.") (provision '(guix-daemon)) (requirement '(user-processes)) - (actions (list shepherd-set-http-proxy-action)) + (actions (list shepherd-set-http-proxy-action + shepherd-discover-action)) (modules '((srfi srfi-1) (ice-9 match) (gnu build shepherd))) @@ -1594,6 +1616,9 @@ proxy of 'guix-daemon'...~%") ;; the 'set-http-proxy' action. (or (getenv "http_proxy") #$http-proxy)) + (define discover? + (or (getenv "discover") #$discover?)) + ;; Start the guix-daemon from a container, when supported, ;; to solve an installation issue. See the comment below for ;; more details. @@ -1608,9 +1633,8 @@ proxy of 'guix-daemon'...~%") #$@(if use-substitutes? '() '("--no-substitutes")) - #$@(if discover? - '("--discover=yes") - '()) + (string-append "--discover=" + (if discover? "yes" "no")) "--substitute-urls" #$(string-join substitute-urls) #$@extra-options -- 2.29.2 ------------=_1607334182-19626-1--