GNU bug report logs - #70839
[PATCH 0/3] Minor changes to `channels' field and related doc.

Previous Next

Package: guix-patches;

Reported by: Tomas Volf <~@wolfsden.cz>

Date: Wed, 8 May 2024 23:01:02 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 70839 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to pelzflorian <at> pelzflorian.de, ludo <at> gnu.org, guix-patches <at> gnu.org:
bug#70839; Package guix-patches. (Wed, 08 May 2024 23:01:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tomas Volf <~@wolfsden.cz>:
New bug report received and forwarded. Copy sent to pelzflorian <at> pelzflorian.de, ludo <at> gnu.org, guix-patches <at> gnu.org. (Wed, 08 May 2024 23:01:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Tomas Volf <~@wolfsden.cz>
To: guix-patches <at> gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [PATCH 0/3] Minor changes to `channels' field and related doc.
Date: Thu,  9 May 2024 00:59:38 +0200
As discussed on mailing list[0], this series contains few minor changes to
documentation, changing the default value to #f and creating new procedure for
actually filling the `channels' field based on the channels.scm file.

0: https://lists.gnu.org/archive/html/guix-devel/2024-04/msg00049.html

Tomas Volf (3):
  doc: Warn about extra-special-file usage in /etc.
  channels: Add `read-channels-file' procedure.
  services: guix: Default `channels' field to #f.

 doc/guix.texi         |  8 ++++++--
 gnu/services/base.scm |  2 +-
 guix/channels.scm     | 14 +++++++++++++-
 guix/scripts/pull.scm | 12 +++---------
 4 files changed, 23 insertions(+), 13 deletions(-)

--
2.41.0




Information forwarded to guix <at> cbaines.net, dev <at> jpoiret.xyz, ludo <at> gnu.org, othacehe <at> gnu.org, rekado <at> elephly.net, zimon.toutoune <at> gmail.com, me <at> tobias.gr, guix-patches <at> gnu.org:
bug#70839; Package guix-patches. (Wed, 08 May 2024 23:15:02 GMT) Full text and rfc822 format available.

Message #8 received at 70839 <at> debbugs.gnu.org (full text, mbox):

From: Tomas Volf <~@wolfsden.cz>
To: 70839 <at> debbugs.gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [PATCH 2/3] channels: Add `read-channels-file' procedure.
Date: Thu,  9 May 2024 01:13:23 +0200
This commit moves non-exported local procedure from (guix pull) in order to
provide a single, canonical way to read a file produced by `guix describe
--format=channels'.

* guix/channels.scm (read-channels-file): New procedure.
(define-module): Export it.
* guix/scripts/pull.scm (channel-list): Use it.

Change-Id: I147fdf3cb177114f4607209de2299f46761b64be
---
 guix/channels.scm     | 14 +++++++++++++-
 guix/scripts/pull.scm | 12 +++---------
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/guix/channels.scm b/guix/channels.scm
index 51024dcad4..38d5c8c325 100644
--- a/guix/channels.scm
+++ b/guix/channels.scm
@@ -37,6 +37,7 @@ (define-module (guix channels)
   #:autoload   (guix git-authenticate) (authenticate-repository)
   #:autoload   (guix openpgp) (openpgp-public-key-fingerprint
                                openpgp-format-fingerprint)
+  #:autoload   (guix ui) (load* make-user-module)
   #:use-module (guix base16)
   #:use-module (guix records)
   #:use-module (guix gexp)
@@ -111,7 +112,9 @@ (define-module (guix channels)
             channel-news-entry-title
             channel-news-entry-body
 
-            channel-news-for-commit))
+            channel-news-for-commit
+
+            read-channels-file))
 
 ;;; Commentary:
 ;;;
@@ -1086,6 +1089,15 @@ (define* (channel->code channel #:key (include-introduction? #t))
                                  intro))))))
             '()))))
 
+(define (read-channels-file file)
+  "Return channel list read from FILE.
+
+The file shall have format produced by `guix describe --format=channels'."
+  (let ((result (load* file (make-user-module '((guix channels))))))
+    (if (and (list? result) (every channel? result))
+        result
+        (leave (G_ "'~a' did not return a list of channels~%") file))))
+
 
 ;;;
 ;;; News.
diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index 58d3cd7e83..7240b2f25e 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -750,21 +750,15 @@ (define (channel-list opts)
   (define global-file
     (string-append %sysconfdir "/guix/channels.scm"))
 
-  (define (load-channels file)
-    (let ((result (load* file (make-user-module '((guix channels))))))
-      (if (and (list? result) (every channel? result))
-          result
-          (leave (G_ "'~a' did not return a list of channels~%") file))))
-
   (define channels
     (cond (file
-           (load-channels file))
+           (read-channels-file file))
           ((and (not ignore-channel-files?)
                 (file-exists? default-file))
-           (load-channels default-file))
+           (read-channels-file default-file))
           ((and (not ignore-channel-files?)
                 (file-exists? global-file))
-           (load-channels global-file))
+           (read-channels-file global-file))
           (else
            %default-channels)))
 
-- 
2.41.0





Information forwarded to pelzflorian <at> pelzflorian.de, ludo <at> gnu.org, guix-patches <at> gnu.org:
bug#70839; Package guix-patches. (Wed, 08 May 2024 23:15:02 GMT) Full text and rfc822 format available.

Message #11 received at 70839 <at> debbugs.gnu.org (full text, mbox):

From: Tomas Volf <~@wolfsden.cz>
To: 70839 <at> debbugs.gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [PATCH 3/3] services: guix: Default `channels' field to #f.
Date: Thu,  9 May 2024 01:13:24 +0200
In the absence of the /etc/guix/channels.scm file, %default-channels is used
anyway.  If user manually (or by extra-special-file) created the file, we
should respect it.  This commit therefore changes the default to #f, hopefully
having zero impact on people not actively using the `channels' field.

* gnu/services/base.scm (<guix-configuration>)[channels]: Set default to #f.

Change-Id: I516c1735a037a153fabbebfc337051aaf0be2155
---
 doc/guix.texi         | 2 +-
 gnu/services/base.scm | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 568878ad24..9f422f8212 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -19591,7 +19591,7 @@ Base Services
 not need it and where the extra boot time is a problem.
 
 @anchor{guix-configuration-channels}
-@item @code{channels} (default: @code{%default-channels})
+@item @code{channels} (default: @code{#f})
 List of channels to be specified in @file{/etc/guix/channels.scm}, which
 is what @command{guix pull} uses by default (@pxref{Invoking guix
 pull}).
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 85160bd3ab..c5f28fd611 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -1830,7 +1830,7 @@ (define-record-type* <guix-configuration>
   (generate-substitute-key? guix-configuration-generate-substitute-key?
                             (default #t))         ;Boolean
   (channels         guix-configuration-channels ;file-like
-                    (default %default-channels))
+                    (default #f))
   (chroot-directories guix-configuration-chroot-directories ;list of file-like/strings
                       (default '()))
   (max-silent-time  guix-configuration-max-silent-time ;integer
-- 
2.41.0





Information forwarded to pelzflorian <at> pelzflorian.de, ludo <at> gnu.org, guix-patches <at> gnu.org:
bug#70839; Package guix-patches. (Wed, 08 May 2024 23:15:03 GMT) Full text and rfc822 format available.

Message #14 received at 70839 <at> debbugs.gnu.org (full text, mbox):

From: Tomas Volf <~@wolfsden.cz>
To: 70839 <at> debbugs.gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [PATCH 1/3] doc: Warn about extra-special-file usage in /etc.
Date: Thu,  9 May 2024 01:13:22 +0200
* doc/guix.texi (Base Services)[extra-special-file]: Add warning regarding
files in /etc.

Change-Id: Ic45465c8712d61caeed42d7912777368e8763a1a
---
 doc/guix.texi | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index f20208f94f..568878ad24 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -123,7 +123,7 @@
 Copyright @copyright{} 2023 Thomas Ieong@*
 Copyright @copyright{} 2023 Saku Laesvuori@*
 Copyright @copyright{} 2023 Graham James Addis@*
-Copyright @copyright{} 2023 Tomas Volf@*
+Copyright @copyright{} 2023, 2024 Tomas Volf@*
 Copyright @copyright{} 2024 Herman Rimm@*
 Copyright @copyright{} 2024 Matthew Trzcinski@*
 Copyright @copyright{} 2024 Richard Sent@*
@@ -18984,6 +18984,10 @@ Base Services
 (extra-special-file "/usr/bin/env"
                     (file-append coreutils "/bin/env"))
 @end lisp
+
+This procedure is meant for @code{/bin/sh}, @code{/usr/bin/env} and
+similar targets.  In particular, use for targets under @code{/etc} might
+not work as expected if the target is managed by Guix in other ways.
 @end deffn
 
 @defvar host-name-service-type
-- 
2.41.0





This bug report was last modified 31 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.