From patchwork Thu Jun 25 21:16:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 22863 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 82CE727BBE4; Thu, 25 Jun 2020 22:17:16 +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 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 ESMTP id B605F27BBE1 for ; Thu, 25 Jun 2020 22:17:15 +0100 (BST) Received: from localhost ([::1]:35734 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1joZFD-0006Cc-6c for patchwork@mira.cbaines.net; Thu, 25 Jun 2020 17:17:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49110) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1joZF2-0006AO-PQ for guix-patches@gnu.org; Thu, 25 Jun 2020 17:17:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:58055) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1joZF2-0000m9-HL for guix-patches@gnu.org; Thu, 25 Jun 2020 17:17:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1joZF2-0002WZ-Dg for guix-patches@gnu.org; Thu, 25 Jun 2020 17:17:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#42048] [PATCH 6/6] services: provenance: Save channel introductions. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 25 Jun 2020 21:17:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42048 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 42048@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 42048-submit@debbugs.gnu.org id=B42048.15931197949601 (code B ref 42048); Thu, 25 Jun 2020 21:17:04 +0000 Received: (at 42048) by debbugs.gnu.org; 25 Jun 2020 21:16:34 +0000 Received: from localhost ([127.0.0.1]:41363 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1joZEY-0002Ui-2j for submit@debbugs.gnu.org; Thu, 25 Jun 2020 17:16:34 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34556) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1joZES-0002TS-OE for 42048@debbugs.gnu.org; Thu, 25 Jun 2020 17:16:29 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:45255) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1joZEN-0000Yd-Hc; Thu, 25 Jun 2020 17:16:23 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=59608 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1joZEM-0006HK-NK; Thu, 25 Jun 2020 17:16:23 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Thu, 25 Jun 2020 23:16:05 +0200 Message-Id: <20200625211605.29316-6-ludo@gnu.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200625211605.29316-1-ludo@gnu.org> References: <20200625211605.29316-1-ludo@gnu.org> 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.scm (channel->code): Include CHANNEL's introduction, if any, unless CHANNEL is the singleton %DEFAULT-CHANNELS. (channel->sexp): Add comment. * guix/scripts/system.scm (sexp->channel): Change pattern to allow for extensibility. --- gnu/services.scm | 26 ++++++++++++++++++++++---- guix/scripts/system.scm | 4 +++- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/gnu/services.scm b/gnu/services.scm index 27e5558231..f6dc56d940 100644 --- a/gnu/services.scm +++ b/gnu/services.scm @@ -31,6 +31,7 @@ #:use-module (guix sets) #:use-module (guix ui) #:use-module ((guix utils) #:select (source-properties->location)) + #:autoload (guix openpgp) (openpgp-format-fingerprint) #:use-module (guix modules) #:use-module (gnu packages base) #:use-module (gnu packages bash) @@ -392,14 +393,31 @@ by the initrd once the root file system is mounted."))) (define (channel->code channel) "Return code to build CHANNEL, ready to be dropped in a 'channels.scm' file." - `(channel (name ',(channel-name channel)) - (url ,(channel-url channel)) - (branch ,(channel-branch channel)) - (commit ,(channel-commit channel)))) + ;; Since the 'introduction' field is backward-incompatible, and since it's + ;; optional when using the "official" 'guix channel, include it if and only + ;; if we're referring to a different channel. + (let ((intro (and (not (equal? (list channel) %default-channels)) + (channel-introduction channel)))) + `(channel (name ',(channel-name channel)) + (url ,(channel-url channel)) + (branch ,(channel-branch channel)) + (commit ,(channel-commit channel)) + ,@(if intro + `((introduction + (make-channel-introduction + ,(channel-introduction-first-signed-commit intro) + (openpgp-fingerprint + ,(openpgp-format-fingerprint + (channel-introduction-first-commit-signer + intro)))))) + '())))) (define (channel->sexp channel) "Return an sexp describing CHANNEL. The sexp is _not_ code and is meant to be parsed by tools; it's potentially more future-proof than code." + ;; TODO: Add CHANNEL's introduction. Currently we can't do that because + ;; older 'guix system describe' expect exactly name/url/branch/commit + ;; without any additional fields. `(channel (name ,(channel-name channel)) (url ,(channel-url channel)) (branch ,(channel-branch channel)) diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 212b49f008..cfefe8a8a8 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -452,7 +452,9 @@ list of services." (('channel ('name name) ('url url) ('branch branch) - ('commit commit)) + ('commit commit) + rest ...) + ;; XXX: In the future REST may include a channel introduction. (channel (name name) (url url) (branch branch) (commit commit)))))