From patchwork Sat Sep 21 21:12:18 2019 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: 15426 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 8A81517400; Sat, 21 Sep 2019 22:13:39 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 4C356173FB for ; Sat, 21 Sep 2019 22:13:39 +0100 (BST) Received: from localhost ([::1]:43750 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBmhG-00039n-Bv for patchwork@mira.cbaines.net; Sat, 21 Sep 2019 17:13:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41346) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBmgk-0002yP-Uu for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBmgj-0005uy-Py for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:52658) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iBmgj-0005us-N2 for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iBmgj-0000O4-Ft for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#37413] [PATCH v2 01/11] pull: '--news' shows the list of channels added or removed. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 21 Sep 2019 21:13:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37413 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 37413@debbugs.gnu.org Received: via spool by 37413-submit@debbugs.gnu.org id=B37413.15691003781385 (code B ref 37413); Sat, 21 Sep 2019 21:13:05 +0000 Received: (at 37413) by debbugs.gnu.org; 21 Sep 2019 21:12:58 +0000 Received: from localhost ([127.0.0.1]:33222 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iBmgb-0000Ly-7R for submit@debbugs.gnu.org; Sat, 21 Sep 2019 17:12:57 -0400 Received: from eggs.gnu.org ([209.51.188.92]:32814) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iBmgU-0000Kt-JY for 37413@debbugs.gnu.org; Sat, 21 Sep 2019 17:12:50 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:49538) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iBmgP-0005eT-H8; Sat, 21 Sep 2019 17:12:45 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=53014 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iBmgP-00065A-1B; Sat, 21 Sep 2019 17:12:45 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 21 Sep 2019 23:12:18 +0200 Message-Id: <20190921211228.13096-2-ludo@gnu.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190921211228.13096-1-ludo@gnu.org> References: <87sgow0w7w.fsf@gnu.org> <20190921211228.13096-1-ludo@gnu.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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 * guix/scripts/pull.scm (display-channel, channel=?) (display-channel-news, display-news): New procedures. (process-query): Call 'display-news' instead of 'display-profile-news'. --- guix/scripts/pull.scm | 61 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 57 insertions(+), 4 deletions(-) diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm index c9835cef34..4091f926ac 100644 --- a/guix/scripts/pull.scm +++ b/guix/scripts/pull.scm @@ -213,6 +213,62 @@ newest generation of PROFILE." (G_ "New in this revision:\n"))))) (_ #t))) +(define (display-channel channel) + "Display information about CHANNEL." + (format (current-error-port) + ;; TRANSLATORS: This describes a "channel"; the first placeholder is + ;; the channel name (e.g., "guix") and the second placeholder is its + ;; URL. + (G_ " ~a at ~a~%") + (channel-name channel) + (channel-url channel))) + +(define (channel=? channel1 channel2) + "Return true if CHANNEL1 and CHANNEL2 are the same for all practical +purposes." + ;; Assume that the URL matters less than the name. + (eq? (channel-name channel1) (channel-name channel2))) + +(define (display-channel-news profile) + "Display new about the channels of PROFILE " + (define previous + (and=> (relative-generation profile -1) + (cut generation-file-name profile <>))) + + (when previous + (let ((old-channels (profile-channels previous)) + (new-channels (profile-channels profile))) + (and (pair? old-channels) (pair? new-channels) + (begin + (match (lset-difference channel=? new-channels old-channels) + (() + #t) + (new + (let ((count (length new))) + (format (current-error-port) + (N_ " ~*One new channel:~%" + " ~a new channels:~%" count) + count) + (for-each display-channel new)))) + (match (lset-difference channel=? old-channels new-channels) + (() + #t) + (removed + (let ((count (length removed))) + (format (current-error-port) + (N_ " ~*One channel removed:~%" + " ~a channels removed:~%" count) + count) + (for-each display-channel removed))))))))) + +(define (display-news profile) + ;; Display profile news, with the understanding that this process represents + ;; the newest generation. + (display-profile-news profile + #:current-is-newer? #t) + + (display-channel-news profile)) + (define* (build-and-install instances profile #:key use-substitutes? verbose? dry-run?) "Build the tool from SOURCE, and install it in PROFILE. When DRY-RUN? is @@ -521,10 +577,7 @@ list of package changes."))))) ((numbers ...) (list-generations profile numbers))))))) (('display-news) - ;; Display profile news, with the understanding that this process - ;; represents the newest generation. - (display-profile-news profile - #:current-is-newer? #t)))) + (display-news profile)))) (define (process-generation-change opts profile) "Process a request to change the current generation (roll-back, switch, delete)." From patchwork Sat Sep 21 21:12:19 2019 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: 15429 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 CCA0B17400; Sat, 21 Sep 2019 22:13:48 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 91CAC173FB for ; Sat, 21 Sep 2019 22:13:48 +0100 (BST) Received: from localhost ([::1]:43760 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBmhP-0003Ql-S3 for patchwork@mira.cbaines.net; Sat, 21 Sep 2019 17:13:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41353) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBmgl-0002yV-Id for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBmgk-0005vK-GT for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:07 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:52659) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iBmgk-0005vG-Dk for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:06 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iBmgk-0000OI-7y for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:06 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#37413] [PATCH v2 02/11] git: 'update-cached-checkout' avoids network access when unnecessary. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 21 Sep 2019 21:13:06 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37413 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 37413@debbugs.gnu.org Received: via spool by 37413-submit@debbugs.gnu.org id=B37413.15691003781396 (code B ref 37413); Sat, 21 Sep 2019 21:13:06 +0000 Received: (at 37413) by debbugs.gnu.org; 21 Sep 2019 21:12:58 +0000 Received: from localhost ([127.0.0.1]:33225 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iBmgb-0000MI-VF for submit@debbugs.gnu.org; Sat, 21 Sep 2019 17:12:58 -0400 Received: from eggs.gnu.org ([209.51.188.92]:32816) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iBmgV-0000Kv-Dx for 37413@debbugs.gnu.org; Sat, 21 Sep 2019 17:12:51 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:49539) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iBmgQ-0005ef-BW; Sat, 21 Sep 2019 17:12:46 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=53014 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iBmgP-00065A-TD; Sat, 21 Sep 2019 17:12:46 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 21 Sep 2019 23:12:19 +0200 Message-Id: <20190921211228.13096-3-ludo@gnu.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190921211228.13096-1-ludo@gnu.org> References: <87sgow0w7w.fsf@gnu.org> <20190921211228.13096-1-ludo@gnu.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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 * guix/git.scm (reference-available?): New procedure. (update-cached-checkout): Avoid call to 'remote-fetch' when REPOSITORY already contains REF. --- guix/git.scm | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/guix/git.scm b/guix/git.scm index de98fed40c..92a7353b5a 100644 --- a/guix/git.scm +++ b/guix/git.scm @@ -220,6 +220,21 @@ dynamic extent of EXP." (G_ "Support for submodules is missing; \ please upgrade Guile-Git.~%")))) +(define (reference-available? repository ref) + "Return true if REF, a reference such as '(commit . \"cabba9e\"), is +definitely available in REPOSITORY, false otherwise." + (match ref + (('commit . commit) + (catch 'git-error + (lambda () + (->bool (commit-lookup repository (string->oid commit)))) + (lambda (key error . rest) + (if (= GIT_ENOTFOUND (git-error-code error)) + #f + (apply throw key error rest))))) + (_ + #f))) + (define* (update-cached-checkout url #:key (ref '(branch . "master")) @@ -254,7 +269,8 @@ When RECURSIVE? is true, check out submodules as well, if any." (repository-open cache-directory) (clone* url cache-directory)))) ;; Only fetch remote if it has not been cloned just before. - (when cache-exists? + (when (and cache-exists? + (not (reference-available? repository ref))) (remote-fetch (remote-lookup repository "origin"))) (when recursive? (update-submodules repository #:log-port log-port)) From patchwork Sat Sep 21 21:12:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 15432 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 4200B17400; Sat, 21 Sep 2019 22:14:09 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id B1E29173FB for ; Sat, 21 Sep 2019 22:14:08 +0100 (BST) Received: from localhost ([::1]:43766 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBmhk-0003l8-9r for patchwork@mira.cbaines.net; Sat, 21 Sep 2019 17:14:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41379) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBmgn-00031u-Iv for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBmgl-0005vf-8e for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:09 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:52660) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iBmgl-0005vb-5N for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:07 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iBmgk-0000OP-Uf for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:06 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#37413] [PATCH v2 03/11] git: Add 'commit-difference'. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 21 Sep 2019 21:13:06 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37413 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 37413@debbugs.gnu.org Received: via spool by 37413-submit@debbugs.gnu.org id=B37413.15691003791411 (code B ref 37413); Sat, 21 Sep 2019 21:13:06 +0000 Received: (at 37413) by debbugs.gnu.org; 21 Sep 2019 21:12:59 +0000 Received: from localhost ([127.0.0.1]:33227 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iBmgc-0000MQ-Ck for submit@debbugs.gnu.org; Sat, 21 Sep 2019 17:12:59 -0400 Received: from eggs.gnu.org ([209.51.188.92]:32818) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iBmgW-0000Kz-Cr for 37413@debbugs.gnu.org; Sat, 21 Sep 2019 17:12:52 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:49540) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iBmgR-0005er-9c; Sat, 21 Sep 2019 17:12:47 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=53014 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iBmgQ-00065A-Nk; Sat, 21 Sep 2019 17:12:47 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 21 Sep 2019 23:12:20 +0200 Message-Id: <20190921211228.13096-4-ludo@gnu.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190921211228.13096-1-ludo@gnu.org> References: <87sgow0w7w.fsf@gnu.org> <20190921211228.13096-1-ludo@gnu.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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 * guix/git.scm (commit-closure, commit-difference): New procedures. * guix/tests/git.scm, tests/git.scm: New files. * Makefile.am (dist_noinst_DATA): Add guix/tests/git.scm. (SCM_TESTS): Add tests/git.scm. --- .dir-locals.el | 1 + Makefile.am | 6 ++- guix/git.scm | 40 +++++++++++++++++++ guix/tests/git.scm | 97 +++++++++++++++++++++++++++++++++++++++++++++ tests/git.scm | 99 ++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 242 insertions(+), 1 deletion(-) create mode 100644 guix/tests/git.scm create mode 100644 tests/git.scm diff --git a/.dir-locals.el b/.dir-locals.el index 228685a69f..22aac2c402 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -90,6 +90,7 @@ (eval . (put 'eventually 'scheme-indent-function 1)) (eval . (put 'call-with-progress-reporter 'scheme-indent-function 1)) + (eval . (put 'with-temporary-git-repository 'scheme-indent-function 2)) ;; This notably allows '(' in Paredit to not insert a space when the ;; preceding symbol is one of these. diff --git a/Makefile.am b/Makefile.am index f71ea77671..658f03bd54 100644 --- a/Makefile.am +++ b/Makefile.am @@ -307,7 +307,10 @@ STORE_MODULES = \ MODULES += $(STORE_MODULES) # Internal modules with test suite support. -dist_noinst_DATA = guix/tests.scm guix/tests/http.scm +dist_noinst_DATA = \ + guix/tests.scm \ + guix/tests/http.scm \ + guix/tests/git.scm # Auxiliary files for packages. AUX_FILES = \ @@ -391,6 +394,7 @@ SCM_TESTS = \ tests/file-systems.scm \ tests/gem.scm \ tests/gexp.scm \ + tests/git.scm \ tests/glob.scm \ tests/gnu-maintenance.scm \ tests/grafts.scm \ diff --git a/guix/git.scm b/guix/git.scm index 92a7353b5a..d7dddde3a7 100644 --- a/guix/git.scm +++ b/guix/git.scm @@ -28,6 +28,7 @@ #:use-module (guix utils) #:use-module (guix records) #:use-module (guix gexp) + #:use-module (guix sets) #:use-module (rnrs bytevectors) #:use-module (ice-9 match) #:use-module (srfi srfi-1) @@ -37,8 +38,10 @@ #:export (%repository-cache-directory honor-system-x509-certificates! + with-repository update-cached-checkout latest-repository-commit + commit-difference git-checkout git-checkout? @@ -339,6 +342,43 @@ Log progress and checkout info to LOG-PORT." (set-exception-printer! 'git-error print-git-error) + +;;; +;;; Commit difference. +;;; + +(define (commit-closure commit) + "Return the closure of COMMIT as a set." + (let loop ((commits (list commit)) + (visited (setq))) + (match commits + (() + visited) + ((head . tail) + (if (set-contains? visited head) + (loop tail visited) + (loop (append (commit-parents head) tail) + (set-insert head visited))))))) + +(define (commit-difference new old) + "Return the list of commits between NEW and OLD, where OLD is assumed to be +an ancestor of NEW. + +Essentially, this computes the set difference between the closure of NEW and +that of OLD." + (let loop ((commits (list new)) + (result '()) + (visited (commit-closure old))) + (match commits + (() + (reverse result)) + ((head . tail) + (if (set-contains? visited head) + (loop tail result visited) + (loop (append (commit-parents head) tail) + (cons head result) + (set-insert head visited))))))) + ;;; ;;; Checkouts. diff --git a/guix/tests/git.scm b/guix/tests/git.scm new file mode 100644 index 0000000000..52abe77c83 --- /dev/null +++ b/guix/tests/git.scm @@ -0,0 +1,97 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2019 Ludovic Courtès +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (guix tests git) + #:use-module (git) + #:use-module (guix utils) + #:use-module (guix build utils) + #:use-module (ice-9 match) + #:use-module (ice-9 control) + #:export (git-command + with-temporary-git-repository + find-commit)) + +(define git-command + (make-parameter "git")) + +(define (populate-git-repository directory directives) + "Initialize a new Git checkout and repository in DIRECTORY and apply +DIRECTIVES. Each element of DIRECTIVES is an sexp like: + + (add \"foo.txt\" \"hi!\") + +Return DIRECTORY on success." + + ;; Note: As of version 0.2.0, Guile-Git lacks the necessary bindings to do + ;; all this, so resort to the "git" command. + (define (git command . args) + (apply invoke (git-command) "-C" directory + command args)) + + (mkdir-p directory) + (git "init") + + (let loop ((directives directives)) + (match directives + (() + directory) + ((('add file contents) rest ...) + (let ((file (string-append directory "/" file))) + (mkdir-p (dirname file)) + (call-with-output-file file + (lambda (port) + (display contents port))) + (git "add" file) + (loop rest))) + ((('commit text) rest ...) + (git "commit" "-m" text) + (loop rest)) + ((('branch name) rest ...) + (git "branch" name) + (loop rest)) + ((('checkout branch) rest ...) + (git "checkout" branch) + (loop rest)) + ((('merge branch message) rest ...) + (git "merge" branch "-m" message) + (loop rest))))) + +(define (call-with-temporary-git-repository directives proc) + (call-with-temporary-directory + (lambda (directory) + (populate-git-repository directory directives) + (proc directory)))) + +(define-syntax-rule (with-temporary-git-repository directory + directives exp ...) + "Evaluate EXP in a context where DIRECTORY contains a checkout populated as +per DIRECTIVES." + (call-with-temporary-git-repository directives + (lambda (directory) + exp ...))) + +(define (find-commit repository message) + "Return the commit in REPOSITORY whose message includes MESSAGE, a string." + (let/ec return + (fold-commits (lambda (commit _) + (and (string-contains (commit-message commit) + message) + (return commit))) + #f + repository) + (error "commit not found" message))) diff --git a/tests/git.scm b/tests/git.scm new file mode 100644 index 0000000000..8ba10ece51 --- /dev/null +++ b/tests/git.scm @@ -0,0 +1,99 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2019 Ludovic Courtès +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (test-git) + #:use-module (git) + #:use-module (guix git) + #:use-module (guix tests git) + #:use-module (guix build utils) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-64)) + +;; Test the (guix git) tools. + +(test-begin "git") + +;; 'with-temporary-git-repository' relies on the 'git' command. +(unless (which (git-command)) (test-skip 1)) +(test-assert "commit-difference, linear history" + (with-temporary-git-repository directory + '((add "a.txt" "A") + (commit "first commit") + (add "b.txt" "B") + (commit "second commit") + (add "c.txt" "C") + (commit "third commit") + (add "d.txt" "D") + (commit "fourth commit")) + (with-repository directory repository + (let ((commit1 (find-commit repository "first")) + (commit2 (find-commit repository "second")) + (commit3 (find-commit repository "third")) + (commit4 (find-commit repository "fourth"))) + (and (lset= eq? (commit-difference commit4 commit1) + (list commit2 commit3 commit4)) + (lset= eq? (commit-difference commit4 commit2) + (list commit3 commit4)) + (equal? (commit-difference commit3 commit2) + (list commit3)) + + ;; COMMIT4 is not an ancestor of COMMIT1 so we should get the + ;; empty list. + (null? (commit-difference commit1 commit4))))))) + +(unless (which (git-command)) (test-skip 1)) +(test-assert "commit-difference, fork" + (with-temporary-git-repository directory + '((add "a.txt" "A") + (commit "first commit") + (branch "devel") + (checkout "devel") + (add "devel/1.txt" "1") + (commit "first devel commit") + (add "devel/2.txt" "2") + (commit "second devel commit") + (checkout "master") + (add "b.txt" "B") + (commit "second commit") + (add "c.txt" "C") + (commit "third commit") + (merge "devel" "merge") + (add "d.txt" "D") + (commit "fourth commit")) + (with-repository directory repository + (let ((master1 (find-commit repository "first commit")) + (master2 (find-commit repository "second commit")) + (master3 (find-commit repository "third commit")) + (master4 (find-commit repository "fourth commit")) + (devel1 (find-commit repository "first devel")) + (devel2 (find-commit repository "second devel")) + (merge (find-commit repository "merge"))) + (and (equal? (commit-difference master4 merge) + (list master4)) + (lset= eq? (commit-difference master3 master1) + (list master3 master2)) + (lset= eq? (commit-difference devel2 master1) + (list devel2 devel1)) + + ;; The merge occurred between MASTER2 and MASTER4 so here we + ;; expect to see all the commits from the "devel" branch in + ;; addition to those on "master". + (lset= eq? (commit-difference master4 master2) + (list master4 merge master3 devel1 devel2))))))) + +(test-end "git") From patchwork Sat Sep 21 21:12:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 15427 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 7E3C817400; Sat, 21 Sep 2019 22:13:46 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id DC5B7173FB for ; Sat, 21 Sep 2019 22:13:45 +0100 (BST) Received: from localhost ([::1]:43752 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBmhN-0003MB-5o for patchwork@mira.cbaines.net; Sat, 21 Sep 2019 17:13:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41408) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBmgo-00032v-Jd for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBmgl-0005w4-RX for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:10 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:52661) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iBmgl-0005vy-Nx for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:07 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iBmgl-0000OY-I9 for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:07 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#37413] [PATCH v2 04/11] channels: Add support for a news file. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 21 Sep 2019 21:13:07 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37413 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 37413@debbugs.gnu.org Received: via spool by 37413-submit@debbugs.gnu.org id=B37413.15691003801424 (code B ref 37413); Sat, 21 Sep 2019 21:13:07 +0000 Received: (at 37413) by debbugs.gnu.org; 21 Sep 2019 21:13:00 +0000 Received: from localhost ([127.0.0.1]:33230 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iBmgd-0000Mi-6Z for submit@debbugs.gnu.org; Sat, 21 Sep 2019 17:12:59 -0400 Received: from eggs.gnu.org ([209.51.188.92]:32820) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iBmgX-0000L2-7m for 37413@debbugs.gnu.org; Sat, 21 Sep 2019 17:12:53 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:49541) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iBmgS-0005f3-4j; Sat, 21 Sep 2019 17:12:48 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=53014 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iBmgR-00065A-Lp; Sat, 21 Sep 2019 17:12:47 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 21 Sep 2019 23:12:21 +0200 Message-Id: <20190921211228.13096-5-ludo@gnu.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190921211228.13096-1-ludo@gnu.org> References: <87sgow0w7w.fsf@gnu.org> <20190921211228.13096-1-ludo@gnu.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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 * guix/channels.scm ()[news-file]: New field. (read-channel-metadata): Set the 'news-file' field. (read-channel-metadata-from-source): Likewise. (, ): New record types. (sexp->channel-news-entry, read-channel-news) (channel-news-for-commit): New procedures. * guix/tests/git.scm (populate-git-repository): For 'add', allow CONTENTS to be a procedure. * tests/channels.scm ("channel-news, no news") ("channel-news, one entry"): New tests. * doc/guix.texi (Channels): Document it. --- doc/guix.texi | 62 +++++++++++++++++++++++ guix/channels.scm | 123 ++++++++++++++++++++++++++++++++++++++++++--- guix/tests/git.scm | 7 ++- tests/channels.scm | 99 ++++++++++++++++++++++++++++++++++++ 4 files changed, 282 insertions(+), 9 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index af1903f6ff..712c0811a5 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -3991,6 +3991,68 @@ add a meta-data file @file{.guix-channel} that contains: (directory "guix")) @end lisp +@cindex news, for channels +@subsection Writing Channel News + +Channel authors may occasionally want to communicate to their users +information about important changes in the channel. You'd send them all +an email, but that's not convenient. + +Instead, channels can provide a @dfn{news file}; when the channel users +run @command{guix pull}, that news file is automatically read and +@command{guix pull --news} can display the announcements that correspond +to the new commits that have been pulled, if any. + +To do that, channel authors must first declare the name of the news file +in their @file{.guix-channel} file: + +@lisp +(channel + (version 0) + (news-file "etc/news.txt")) +@end lisp + +The news file itself, @file{etc/news.txt} in this example, must look +something like this: + +@lisp +(channel-news + (version 0) + (entry (commit "d894ab8e9bfabcefa6c49d9ba2e834dd5a73a300") + (title (en "Fixed terrible bug") + (fr "Oh la la")) + (body (en "@@emph@{Good news@}! It's fixed!") + (eo "Certe ĝi pli bone funkcias nun!"))) + (entry (commit "bdcabe815cd28144a2d2b4bc3c5057b051fa9906") + (title (en "Added a great package") + (ca "Què vol dir guix?")) + (body (en "Don't miss the @@code@{hello@} package!")))) +@end lisp + +The file consists of a list of @dfn{news entries}. Each entry is +associated with a commit: it describes changes made in this commit, +possibly in preceding commits as well. Users see entries only the first +time they obtain the commit the entry refers to. + +The @code{title} field should be a one-line summary while @code{body} +can be arbitrary long, and both can contain Texinfo markup +(@pxref{Overview,,, texinfo, GNU Texinfo}). Both the title and body are +a list of language tag/message tuples, which allows @command{guix pull} +to display news in the language that corresponds to the user's locale. + +If you want to translate news using a gettext-based workflow, you can +extract translatable strings with @command{xgettext} (@pxref{xgettext +Invocation,,, gettext, GNU Gettext Utilities}). For example, assuming +you write news entries in English first, the command below creates a PO +file containing the strings to translate: + +@example +xgettext -o news.po -l scheme -ken etc/news.scm +@end example + +To sum up, yes, you could use your channel as a blog. But beware, this +is @emph{not quite} what your users might expect. + @subsection Replicating Guix @cindex pinning, channels diff --git a/guix/channels.scm b/guix/channels.scm index ebb2cacbc7..0dadba616f 100644 --- a/guix/channels.scm +++ b/guix/channels.scm @@ -19,6 +19,7 @@ ;;; along with GNU Guix. If not, see . (define-module (guix channels) + #:use-module (git) #:use-module (guix git) #:use-module (guix records) #:use-module (guix gexp) @@ -29,6 +30,7 @@ #:use-module (guix derivations) #:use-module (guix combinators) #:use-module (guix diagnostics) + #:use-module (guix sets) #:use-module (guix store) #:use-module (guix i18n) #:use-module ((guix utils) @@ -67,7 +69,14 @@ %channel-profile-hooks channel-instances->derivation - profile-channels)) + profile-channels + + channel-news-entry? + channel-news-entry-commit + channel-news-entry-title + channel-news-entry-body + + channel-news-for-commit)) ;;; Commentary: ;;; @@ -110,10 +119,11 @@ (checkout channel-instance-checkout)) (define-record-type - (channel-metadata directory dependencies) + (channel-metadata directory dependencies news-file) channel-metadata? (directory channel-metadata-directory) ;string with leading slash - (dependencies channel-metadata-dependencies)) ;list of + (dependencies channel-metadata-dependencies) ;list of + (news-file channel-metadata-news-file)) ;string | #f (define (channel-reference channel) "Return the \"reference\" for CHANNEL, an sexp suitable for @@ -129,12 +139,13 @@ if valid metadata could not be read from PORT." (match (read port) (('channel ('version 0) properties ...) (let ((directory (and=> (assoc-ref properties 'directory) first)) - (dependencies (or (assoc-ref properties 'dependencies) '()))) + (dependencies (or (assoc-ref properties 'dependencies) '())) + (news-file (and=> (assoc-ref properties 'news-file) first))) (channel-metadata - (cond ((not directory) "/") + (cond ((not directory) "/") ;directory ((string-prefix? "/" directory) directory) (else (string-append "/" directory))) - (map (lambda (item) + (map (lambda (item) ;dependencies (let ((get (lambda* (key #:optional default) (or (and=> (assoc-ref item key) first) default)))) (and-let* ((name (get 'name)) @@ -145,7 +156,8 @@ if valid metadata could not be read from PORT." (branch branch) (url url) (commit (get 'commit)))))) - dependencies)))) + dependencies) + news-file))) ;news-file ((and ('channel ('version version) _ ...) sexp) (raise (condition (&message (message "unsupported '.guix-channel' version")) @@ -169,7 +181,7 @@ doesn't exist." read-channel-metadata)) (lambda args (if (= ENOENT (system-error-errno args)) - (channel-metadata "/" '()) + (channel-metadata "/" '() #f) (apply throw args))))) (define (channel-instance-metadata instance) @@ -560,3 +572,98 @@ PROFILE is not a profile created by 'guix pull', return the empty list." ;; Show most recently installed packages last. (reverse (manifest-entries (profile-manifest profile))))) + + +;;; +;;; News. +;;; + +;; Channel news. +(define-record-type + (channel-news entries) + channel-news? + (entries channel-news-entries)) ;list of + +;; News entry, associated with a specific commit of the channel. +(define-record-type + (channel-news-entry commit title body) + channel-news-entry? + (commit channel-news-entry-commit) ;hex string + (title channel-news-entry-title) ;list of language tag/string pairs + (body channel-news-entry-body)) ;list of language tag/string pairs + +(define (sexp->channel-news-entry entry) + "Return the record corresponding to ENTRY, an sexp." + (define (pair language message) + (cons (symbol->string language) message)) + + (match entry + (('entry ('commit commit) + ('title ((? symbol? title-tags) (? string? titles)) ...) + ('body ((? symbol? body-tags) (? string? bodies)) ...) + _ ...) + (channel-news-entry commit + (map pair title-tags titles) + (map pair body-tags bodies))) + (_ + (raise (condition + (&message (message "invalid channel news entry")) + (&error-location + (location (source-properties->location + (source-properties entry))))))))) + +(define (read-channel-news port) + "Read a channel news feed from PORT and return it as a +record." + (match (false-if-exception (read port)) + (('channel-news ('version 0) entries ...) + (channel-news (map sexp->channel-news-entry entries))) + (('channel-news ('version version) _ ...) + ;; This is an unsupported version from the future. There's nothing wrong + ;; with that (the user may simply need to upgrade the 'guix' channel to + ;; be able to read it), so silently ignore it. + (channel-news '())) + (#f + (raise (condition + (&message (message "syntactically invalid channel news file"))))) + (sexp + (raise (condition + (&message (message "invalid channel news file")) + (&error-location + (location (source-properties->location + (source-properties sexp))))))))) + +(define* (channel-news-for-commit channel new #:optional old) + "Return a list of for CHANNEL between commits OLD and +NEW. When OLD is omitted or is #f, return all the news entries of CHANNEL." + (catch 'git-error + (lambda () + (let* ((checkout (update-cached-checkout (channel-url channel) + #:ref `(commit . ,new))) + (metadata (read-channel-metadata-from-source checkout)) + (news-file (channel-metadata-news-file metadata)) + (news-file (and news-file + (string-append checkout "/" news-file)))) + (if (and news-file (file-exists? news-file)) + (let ((entries (channel-news-entries (call-with-input-file news-file + read-channel-news)))) + (if old + (with-repository checkout repository + (let* ((new (commit-lookup repository (string->oid new))) + (old (commit-lookup repository (string->oid old))) + (commits (list->set + (map (compose oid->string commit-id) + (commit-difference new old))))) + (filter (lambda (entry) + (set-contains? commits + (channel-news-entry-commit entry))) + entries))) + entries)) + '()))) + (lambda (key error . rest) + ;; If commit NEW or commit OLD cannot be found, then something must be + ;; wrong (for example, the history of CHANNEL was rewritten and these + ;; commits no longer exist upstream), so quietly return the empty list. + (if (= GIT_ENOTFOUND (git-error-code error)) + '() + (apply throw key error rest))))) diff --git a/guix/tests/git.scm b/guix/tests/git.scm index 52abe77c83..9d5b1ae321 100644 --- a/guix/tests/git.scm +++ b/guix/tests/git.scm @@ -18,6 +18,7 @@ (define-module (guix tests git) #:use-module (git) + #:use-module ((guix git) #:select (with-repository)) #:use-module (guix utils) #:use-module (guix build utils) #:use-module (ice-9 match) @@ -55,7 +56,11 @@ Return DIRECTORY on success." (mkdir-p (dirname file)) (call-with-output-file file (lambda (port) - (display contents port))) + (display (if (string? contents) + contents + (with-repository directory repository + (contents repository))) + port))) (git "add" file) (loop rest))) ((('commit text) rest ...) diff --git a/tests/channels.scm b/tests/channels.scm index e83b5437d3..58101bcb72 100644 --- a/tests/channels.scm +++ b/tests/channels.scm @@ -28,6 +28,10 @@ #:use-module (guix gexp) #:use-module ((guix utils) #:select (error-location? error-location location-line)) + #:use-module ((guix build utils) #:select (which)) + #:use-module (git) + #:use-module (guix git) + #:use-module (guix tests git) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (srfi srfi-34) @@ -246,4 +250,99 @@ (depends? drv3 (list drv2 drv0) (list)))))))) +(unless (which (git-command)) (test-skip 1)) +(test-equal "channel-news, no news" + '() + (with-temporary-git-repository directory + '((add "a.txt" "A") + (commit "the commit")) + (with-repository directory repository + (let ((channel (channel (url (string-append "file://" directory)) + (name 'foo))) + (latest (reference-name->oid repository "HEAD"))) + (channel-news-for-commit channel (oid->string latest)))))) + +(unless (which (git-command)) (test-skip 1)) +(test-assert "channel-news, one entry" + (with-temporary-git-repository directory + `((add ".guix-channel" + ,(object->string + '(channel (version 0) + (news-file "news.scm")))) + (commit "first commit") + (add "src/a.txt" "A") + (commit "second commit") + (add "news.scm" + ,(lambda (repository) + (let ((previous + (reference-name->oid repository "HEAD"))) + (object->string + `(channel-news + (version 0) + (entry (commit ,(oid->string previous)) + (title (en "New file!") + (eo "Nova dosiero!")) + (body (en "Yeah, a.txt.")))))))) + (commit "third commit") + (add "src/b.txt" "B") + (commit "fourth commit") + (add "news.scm" + ,(lambda (repository) + (let ((second + (commit-id + (find-commit repository "second commit"))) + (previous + (reference-name->oid repository "HEAD"))) + (object->string + `(channel-news + (version 0) + (entry (commit ,(oid->string previous)) + (title (en "Another file!")) + (body (en "Yeah, b.txt."))) + (entry (commit ,(oid->string second)) + (title (en "Old news.") + (eo "Malnovaĵoj.")) + (body (en "For a.txt")))))))) + (commit "fifth commit")) + (with-repository directory repository + (define (find-commit* message) + (oid->string (commit-id (find-commit repository message)))) + + (let ((channel (channel (url (string-append "file://" directory)) + (name 'foo))) + (commit1 (find-commit* "first commit")) + (commit2 (find-commit* "second commit")) + (commit3 (find-commit* "third commit")) + (commit4 (find-commit* "fourth commit")) + (commit5 (find-commit* "fifth commit"))) + ;; First try fetching all the news up to a given commit. + (and (null? (channel-news-for-commit channel commit2)) + (lset= string=? + (map channel-news-entry-commit + (channel-news-for-commit channel commit5)) + (list commit2 commit4)) + (lset= equal? + (map channel-news-entry-title + (channel-news-for-commit channel commit5)) + '((("en" . "Another file!")) + (("en" . "Old news.") ("eo" . "Malnovaĵoj.")))) + (lset= string=? + (map channel-news-entry-commit + (channel-news-for-commit channel commit3)) + (list commit2)) + + ;; Now fetch news entries that apply to a commit range. + (lset= string=? + (map channel-news-entry-commit + (channel-news-for-commit channel commit3 commit1)) + (list commit2)) + (lset= string=? + (map channel-news-entry-commit + (channel-news-for-commit channel commit5 commit3)) + (list commit4)) + (lset= string=? + (map channel-news-entry-commit + (channel-news-for-commit channel commit5 commit1)) + (list commit4 commit2))))))) + (test-end "channels") From patchwork Sat Sep 21 21:12:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 15424 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 6D3BE17400; Sat, 21 Sep 2019 22:13:37 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 127C9173FB for ; Sat, 21 Sep 2019 22:13:37 +0100 (BST) Received: from localhost ([::1]:43744 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBmhE-00036z-6j for patchwork@mira.cbaines.net; Sat, 21 Sep 2019 17:13:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41395) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBmgo-00032Q-31 for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBmgm-0005wY-AE for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:10 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:52662) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iBmgm-0005wT-7G for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:08 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iBmgm-0000Of-1i for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:08 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#37413] [PATCH v2 05/11] channels: Allow news entries to refer to a tag. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 21 Sep 2019 21:13:08 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37413 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 37413@debbugs.gnu.org Received: via spool by 37413-submit@debbugs.gnu.org id=B37413.15691003801430 (code B ref 37413); Sat, 21 Sep 2019 21:13:08 +0000 Received: (at 37413) by debbugs.gnu.org; 21 Sep 2019 21:13:00 +0000 Received: from localhost ([127.0.0.1]:33233 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iBmgd-0000Mv-Uj for submit@debbugs.gnu.org; Sat, 21 Sep 2019 17:13:00 -0400 Received: from eggs.gnu.org ([209.51.188.92]:32822) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iBmgY-0000L4-2O for 37413@debbugs.gnu.org; Sat, 21 Sep 2019 17:12:54 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:49542) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iBmgS-0005fE-W6; Sat, 21 Sep 2019 17:12:49 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=53014 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iBmgS-00065A-Gv; Sat, 21 Sep 2019 17:12:48 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 21 Sep 2019 23:12:22 +0200 Message-Id: <20190921211228.13096-6-ludo@gnu.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190921211228.13096-1-ludo@gnu.org> References: <87sgow0w7w.fsf@gnu.org> <20190921211228.13096-1-ludo@gnu.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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 Suggested by Ricardo Wurmus . * guix/channels.scm ()[tag]: New field. (sexp->channel-news-entry): Accept either 'commit' or 'tag' in 'entry' forms. (resolve-channel-news-entry-tag): New procedure. (channel-news-for-commit): Move 'with-repository' form one level higher. Call 'resolve-channel-news-entry-tag' on all the news entries. * guix/tests/git.scm (populate-git-repository): Add clause for 'tag'. * tests/channels.scm ("channel-news, one entry"): Create a tag and add an entry with a tag. Check that the tag is resolved and also visible in the record. * doc/guix.texi (Channels): Mention tags in news entries. --- doc/guix.texi | 8 ++++---- guix/channels.scm | 42 ++++++++++++++++++++++++++++++++---------- guix/tests/git.scm | 3 +++ tests/channels.scm | 9 +++++++-- 4 files changed, 46 insertions(+), 16 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 712c0811a5..5addb1f5ee 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -4018,7 +4018,7 @@ something like this: @lisp (channel-news (version 0) - (entry (commit "d894ab8e9bfabcefa6c49d9ba2e834dd5a73a300") + (entry (tag "the-bug-fix") (title (en "Fixed terrible bug") (fr "Oh la la")) (body (en "@@emph@{Good news@}! It's fixed!") @@ -4030,9 +4030,9 @@ something like this: @end lisp The file consists of a list of @dfn{news entries}. Each entry is -associated with a commit: it describes changes made in this commit, -possibly in preceding commits as well. Users see entries only the first -time they obtain the commit the entry refers to. +associated with a commit or tag: it describes changes made in this +commit, possibly in preceding commits as well. Users see entries only +the first time they obtain the commit the entry refers to. The @code{title} field should be a one-line summary while @code{body} can be arbitrary long, and both can contain Texinfo markup diff --git a/guix/channels.scm b/guix/channels.scm index 0dadba616f..4e6e7090ac 100644 --- a/guix/channels.scm +++ b/guix/channels.scm @@ -40,6 +40,7 @@ #:use-module (srfi srfi-2) #:use-module (srfi srfi-9) #:use-module (srfi srfi-11) + #:use-module (srfi srfi-26) #:use-module (srfi srfi-34) #:use-module (srfi srfi-35) #:autoload (guix self) (whole-package make-config.scm) @@ -73,6 +74,7 @@ channel-news-entry? channel-news-entry-commit + channel-news-entry-tag channel-news-entry-title channel-news-entry-body @@ -586,9 +588,10 @@ PROFILE is not a profile created by 'guix pull', return the empty list." ;; News entry, associated with a specific commit of the channel. (define-record-type - (channel-news-entry commit title body) + (channel-news-entry commit tag title body) channel-news-entry? - (commit channel-news-entry-commit) ;hex string + (commit channel-news-entry-commit) ;hex string | #f + (tag channel-news-entry-tag) ;#f | string (title channel-news-entry-title) ;list of language tag/string pairs (body channel-news-entry-body)) ;list of language tag/string pairs @@ -598,11 +601,12 @@ PROFILE is not a profile created by 'guix pull', return the empty list." (cons (symbol->string language) message)) (match entry - (('entry ('commit commit) + (('entry ((and (or 'commit 'tag) type) commit-or-tag) ('title ((? symbol? title-tags) (? string? titles)) ...) ('body ((? symbol? body-tags) (? string? bodies)) ...) _ ...) - (channel-news-entry commit + (channel-news-entry (and (eq? type 'commit) commit-or-tag) + (and (eq? type 'tag) commit-or-tag) (map pair title-tags titles) (map pair body-tags bodies))) (_ @@ -633,6 +637,20 @@ record." (location (source-properties->location (source-properties sexp))))))))) +(define (resolve-channel-news-entry-tag repository entry) + "If ENTRY has its 'commit' field set, return ENTRY. Otherwise, lookup +ENTRY's 'tag' in REPOSITORY and return ENTRY with its 'commit' field set to +the field its 'tag' refers to. A 'git-error' exception is raised if the tag +cannot be found." + (if (channel-news-entry-commit entry) + entry + (let* ((tag (channel-news-entry-tag entry)) + (reference (string-append "refs/tags/" tag)) + (oid (reference-name->oid repository reference))) + (channel-news-entry (oid->string oid) tag + (channel-news-entry-title entry) + (channel-news-entry-body entry))))) + (define* (channel-news-for-commit channel new #:optional old) "Return a list of for CHANNEL between commits OLD and NEW. When OLD is omitted or is #f, return all the news entries of CHANNEL." @@ -645,10 +663,14 @@ NEW. When OLD is omitted or is #f, return all the news entries of CHANNEL." (news-file (and news-file (string-append checkout "/" news-file)))) (if (and news-file (file-exists? news-file)) - (let ((entries (channel-news-entries (call-with-input-file news-file - read-channel-news)))) - (if old - (with-repository checkout repository + (with-repository checkout repository + (let* ((news (call-with-input-file news-file + read-channel-news)) + (entries (map (lambda (entry) + (resolve-channel-news-entry-tag repository + entry)) + (channel-news-entries news)))) + (if old (let* ((new (commit-lookup repository (string->oid new))) (old (commit-lookup repository (string->oid old))) (commits (list->set @@ -657,8 +679,8 @@ NEW. When OLD is omitted or is #f, return all the news entries of CHANNEL." (filter (lambda (entry) (set-contains? commits (channel-news-entry-commit entry))) - entries))) - entries)) + entries)) + entries))) '()))) (lambda (key error . rest) ;; If commit NEW or commit OLD cannot be found, then something must be diff --git a/guix/tests/git.scm b/guix/tests/git.scm index 9d5b1ae321..21573ac14e 100644 --- a/guix/tests/git.scm +++ b/guix/tests/git.scm @@ -66,6 +66,9 @@ Return DIRECTORY on success." ((('commit text) rest ...) (git "commit" "-m" text) (loop rest)) + ((('tag name) rest ...) + (git "tag" name) + (loop rest)) ((('branch name) rest ...) (git "branch" name) (loop rest)) diff --git a/tests/channels.scm b/tests/channels.scm index 58101bcb72..f5a7955483 100644 --- a/tests/channels.scm +++ b/tests/channels.scm @@ -272,6 +272,7 @@ (commit "first commit") (add "src/a.txt" "A") (commit "second commit") + (tag "tag-for-first-news-entry") (add "news.scm" ,(lambda (repository) (let ((previous @@ -299,7 +300,7 @@ (entry (commit ,(oid->string previous)) (title (en "Another file!")) (body (en "Yeah, b.txt."))) - (entry (commit ,(oid->string second)) + (entry (tag "tag-for-first-news-entry") (title (en "Old news.") (eo "Malnovaĵoj.")) (body (en "For a.txt")))))))) @@ -343,6 +344,10 @@ (lset= string=? (map channel-news-entry-commit (channel-news-for-commit channel commit5 commit1)) - (list commit4 commit2))))))) + (list commit4 commit2)) + (lset= equal? + (map channel-news-entry-tag + (channel-news-for-commit channel commit5 commit1)) + '(#f "tag-for-first-news-entry"))))))) (test-end "channels") From patchwork Sat Sep 21 21:12:23 2019 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: 15423 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 B4E7F17400; Sat, 21 Sep 2019 22:13:35 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 77900173FB for ; Sat, 21 Sep 2019 22:13:35 +0100 (BST) Received: from localhost ([::1]:43742 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBmhC-00035L-Ff for patchwork@mira.cbaines.net; Sat, 21 Sep 2019 17:13:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41406) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBmgo-00032t-K7 for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBmgn-000608-BQ for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:10 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:52664) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iBmgn-0005zf-7I for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:09 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iBmgn-0000Ou-1L for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:09 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#37413] [PATCH v2 06/11] ui: Add 'current-message-language'. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 21 Sep 2019 21:13:08 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37413 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 37413@debbugs.gnu.org Received: via spool by 37413-submit@debbugs.gnu.org id=B37413.15691003811446 (code B ref 37413); Sat, 21 Sep 2019 21:13:08 +0000 Received: (at 37413) by debbugs.gnu.org; 21 Sep 2019 21:13:01 +0000 Received: from localhost ([127.0.0.1]:33237 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iBmge-0000NA-SH for submit@debbugs.gnu.org; Sat, 21 Sep 2019 17:13:01 -0400 Received: from eggs.gnu.org ([209.51.188.92]:32823) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iBmgY-0000L6-Tu for 37413@debbugs.gnu.org; Sat, 21 Sep 2019 17:12:57 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:49543) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iBmgT-0005fN-Rd; Sat, 21 Sep 2019 17:12:49 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=53014 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iBmgT-00065A-C6; Sat, 21 Sep 2019 17:12:49 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 21 Sep 2019 23:12:23 +0200 Message-Id: <20190921211228.13096-7-ludo@gnu.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190921211228.13096-1-ludo@gnu.org> References: <87sgow0w7w.fsf@gnu.org> <20190921211228.13096-1-ludo@gnu.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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 * guix/ui.scm (%default-message-language): New variable. (current-message-language): New procedure. --- guix/ui.scm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/guix/ui.scm b/guix/ui.scm index 4be31db047..069d542131 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -121,6 +121,10 @@ roll-back* switch-to-generation* delete-generation* + + %default-message-language + current-message-language + run-guix-command run-guix guix-main)) @@ -428,6 +432,20 @@ exiting. ARGS is the list of arguments received by the 'throw' handler." report them in a user-friendly way." (call-with-unbound-variable-handling (lambda () exp ...))) +(define %default-message-language + ;; Default language to use for messages. + (make-parameter "en")) + +(define (current-message-language) + "Return the language used for messages according to the current locale. +Return %DEFAULT-MESSAGE-LANGUAGE if that information could not be obtained. The +result is an ISO-639-2 language code such as \"ar\", without the territory +part." + (let ((locale (setlocale LC_MESSAGES))) + (match (string-index locale #\_) + (#f locale) + (index (string-take locale index))))) + (define (install-locale) "Install the current locale settings." (catch 'system-error From patchwork Sat Sep 21 21:12:24 2019 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: 15431 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 9227417400; Sat, 21 Sep 2019 22:14:04 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 45E8B173FB for ; Sat, 21 Sep 2019 22:14:04 +0100 (BST) Received: from localhost ([::1]:43764 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBmhf-0003dA-SQ for patchwork@mira.cbaines.net; Sat, 21 Sep 2019 17:14:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41401) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBmgo-00032g-9u for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBmgm-0005yi-Tu for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:10 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:52663) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iBmgm-0005xl-NZ for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:08 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iBmgm-0000On-G0 for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:08 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#37413] [PATCH v2 07/11] pull: Display channel news. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 21 Sep 2019 21:13:08 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37413 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 37413@debbugs.gnu.org Received: via spool by 37413-submit@debbugs.gnu.org id=B37413.15691003801439 (code B ref 37413); Sat, 21 Sep 2019 21:13:08 +0000 Received: (at 37413) by debbugs.gnu.org; 21 Sep 2019 21:13:00 +0000 Received: from localhost ([127.0.0.1]:33235 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iBmge-0000N6-F6 for submit@debbugs.gnu.org; Sat, 21 Sep 2019 17:13:00 -0400 Received: from eggs.gnu.org ([209.51.188.92]:32826) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iBmgZ-0000LF-Ou for 37413@debbugs.gnu.org; Sat, 21 Sep 2019 17:12:57 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:49544) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iBmgU-0005fW-MU; Sat, 21 Sep 2019 17:12:50 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=53014 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iBmgU-00065A-7b; Sat, 21 Sep 2019 17:12:50 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 21 Sep 2019 23:12:24 +0200 Message-Id: <20190921211228.13096-8-ludo@gnu.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190921211228.13096-1-ludo@gnu.org> References: <87sgow0w7w.fsf@gnu.org> <20190921211228.13096-1-ludo@gnu.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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 * guix/scripts/pull.scm (display-news-entry) (display-channel-specific-news): New procedures. (display-channel-news): Call it. (display-new/upgraded-packages): Adjust hint message. * doc/guix.texi (Invoking guix pull): Mention it. --- doc/guix.texi | 11 +++++--- guix/scripts/pull.scm | 61 ++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 65 insertions(+), 7 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 5addb1f5ee..50adce4dd3 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -3720,13 +3720,16 @@ Read the list of channels from @var{file} instead of evaluates to a list of channel objects. @xref{Channels}, for more information. +@cindex channel news @item --news @itemx -N -Display the list of packages added or upgraded since the previous generation. +Display the list of packages added or upgraded since the previous +generation, as well as, occasionally, news written by channel authors +for their users (@pxref{Channels, Writing Channel News}). -This is the same information as displayed upon @command{guix pull} completion, -but without ellipses; it is also similar to the output of @command{guix pull --l} for the last generation (see below). +The package information is the same as displayed upon @command{guix +pull} completion, but without ellipses; it is also similar to the output +of @command{guix pull -l} for the last generation (see below). @item --list-generations[=@var{pattern}] @itemx -l [@var{pattern}] diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm index 4091f926ac..85291c3745 100644 --- a/guix/scripts/pull.scm +++ b/guix/scripts/pull.scm @@ -19,6 +19,7 @@ (define-module (guix scripts pull) #:use-module (guix ui) + #:use-module (guix colors) #:use-module (guix utils) #:use-module ((guix status) #:select (with-status-verbosity)) #:use-module (guix scripts) @@ -229,6 +230,48 @@ purposes." ;; Assume that the URL matters less than the name. (eq? (channel-name channel1) (channel-name channel2))) +(define (display-news-entry entry language port) + "Display ENTRY, a , in LANGUAGE, a language code, to +PORT." + (let ((title (channel-news-entry-title entry)) + (body (channel-news-entry-body entry))) + (format port " ~a~%" + (highlight + (string-trim-right + (texi->plain-text (or (assoc-ref title language) + (assoc-ref title (%default-message-language)) + ""))))) + (format port (G_ " commit ~a~%") + (channel-news-entry-commit entry)) + (newline port) + (format port " ~a~%" + (indented-string + (parameterize ((%text-width (- (%text-width) 4))) + (string-trim-right + (texi->plain-text (or (assoc-ref body language) + (assoc-ref body (%default-message-language)) + "")))) + 4)))) + +(define* (display-channel-specific-news new old + #:key (port (current-output-port))) + "Display channel news applicable the commits between OLD and NEW, where OLD +and NEW are records with a proper 'commit' field." + (let ((channel new) + (old (channel-commit old)) + (new (channel-commit new))) + (when (and old new) + (let ((language (current-message-language))) + (match (channel-news-for-commit channel new old) + (() ;no news is good news + #t) + ((entries ...) + (newline port) + (format port (G_ "News for channel '~a'~%") + (channel-name channel)) + (for-each (cut display-news-entry <> language port) entries) + (newline port))))))) + (define (display-channel-news profile) "Display new about the channels of PROFILE " (define previous @@ -259,7 +302,20 @@ purposes." (N_ " ~*One channel removed:~%" " ~a channels removed:~%" count) count) - (for-each display-channel removed))))))))) + (for-each display-channel removed)))) + + ;; Display channel-specific news for those channels that were + ;; here before and are still around afterwards. + (for-each (match-lambda + ((new old) + (display-channel-specific-news new old))) + (filter-map (lambda (new) + (define old + (find (cut channel=? new <>) + old-channels)) + + (and old (list new old))) + new-channels))))))) (define (display-news profile) ;; Display profile news, with the understanding that this process represents @@ -534,8 +590,7 @@ display long package lists that would fill the user's screen." (when (and concise? (or (> new-count concise/max-item-count) (> upgraded-count concise/max-item-count))) - (display-hint (G_ "Run @command{guix pull --news} to view the complete -list of package changes."))))) + (display-hint (G_ "Run @command{guix pull --news} to read all the news."))))) (define (display-profile-content-diff profile gen1 gen2) "Display the changes in PROFILE GEN2 compared to generation GEN1." From patchwork Sat Sep 21 21:12:25 2019 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: 15433 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 7DC9017400; Sat, 21 Sep 2019 22:14:13 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 453BB173FB for ; Sat, 21 Sep 2019 22:14:13 +0100 (BST) Received: from localhost ([::1]:43768 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBmho-0003s2-Qp for patchwork@mira.cbaines.net; Sat, 21 Sep 2019 17:14:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41414) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBmgp-00033l-23 for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBmgn-00060m-Rd for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:10 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:52665) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iBmgn-00060f-Ox for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:09 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iBmgn-0000P2-IU for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:09 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#37413] [PATCH v2 08/11] pull: '-l' displays channel news. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 21 Sep 2019 21:13:09 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37413 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 37413@debbugs.gnu.org Received: via spool by 37413-submit@debbugs.gnu.org id=B37413.15691003811454 (code B ref 37413); Sat, 21 Sep 2019 21:13:09 +0000 Received: (at 37413) by debbugs.gnu.org; 21 Sep 2019 21:13:01 +0000 Received: from localhost ([127.0.0.1]:33239 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iBmgf-0000NH-4q for submit@debbugs.gnu.org; Sat, 21 Sep 2019 17:13:01 -0400 Received: from eggs.gnu.org ([209.51.188.92]:32828) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iBmga-0000LL-K0 for 37413@debbugs.gnu.org; Sat, 21 Sep 2019 17:12:57 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:49545) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iBmgV-0005fj-HN; Sat, 21 Sep 2019 17:12:51 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=53014 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iBmgV-00065A-2T; Sat, 21 Sep 2019 17:12:51 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 21 Sep 2019 23:12:25 +0200 Message-Id: <20190921211228.13096-9-ludo@gnu.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190921211228.13096-1-ludo@gnu.org> References: <87sgow0w7w.fsf@gnu.org> <20190921211228.13096-1-ludo@gnu.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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 * guix/scripts/pull.scm (display-channel-news): Make 'previous' a parameter. (process-query)[list-generations]: Call 'display-channel-news'. --- guix/scripts/pull.scm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm index 85291c3745..4a4756dc6e 100644 --- a/guix/scripts/pull.scm +++ b/guix/scripts/pull.scm @@ -272,12 +272,12 @@ and NEW are records with a proper 'commit' field." (for-each (cut display-news-entry <> language port) entries) (newline port))))))) -(define (display-channel-news profile) - "Display new about the channels of PROFILE " - (define previous - (and=> (relative-generation profile -1) - (cut generation-file-name profile <>))) - +(define* (display-channel-news profile + #:optional + (previous + (and=> (relative-generation profile -1) + (cut generation-file-name profile <>)))) + "Display news about the channels of PROFILE compared to PREVIOUS." (when previous (let ((old-channels (profile-channels previous)) (new-channels (profile-channels profile))) @@ -614,6 +614,8 @@ display long package lists that would fill the user's screen." ((first second rest ...) (display-profile-content-diff profile first second) + (display-channel-news (generation-file-name profile second) + (generation-file-name profile first)) (loop (cons second rest))) ((_) #t) (() #t)))))) From patchwork Sat Sep 21 21:12:26 2019 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: 15428 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 12F0D17400; Sat, 21 Sep 2019 22:13:48 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id B1C4E173FB for ; Sat, 21 Sep 2019 22:13:47 +0100 (BST) Received: from localhost ([::1]:43758 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBmhP-0003Pz-0E for patchwork@mira.cbaines.net; Sat, 21 Sep 2019 17:13:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41456) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBmgq-00035l-Vl for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBmgo-00061c-K4 for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:12 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:52666) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iBmgo-00061L-Cj for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:10 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iBmgo-0000P9-3t for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:10 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#37413] [PATCH v2 09/11] pull: Display news titles directly upon 'pull'. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 21 Sep 2019 21:13:10 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37413 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 37413@debbugs.gnu.org Received: via spool by 37413-submit@debbugs.gnu.org id=B37413.15691003821469 (code B ref 37413); Sat, 21 Sep 2019 21:13:10 +0000 Received: (at 37413) by debbugs.gnu.org; 21 Sep 2019 21:13:02 +0000 Received: from localhost ([127.0.0.1]:33241 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iBmgf-0000NO-F3 for submit@debbugs.gnu.org; Sat, 21 Sep 2019 17:13:02 -0400 Received: from eggs.gnu.org ([209.51.188.92]:32830) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iBmgb-0000LZ-H2 for 37413@debbugs.gnu.org; Sat, 21 Sep 2019 17:12:58 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:49546) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iBmgW-0005iC-Du; Sat, 21 Sep 2019 17:12:52 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=53014 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iBmgV-00065A-TX; Sat, 21 Sep 2019 17:12:52 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 21 Sep 2019 23:12:26 +0200 Message-Id: <20190921211228.13096-10-ludo@gnu.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190921211228.13096-1-ludo@gnu.org> References: <87sgow0w7w.fsf@gnu.org> <20190921211228.13096-1-ludo@gnu.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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 * guix/scripts/pull.scm (display-profile-news): Return true when there's more to display. (display-news-entry-title): New procedure. (display-news-entry): Use it. (display-channel-specific-news): Return true when there's more to display. (display-channel-news-headlines): New procedure. (build-and-install): Call it. When 'display-channel-news-headlines' or 'display-profile-news' returns #t, print a hint to run "pull --news". (display-new/upgraded-packages): Return true when there's more to display. --- guix/scripts/pull.scm | 112 ++++++++++++++++++++++++++++++------------ 1 file changed, 81 insertions(+), 31 deletions(-) diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm index 4a4756dc6e..a7fd36fffc 100644 --- a/guix/scripts/pull.scm +++ b/guix/scripts/pull.scm @@ -189,7 +189,7 @@ Download and deploy the latest version of Guix.\n")) current-is-newer?) "Display what's up in PROFILE--new packages, and all that. If CURRENT-IS-NEWER? is true, assume that the current process represents the -newest generation of PROFILE." +newest generation of PROFILE. Return true when there's more info to display." (match (memv (generation-number profile) (reverse (profile-generations profile))) ((current previous _ ...) @@ -212,7 +212,7 @@ newest generation of PROFILE." #:concise? concise? #:heading (G_ "New in this revision:\n"))))) - (_ #t))) + (_ #f))) (define (display-channel channel) "Display information about CHANNEL." @@ -230,33 +230,44 @@ purposes." ;; Assume that the URL matters less than the name. (eq? (channel-name channel1) (channel-name channel2))) +(define (display-news-entry-title entry language port) + "Display the title of ENTRY, a news entry, to PORT." + (define title + (channel-news-entry-title entry)) + + (format port " ~a~%" + (highlight + (string-trim-right + (texi->plain-text (or (assoc-ref title language) + (assoc-ref title (%default-message-language)) + "")))))) + (define (display-news-entry entry language port) "Display ENTRY, a , in LANGUAGE, a language code, to PORT." - (let ((title (channel-news-entry-title entry)) - (body (channel-news-entry-body entry))) - (format port " ~a~%" - (highlight + (define body + (channel-news-entry-body entry)) + + (display-news-entry-title entry language port) + (format port (G_ " commit ~a~%") + (channel-news-entry-commit entry)) + (newline port) + (format port " ~a~%" + (indented-string + (parameterize ((%text-width (- (%text-width) 4))) (string-trim-right - (texi->plain-text (or (assoc-ref title language) - (assoc-ref title (%default-message-language)) - ""))))) - (format port (G_ " commit ~a~%") - (channel-news-entry-commit entry)) - (newline port) - (format port " ~a~%" - (indented-string - (parameterize ((%text-width (- (%text-width) 4))) - (string-trim-right - (texi->plain-text (or (assoc-ref body language) - (assoc-ref body (%default-message-language)) - "")))) - 4)))) + (texi->plain-text (or (assoc-ref body language) + (assoc-ref body (%default-message-language)) + "")))) + 4))) (define* (display-channel-specific-news new old - #:key (port (current-output-port))) + #:key (port (current-output-port)) + concise?) "Display channel news applicable the commits between OLD and NEW, where OLD -and NEW are records with a proper 'commit' field." +and NEW are records with a proper 'commit' field. When CONCISE? is +true, display nothing but the news titles. Return true if there are more news +to display." (let ((channel new) (old (channel-commit old)) (new (channel-commit new))) @@ -264,13 +275,17 @@ and NEW are records with a proper 'commit' field." (let ((language (current-message-language))) (match (channel-news-for-commit channel new old) (() ;no news is good news - #t) + #f) ((entries ...) (newline port) (format port (G_ "News for channel '~a'~%") (channel-name channel)) - (for-each (cut display-news-entry <> language port) entries) - (newline port))))))) + (for-each (if concise? + (cut display-news-entry-title <> language port) + (cut display-news-entry <> language port)) + entries) + (newline port) + #t)))))) (define* (display-channel-news profile #:optional @@ -317,6 +332,35 @@ and NEW are records with a proper 'commit' field." (and old (list new old))) new-channels))))))) +(define* (display-channel-news-headlines profile) + "Display the titles of news about the channels of PROFILE compared to its +previous generation. Return true if there are news to display." + (define previous + (and=> (relative-generation profile -1) + (cut generation-file-name profile <>))) + + (when previous + (let ((old-channels (profile-channels previous)) + (new-channels (profile-channels profile))) + ;; Find the channels present in both PROFILE and PREVIOUS, and print + ;; their news. + (and (pair? old-channels) (pair? new-channels) + (let ((channels (filter-map (lambda (new) + (define old + (find (cut channel=? new <>) + old-channels)) + + (and old (list new old))) + new-channels))) + (define more? + (map (match-lambda + ((new old) + (display-channel-specific-news new old + #:concise? #t))) + channels)) + + (any ->bool more?)))))) + (define (display-news profile) ;; Display profile news, with the understanding that this process represents ;; the newest generation. @@ -344,7 +388,12 @@ true, display what would be built without actually building it." #:dry-run? dry-run?) (munless dry-run? (return (newline)) - (return (display-profile-news profile #:concise? #t)) + (return + (let ((more? (list (display-profile-news profile #:concise? #t) + (display-channel-news-headlines profile)))) + (when (any ->bool more?) + (display-hint + (G_ "Run @command{guix pull --news} to read all the news."))))) (if guix-command (let ((new (map (cut string-append <> "/bin/guix") (list (user-friendly-profile profile) @@ -544,7 +593,9 @@ it." "Given the two package name/version alists ALIST1 and ALIST2, display the list of new and upgraded packages going from ALIST1 to ALIST2. When ALIST1 and ALIST2 differ, display HEADING upfront. When CONCISE? is true, do not -display long package lists that would fill the user's screen." +display long package lists that would fill the user's screen. + +Return true when there is more package info to display." (define (pretty str column) (indented-string (fill-paragraph str (- (%text-width) 4) column) @@ -587,10 +638,9 @@ display long package lists that would fill the user's screen." (pretty (list->enumeration (sort upgraded string new-count concise/max-item-count) - (> upgraded-count concise/max-item-count))) - (display-hint (G_ "Run @command{guix pull --news} to read all the news."))))) + (and concise? + (or (> new-count concise/max-item-count) + (> upgraded-count concise/max-item-count))))) (define (display-profile-content-diff profile gen1 gen2) "Display the changes in PROFILE GEN2 compared to generation GEN1." From patchwork Sat Sep 21 21:12:27 2019 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: 15425 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 992FE17400; Sat, 21 Sep 2019 22:13:38 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 60218173FB for ; Sat, 21 Sep 2019 22:13:38 +0100 (BST) Received: from localhost ([::1]:43748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBmhF-00038W-Hd for patchwork@mira.cbaines.net; Sat, 21 Sep 2019 17:13:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41455) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBmgq-00035h-Tu for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBmgp-000628-6G for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:12 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:52667) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iBmgp-00061v-1b for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:11 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iBmgo-0000PJ-PS for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:10 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#37413] [PATCH v2 10/11] Add '.guix-channel' file. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 21 Sep 2019 21:13:10 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37413 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 37413@debbugs.gnu.org Received: via spool by 37413-submit@debbugs.gnu.org id=B37413.15691003851488 (code B ref 37413); Sat, 21 Sep 2019 21:13:10 +0000 Received: (at 37413) by debbugs.gnu.org; 21 Sep 2019 21:13:05 +0000 Received: from localhost ([127.0.0.1]:33243 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iBmgg-0000Ne-4M for submit@debbugs.gnu.org; Sat, 21 Sep 2019 17:13:04 -0400 Received: from eggs.gnu.org ([209.51.188.92]:32832) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iBmgc-0000Lg-DP for 37413@debbugs.gnu.org; Sat, 21 Sep 2019 17:12:58 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:49547) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iBmgX-0005kk-9i; Sat, 21 Sep 2019 17:12:53 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=53014 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iBmgW-00065A-Q5; Sat, 21 Sep 2019 17:12:53 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 21 Sep 2019 23:12:27 +0200 Message-Id: <20190921211228.13096-11-ludo@gnu.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190921211228.13096-1-ludo@gnu.org> References: <87sgow0w7w.fsf@gnu.org> <20190921211228.13096-1-ludo@gnu.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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 * .guix-channel: New file. * Makefile.am (EXTRA_DIST): Add it. --- .guix-channel | 5 +++++ Makefile.am | 1 + 2 files changed, 6 insertions(+) create mode 100644 .guix-channel diff --git a/.guix-channel b/.guix-channel new file mode 100644 index 0000000000..3e618d79f8 --- /dev/null +++ b/.guix-channel @@ -0,0 +1,5 @@ +;; This is a Guix channel. + +(channel + (version 0) + (news-file "etc/news.scm")) diff --git a/Makefile.am b/Makefile.am index 658f03bd54..3c27d8ee10 100644 --- a/Makefile.am +++ b/Makefile.am @@ -533,6 +533,7 @@ EXTRA_DIST += \ TODO \ CODE-OF-CONDUCT \ .dir-locals.el \ + .guix-channel \ scripts/guix.in \ etc/guix-install.sh \ build-aux/build-self.scm \ From patchwork Sat Sep 21 21:12:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 15430 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 84F1B17400; Sat, 21 Sep 2019 22:13:59 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 2A54D173FB for ; Sat, 21 Sep 2019 22:13:59 +0100 (BST) Received: from localhost ([::1]:43762 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBmha-0003ZX-IG for patchwork@mira.cbaines.net; Sat, 21 Sep 2019 17:13:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41459) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBmgr-00035s-2g for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBmgp-00062K-HM for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:12 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:52668) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iBmgp-00062E-ES for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:11 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iBmgp-0000PQ-8G for guix-patches@gnu.org; Sat, 21 Sep 2019 17:13:11 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#37413] [PATCH v2 11/11] DRAFT etc: Add channel news file. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 21 Sep 2019 21:13:11 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37413 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 37413@debbugs.gnu.org Received: via spool by 37413-submit@debbugs.gnu.org id=B37413.15691003851498 (code B ref 37413); Sat, 21 Sep 2019 21:13:11 +0000 Received: (at 37413) by debbugs.gnu.org; 21 Sep 2019 21:13:05 +0000 Received: from localhost ([127.0.0.1]:33246 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iBmgi-0000Nw-Ug for submit@debbugs.gnu.org; Sat, 21 Sep 2019 17:13:05 -0400 Received: from eggs.gnu.org ([209.51.188.92]:32834) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iBmgd-0000Ln-70 for 37413@debbugs.gnu.org; Sat, 21 Sep 2019 17:12:59 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:49548) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iBmgY-0005lL-4e; Sat, 21 Sep 2019 17:12:54 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=53014 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iBmgX-00065A-Lu; Sat, 21 Sep 2019 17:12:53 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 21 Sep 2019 23:12:28 +0200 Message-Id: <20190921211228.13096-12-ludo@gnu.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190921211228.13096-1-ludo@gnu.org> References: <87sgow0w7w.fsf@gnu.org> <20190921211228.13096-1-ludo@gnu.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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 DRAFT: Update commit ID before pushing. * etc/news.scm: New file. * Makefile.am (EXTRA_DIST): Add it. --- Makefile.am | 1 + etc/news.scm | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 etc/news.scm diff --git a/Makefile.am b/Makefile.am index 3c27d8ee10..6a4cfcd4a1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -536,6 +536,7 @@ EXTRA_DIST += \ .guix-channel \ scripts/guix.in \ etc/guix-install.sh \ + etc/news.scm \ build-aux/build-self.scm \ build-aux/compile-all.scm \ build-aux/hydra/evaluate.scm \ diff --git a/etc/news.scm b/etc/news.scm new file mode 100644 index 0000000000..05241b36e7 --- /dev/null +++ b/etc/news.scm @@ -0,0 +1,23 @@ +;; GNU Guix news, for use by 'guix pull'. +;; +;; Copyright © 2019 Ludovic Courtès +;; +;; Copying and distribution of this file, with or without modification, are +;; permitted in any medium without royalty provided the copyright notice and +;; this notice are preserved. + +(channel-news + (version 0) + (entry (commit "d17f14c167791b640e49b2b6443d20f9534c62d7") + (title (en "New channel news mechanism") + (fr "Nouveau mécanisme d'information sur les canaux")) + (body + (en "You are reading this message through the new channel news +mechanism, congratulations! This mechanism allows channel authors to provide +@dfn{news entries} that their users can view with @command{guix pull --news}. +Run @command{info \"(guix) Invoking guix pull\"} for more info.") + (fr "Ce message t'arrive à travers le nouveau mécanisme d'information +des canaux, bravo ! Ce mécanisme permet aux auteur·rice·s de canaux de +fournir des informations qu'on peut visualiser avec @command{guix pull +--news}. Tape @command{info \"(guix.fr) Invoquer guix pull\"} pour plus de +détails."))))