From patchwork Sat Jul 17 21:04:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Brice Waegeneire X-Patchwork-Id: 31473 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 4D07D27BC6B; Sat, 17 Jul 2021 22:05:11 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 95EAC27BC78 for ; Sat, 17 Jul 2021 22:05:09 +0100 (BST) Received: from localhost ([::1]:33792 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m4rUi-0001ai-NZ for patchwork@mira.cbaines.net; Sat, 17 Jul 2021 17:05:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47920) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m4rUc-0001aR-Cz for guix-patches@gnu.org; Sat, 17 Jul 2021 17:05:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:43142) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m4rUc-00030O-4c for guix-patches@gnu.org; Sat, 17 Jul 2021 17:05:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m4rUb-0007tn-M6 for guix-patches@gnu.org; Sat, 17 Jul 2021 17:05:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49610] [PATCH 1/2] services: guix: Use "match-record" in activation. Resent-From: Brice Waegeneire Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 17 Jul 2021 21:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49610 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49610@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.162655588130327 (code B ref -1); Sat, 17 Jul 2021 21:05:01 +0000 Received: (at submit) by debbugs.gnu.org; 17 Jul 2021 21:04:41 +0000 Received: from localhost ([127.0.0.1]:54685 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m4rUC-0007st-91 for submit@debbugs.gnu.org; Sat, 17 Jul 2021 17:04:41 -0400 Received: from lists.gnu.org ([209.51.188.17]:49522) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m4rU9-0007sk-Ax for submit@debbugs.gnu.org; Sat, 17 Jul 2021 17:04:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47886) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m4rU9-0001We-5c for guix-patches@gnu.org; Sat, 17 Jul 2021 17:04:33 -0400 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:60935) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m4rU7-0002eD-99 for guix-patches@gnu.org; Sat, 17 Jul 2021 17:04:32 -0400 Received: (Authenticated sender: brice@waegenei.re) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id A948D20002 for ; Sat, 17 Jul 2021 21:04:26 +0000 (UTC) From: Brice Waegeneire Date: Sat, 17 Jul 2021 23:04:23 +0200 Message-Id: <20210717210424.1921-1-brice@waegenei.re> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210717205819.380-1-brice@waegenei.re> References: <20210717205819.380-1-brice@waegenei.re> MIME-Version: 1.0 Received-SPF: pass client-ip=217.70.183.200; envelope-from=brice@waegenei.re; helo=relay7-d.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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 It's more explicit to specify used fields instead of depending on their position. * gnu/services/base.scm (guix-activation): Replace "match" with "match-record". --- gnu/services/base.scm | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/gnu/services/base.scm b/gnu/services/base.scm index ab3e441a7b..e206bea5f0 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -12,7 +12,7 @@ ;;; Copyright © 2019 John Soo ;;; Copyright © 2019 Jan (janneke) Nieuwenhuizen ;;; Copyright © 2020 Florian Pelz -;;; Copyright © 2020 Brice Waegeneire +;;; Copyright © 2020, 2021 Brice Waegeneire ;;; Copyright © 2021 qblade ;;; Copyright © 2021 Hui Lu ;;; @@ -1700,21 +1700,21 @@ proxy of 'guix-daemon'...~%") (define (guix-activation config) "Return the activation gexp for CONFIG." - (match config - (($ guix build-group build-accounts authorize-key? keys) - ;; Assume that the store has BUILD-GROUP as its group. We could - ;; otherwise call 'chown' here, but the problem is that on a COW overlayfs, - ;; chown leads to an entire copy of the tree, which is a bad idea. + (match-record config + (guix authorize-key? authorized-keys) + #~(begin + ;; Assume that the store has BUILD-GROUP as its group. We could + ;; otherwise call 'chown' here, but the problem is that on a COW overlayfs, + ;; chown leads to an entire copy of the tree, which is a bad idea. - ;; Generate a key pair and optionally authorize substitute server keys. - #~(begin - (unless (file-exists? "/etc/guix/signing-key.pub") - (system* #$(file-append guix "/bin/guix") "archive" - "--generate-key")) + ;; Generate a key pair and optionally authorize substitute server keys. + (unless (file-exists? "/etc/guix/signing-key.pub") + (system* #$(file-append guix "/bin/guix") "archive" + "--generate-key")) - #$(if authorize-key? - (substitute-key-authorization keys guix) - #~#f))))) + #$(if authorize-key? + (substitute-key-authorization authorized-keys guix) + #~#f)))) (define* (references-file item #:optional (name "references")) "Return a file that contains the list of references of ITEM."