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 EAtYAJ0U9V40awAA0tVLHw (envelope-from ) for ; Thu, 25 Jun 2020 21:18:21 +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 gE3mN5wU9V7sXwAA1q6Kng (envelope-from ) for ; Thu, 25 Jun 2020 21:18:20 +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 7E1049401CB for ; Thu, 25 Jun 2020 21:18:20 +0000 (UTC) Received: from localhost ([::1]:38504 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1joZGF-0007OW-EQ for larch@yhetil.org; Thu, 25 Jun 2020 17:18:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49106) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1joZF2-0006AM-Bi for guix-patches@gnu.org; Thu, 25 Jun 2020 17:17:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:58054) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1joZF2-0000m0-2p 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 1joZF1-0002WR-VK for guix-patches@gnu.org; Thu, 25 Jun 2020 17:17:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#42048] [PATCH 5/6] guix describe: Display channel introductions and add 'channels-sans-intro'. 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:03 +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.15931197949595 (code B ref 42048); Thu, 25 Jun 2020 21:17:03 +0000 Received: (at 42048) by debbugs.gnu.org; 25 Jun 2020 21:16:34 +0000 Received: from localhost ([127.0.0.1]:41361 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1joZEX-0002UZ-FF for submit@debbugs.gnu.org; Thu, 25 Jun 2020 17:16:34 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34548) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1joZER-0002TK-JX for 42048@debbugs.gnu.org; Thu, 25 Jun 2020 17:16:28 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:45254) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1joZEM-0000Xx-DF; Thu, 25 Jun 2020 17:16:22 -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 1joZEL-0006HK-Um; Thu, 25 Jun 2020 17:16:22 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Thu, 25 Jun 2020 23:16:04 +0200 Message-Id: <20200625211605.29316-5-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: 7juG2iIo1snM * guix/scripts/describe.scm (%available-formats): Add "channels-sans-intro". (channel->sexp): Add #:include-introduction?. Emit CHANNEL's intro if INCLUDE-INTRODUCTION? is true and CHANNEL has an introduction. (channel->json): Include CHANNEL's introduction, if any. (channel->recutils): Likewise. (display-profile-info): Add 'channels-sans-intro' case. * doc/guix.texi (Invoking guix describe): Add introduction in example. Add 'channels-sans-intro' case. --- doc/guix.texi | 13 ++++++++- guix/scripts/describe.scm | 56 ++++++++++++++++++++++++++++++++------- 2 files changed, 58 insertions(+), 11 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index a4bb52bb24..fcf67bd718 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -4613,7 +4613,12 @@ $ guix describe -f channels (name 'guix) (url "https://git.savannah.gnu.org/git/guix.git") (commit - "e0fa68c7718fffd33d81af415279d6ddb518f727"))) + "e0fa68c7718fffd33d81af415279d6ddb518f727") + (introduction + (make-channel-introduction + "9edb3f66fd807b096b48283debdcddccfea34bad" + (openpgp-fingerprint + "BBB0 2DDF 2CEA F6A8 0D1D E643 A2A0 6DF2 A33A 54FA"))))) @end example @noindent @@ -4639,6 +4644,12 @@ produce human-readable output; produce a list of channel specifications that can be passed to @command{guix pull -C} or installed as @file{~/.config/guix/channels.scm} (@pxref{Invoking guix pull}); +@item channels-sans-intro +like @code{channels}, but omit the @code{introduction} field; use it to +produce a channel specification suitable for Guix version 1.1.0 or +earlier---the @code{introduction} field has to do with channel +authentication (@pxref{Channels, Channel Authentication}) and is not +supported by these older versions; @item json @cindex JSON produce a list of channel specifications in JSON format; diff --git a/guix/scripts/describe.scm b/guix/scripts/describe.scm index 7a2dbc453a..39e096a9a4 100644 --- a/guix/scripts/describe.scm +++ b/guix/scripts/describe.scm @@ -26,9 +26,11 @@ #:use-module (guix scripts) #:use-module (guix describe) #:use-module (guix profiles) + #:autoload (guix openpgp) (openpgp-format-fingerprint) #:use-module (git) #:use-module (json) #:use-module (srfi srfi-1) + #:use-module (srfi srfi-26) #:use-module (srfi srfi-37) #:use-module (ice-9 match) #:autoload (ice-9 pretty-print) (pretty-print) @@ -42,7 +44,8 @@ ;;; ;;; Command-line options. ;;; -(define %available-formats '("human" "channels" "json" "recutils")) +(define %available-formats + '("human" "channels" "channels-sans-intro" "json" "recutils")) (define (list-formats) (display (G_ "The available formats are:\n")) @@ -109,21 +112,50 @@ 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) - `(channel - (name ',(channel-name channel)) - (url ,(channel-url channel)) - (commit ,(channel-commit channel)))) +(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 `((name . ,(channel-name channel)) - (url . ,(channel-url channel)) - (commit . ,(channel-commit channel))))) + (scm->json-string + (let ((intro (channel-introduction channel))) + `((name . ,(channel-name channel)) + (url . ,(channel-url channel)) + (commit . ,(channel-commit channel)) + ,@(if intro + `((introduction + . ((commit . ,(channel-introduction-first-signed-commit + intro)) + (signer . ,(openpgp-format-fingerprint + (channel-introduction-first-commit-signer + intro)))))) + '()))))) (define (channel->recutils channel port) + (define intro + (channel-introduction channel)) + (format port "name: ~a~%" (channel-name channel)) (format port "url: ~a~%" (channel-url channel)) - (format port "commit: ~a~%" (channel-commit channel))) + (format port "commit: ~a~%" (channel-commit channel)) + (when intro + (format port "introductioncommit: ~a~%" + (channel-introduction-first-signed-commit intro)) + (format port "introductionsigner: ~a~%" + (openpgp-format-fingerprint + (channel-introduction-first-commit-signer intro))))) (define (display-checkout-info fmt) "Display information about the current checkout according to FMT, a symbol @@ -181,6 +213,10 @@ in the format specified by FMT." (display-profile-content profile number)) ('channels (pretty-print `(list ,@(map channel->sexp channels)))) + ('channels-sans-intro + (pretty-print `(list ,@(map (cut channel->sexp <> + #:include-introduction? #f) + channels)))) ('json (format #t "[~a]~%" (string-join (map channel->json channels) ","))) ('recutils -- 2.26.2