From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id hj7tIl8U9V6FaQAA0tVLHw (envelope-from ) for ; Thu, 25 Jun 2020 21:17:19 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id UFjAHl8U9V7JcQAAB5/wlQ (envelope-from ) for ; Thu, 25 Jun 2020 21:17:19 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 00A2D940224 for ; Thu, 25 Jun 2020 21:17:18 +0000 (UTC) Received: from localhost ([::1]:35734 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1joZFE-0006Cc-D1 for larch@yhetil.org; Thu, 25 Jun 2020 17:17:16 -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 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -3.3 (---) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: 3.99 X-TUID: NTfLfAmb8dtO * 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))))) -- 2.26.2