From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id WP0IKQgyA2BtXQAA0tVLHw (envelope-from ) for ; Sat, 16 Jan 2021 18:35:52 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id 6KfXJAgyA2AsfAAA1q6Kng (envelope-from ) for ; Sat, 16 Jan 2021 18:35:52 +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 3E67B940481 for ; Sat, 16 Jan 2021 18:35:52 +0000 (UTC) Received: from localhost ([::1]:41066 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l0qQR-0004nx-6r for larch@yhetil.org; Sat, 16 Jan 2021 13:35:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51140) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l0qPg-0004Ka-IZ for guix-patches@gnu.org; Sat, 16 Jan 2021 13:35:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:60733) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l0qPg-0006Ox-AQ for guix-patches@gnu.org; Sat, 16 Jan 2021 13:35:04 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l0qPg-0002XR-7R for guix-patches@gnu.org; Sat, 16 Jan 2021 13:35:04 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#45919] [PATCH 7/8] channels: Add 'channel->code'. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 16 Jan 2021 18:35:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45919 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 45919@debbugs.gnu.org Received: via spool by 45919-submit@debbugs.gnu.org id=B45919.16108220729667 (code B ref 45919); Sat, 16 Jan 2021 18:35:04 +0000 Received: (at 45919) by debbugs.gnu.org; 16 Jan 2021 18:34:32 +0000 Received: from localhost ([127.0.0.1]:44038 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l0qPA-0002Vl-Bp for submit@debbugs.gnu.org; Sat, 16 Jan 2021 13:34:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57950) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l0qP7-0002UL-CW for 45919@debbugs.gnu.org; Sat, 16 Jan 2021 13:34:29 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:57165) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l0qP2-0006Cn-6c; Sat, 16 Jan 2021 13:34:24 -0500 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=36420 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1l0qP1-0000li-OV; Sat, 16 Jan 2021 13:34:24 -0500 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Sat, 16 Jan 2021 19:34:08 +0100 Message-Id: <20210116183409.31229-7-ludo@gnu.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210116183409.31229-1-ludo@gnu.org> References: <20210116183409.31229-1-ludo@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: 2.15 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; 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-Migadu-Queue-Id: 3E67B940481 X-Spam-Score: 2.15 X-Migadu-Scanner: scn1.migadu.com X-TUID: to6N1gq7VlKv * guix/channels.scm (channel->code): New procedure, taken from... * guix/scripts/describe.scm (channel->sexp): ... here. Adjust callers accordingly. --- guix/channels.scm | 19 +++++++++++++++++++ guix/scripts/describe.scm | 22 +++------------------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/guix/channels.scm b/guix/channels.scm index 743b4a25b7..cdef77637d 100644 --- a/guix/channels.scm +++ b/guix/channels.scm @@ -92,6 +92,7 @@ profile-channels manifest-entry-channel + channel->code channel-news-entry? channel-news-entry-commit @@ -957,6 +958,24 @@ PROFILE is not a profile created by 'guix pull', return the empty list." (reverse (manifest-entries (profile-manifest profile))))) +(define* (channel->code channel #:key (include-introduction? #t)) + "Return code (an sexp) to build CHANNEL. When INCLUDE-INTRODUCTION? is +true, include its introduction, if any." + (let ((intro (and include-introduction? + (channel-introduction channel)))) + `(channel + (name ',(channel-name channel)) + (url ,(channel-url 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)))))) + '())))) + ;;; ;;; News. diff --git a/guix/scripts/describe.scm b/guix/scripts/describe.scm index b7ec029ba8..e47d207ee0 100644 --- a/guix/scripts/describe.scm +++ b/guix/scripts/describe.scm @@ -113,22 +113,6 @@ Display information about the channels currently in use.\n")) (_ (warning (G_ "'GUIX_PACKAGE_PATH' is set but it is not captured~%"))))))) -(define* (channel->sexp channel #:key (include-introduction? #t)) - (let ((intro (and include-introduction? - (channel-introduction channel)))) - `(channel - (name ',(channel-name channel)) - (url ,(channel-url 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->json channel) (scm->json-string (let ((intro (channel-introduction channel))) @@ -183,7 +167,7 @@ string is ~a.~%") (format #t (G_ " branch: ~a~%") (reference-shorthand head)) (format #t (G_ " commit: ~a~%") commit)) ('channels - (pretty-print `(list ,(channel->sexp (channel (name 'guix) + (pretty-print `(list ,(channel->code (channel (name 'guix) (url (dirname directory)) (commit commit)))))) ('json @@ -213,9 +197,9 @@ in the format specified by FMT." ('human (display-profile-content profile number)) ('channels - (pretty-print `(list ,@(map channel->sexp channels)))) + (pretty-print `(list ,@(map channel->code channels)))) ('channels-sans-intro - (pretty-print `(list ,@(map (cut channel->sexp <> + (pretty-print `(list ,@(map (cut channel->code <> #:include-introduction? #f) channels)))) ('json -- 2.30.0