all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#70839] [PATCH 0/3] Minor changes to `channels' field and related doc.
@ 2024-05-08 22:59 Tomas Volf
  2024-05-08 23:13 ` [bug#70839] [PATCH 1/3] doc: Warn about extra-special-file usage in /etc Tomas Volf
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Tomas Volf @ 2024-05-08 22:59 UTC (permalink / raw)
  To: 70839; +Cc: Tomas Volf, Florian Pelz, Ludovic Courtès

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




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#70839] [PATCH 1/3] doc: Warn about extra-special-file usage in /etc.
  2024-05-08 22:59 [bug#70839] [PATCH 0/3] Minor changes to `channels' field and related doc Tomas Volf
@ 2024-05-08 23:13 ` Tomas Volf
  2024-05-08 23:13 ` [bug#70839] [PATCH 2/3] channels: Add `read-channels-file' procedure Tomas Volf
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Tomas Volf @ 2024-05-08 23:13 UTC (permalink / raw)
  To: 70839; +Cc: Tomas Volf, Florian Pelz, Ludovic Courtès

* 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





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bug#70839] [PATCH 2/3] channels: Add `read-channels-file' procedure.
  2024-05-08 22:59 [bug#70839] [PATCH 0/3] Minor changes to `channels' field and related doc Tomas Volf
  2024-05-08 23:13 ` [bug#70839] [PATCH 1/3] doc: Warn about extra-special-file usage in /etc Tomas Volf
@ 2024-05-08 23:13 ` Tomas Volf
  2024-05-08 23:13 ` [bug#70839] [PATCH 3/3] services: guix: Default `channels' field to #f Tomas Volf
  2024-06-26 21:41 ` bug#70839: [PATCH 0/3] Minor changes to `channels' field and related doc Ludovic Courtès
  3 siblings, 0 replies; 6+ messages in thread
From: Tomas Volf @ 2024-05-08 23:13 UTC (permalink / raw)
  To: 70839
  Cc: Tomas Volf, Christopher Baines, Josselin Poiret,
	Ludovic Courtès, Mathieu Othacehe, Ricardo Wurmus,
	Simon Tournier, Tobias Geerinckx-Rice

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))))
+
 \f
 ;;;
 ;;; 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





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bug#70839] [PATCH 3/3] services: guix: Default `channels' field to #f.
  2024-05-08 22:59 [bug#70839] [PATCH 0/3] Minor changes to `channels' field and related doc Tomas Volf
  2024-05-08 23:13 ` [bug#70839] [PATCH 1/3] doc: Warn about extra-special-file usage in /etc Tomas Volf
  2024-05-08 23:13 ` [bug#70839] [PATCH 2/3] channels: Add `read-channels-file' procedure Tomas Volf
@ 2024-05-08 23:13 ` Tomas Volf
  2024-06-26 21:41 ` bug#70839: [PATCH 0/3] Minor changes to `channels' field and related doc Ludovic Courtès
  3 siblings, 0 replies; 6+ messages in thread
From: Tomas Volf @ 2024-05-08 23:13 UTC (permalink / raw)
  To: 70839; +Cc: Tomas Volf, Florian Pelz, Ludovic Courtès

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





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#70839: [PATCH 0/3] Minor changes to `channels' field and related doc.
  2024-05-08 22:59 [bug#70839] [PATCH 0/3] Minor changes to `channels' field and related doc Tomas Volf
                   ` (2 preceding siblings ...)
  2024-05-08 23:13 ` [bug#70839] [PATCH 3/3] services: guix: Default `channels' field to #f Tomas Volf
@ 2024-06-26 21:41 ` Ludovic Courtès
  2024-06-27 11:54   ` [bug#70839] " Tomas Volf
  3 siblings, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2024-06-26 21:41 UTC (permalink / raw)
  To: Tomas Volf; +Cc: 70839-done, Florian Pelz

Hi,

Tomas Volf <~@wolfsden.cz> skribis:

> 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.

Finally got around to it: I applied patches #1 and #3.

For patch #2, there’s the unwritten rule that non-UI modules should not
load (guix ui), so I’m reluctant to applying it in its current form.

Now, the current situation is not great either.  For instance, partly
due to that rule, there are 3 copies of ‘load-manifest’—not the end of
the world since it’s just 3 lines, but still.

I don’t have a good idea on how to address this, but we can talk.  :-)

Thanks, and apologies for the delay!

Ludo’.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#70839] [PATCH 0/3] Minor changes to `channels' field and related doc.
  2024-06-26 21:41 ` bug#70839: [PATCH 0/3] Minor changes to `channels' field and related doc Ludovic Courtès
@ 2024-06-27 11:54   ` Tomas Volf
  0 siblings, 0 replies; 6+ messages in thread
From: Tomas Volf @ 2024-06-27 11:54 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 70839

[-- Attachment #1: Type: text/plain, Size: 1415 bytes --]

On 2024-06-26 23:41:57 +0200, Ludovic Courtès wrote:
> > 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.
>
> Finally got around to it: I applied patches #1 and #3.

Thanks :)

> For patch #2, there’s the unwritten rule that non-UI modules should not
> load (guix ui), so I’m reluctant to applying it in its current form.

https://issues.guix.gnu.org/71793

> Now, the current situation is not great either.  For instance, partly
> due to that rule, there are 3 copies of ‘load-manifest’—not the end of
> the world since it’s just 3 lines, but still.
>
> I don’t have a good idea on how to address this, but we can talk.  :-)

Well, in my case I am interested only in `load*' and `make-user-module'.  So
maybe I could move them into (guix utils).  (guix ui) could just #:re-export
them in order to limit the size of the diff, but in (guix channels) I could just
import (guix utils) and use the `load*' from there.

Fundamentally I guess the same could be done with `load-manifest' procedure you
mentioned.

Thoughts?

> Thanks, and apologies for the delay!

No worries and thank you for merging at least parts,

Tomas

--
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-06-27 11:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-08 22:59 [bug#70839] [PATCH 0/3] Minor changes to `channels' field and related doc Tomas Volf
2024-05-08 23:13 ` [bug#70839] [PATCH 1/3] doc: Warn about extra-special-file usage in /etc Tomas Volf
2024-05-08 23:13 ` [bug#70839] [PATCH 2/3] channels: Add `read-channels-file' procedure Tomas Volf
2024-05-08 23:13 ` [bug#70839] [PATCH 3/3] services: guix: Default `channels' field to #f Tomas Volf
2024-06-26 21:41 ` bug#70839: [PATCH 0/3] Minor changes to `channels' field and related doc Ludovic Courtès
2024-06-27 11:54   ` [bug#70839] " Tomas Volf

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.