[PATCH 0/3] Minor changes to `channels' field and related doc.

  • Done
  • quality assurance status badge
Details
2 participants
  • Ludovic Courtès
  • Tomas Volf
Owner
unassigned
Submitted by
Tomas Volf
Severity
normal
T
T
Tomas Volf wrote on 9 May 00:59 +0200
(address . guix-patches@gnu.org)(name . Tomas Volf)(address . ~@wolfsden.cz)
cover.1715208953.git.~@wolfsden.cz
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.


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
T
T
Tomas Volf wrote on 9 May 01:13 +0200
[PATCH 2/3] channels: Add `read-channels-file' procedure.
(address . 70839@debbugs.gnu.org)(name . Tomas Volf)(address . ~@wolfsden.cz)
06234d6dbf04c97da49ecadb8f8d139bf1fe1536.1715208954.git.~@wolfsden.cz
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(-)

Toggle diff (70 lines)
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
T
T
Tomas Volf wrote on 9 May 01:13 +0200
[PATCH 3/3] services: guix: Default `channels' field to #f.
(address . 70839@debbugs.gnu.org)(name . Tomas Volf)(address . ~@wolfsden.cz)
9334845b5b459b34a7b9ce7d56a68629bb333f03.1715208954.git.~@wolfsden.cz
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(-)

Toggle diff (28 lines)
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
T
T
Tomas Volf wrote on 9 May 01:13 +0200
[PATCH 1/3] doc: Warn about extra-special-file usage in /etc.
(address . 70839@debbugs.gnu.org)(name . Tomas Volf)(address . ~@wolfsden.cz)
b1b3ab9d9faa61c9773d8469c201df008dc46b39.1715208954.git.~@wolfsden.cz
* 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(-)

Toggle diff (26 lines)
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
L
L
Ludovic Courtès wrote on 26 Jun 23:41 +0200
Re: [bug#70839] [PATCH 0/3] Minor changes to `channels' field and related doc.
(name . Tomas Volf)(address . ~@wolfsden.cz)
87sewz9yai.fsf@gnu.org
Hi,

Tomas Volf <~@wolfsden.cz> skribis:

Toggle quote (11 lines)
> 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’.
Closed
T
T
Tomas Volf wrote on 27 Jun 13:54 +0200
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 70839@debbugs.gnu.org)
Zn1S34xuw9eTFd7h@ws
On 2024-06-26 23:41:57 +0200, Ludovic Courtès wrote:
Toggle quote (7 lines)
> > 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 :)

Toggle quote (3 lines)
> 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.

Toggle quote (6 lines)
> 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?

Toggle quote (2 lines)
> 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.
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEt4NJs4wUfTYpiGikL7/ufbZ/wakFAmZ9Ut8ACgkQL7/ufbZ/
wal+Dw/+KQJHaTVq+2KWGOW2E9woVqUeW/4X4xx6j3JSC77JxlNWTycwS1fC+ZTR
8VH9X04V9NqVwFKkqFX3Qq0raLXUxSvw6aUlttwW8hh3NAIL06X74QCHodqqoEsT
Cl5DjoF5MYyQyunKcnQbahbI3OrQh7hpFwB2R5sKuthohMXKoIwJqoMjh7k8DUfP
19Sx5bvSuYkBW6cfDYsv40XcmIi5ez/a2Pe07A8FOUcfwBpm8k0Dy+fHnm9eW1Db
RpMjAYGqWV8kVeWg8Nm0dI39Lvxhtly1LayTU+pQ/zvBi9c23071OE0yKhGfjoGV
OZJEwEL7j91uBmJRLJ4MnkPui3dzVJ+Ttsgkmwh2dYDU+a4GjZuXRlyhcldk6oZZ
ffsJzWhLY6v4OXwKmjvuaMTwQSALQqb5fN3uqkqcrb1CwyEH5akeUCk6qXoo+C+T
uVd9hCpY9CT6M84fzn240Dfv6TXyWIEe2wH24kFnGn0+s9/c9OWZU7nJ72e84Q/q
KF/WuUXbbwbZmoFr2wc217RgMdJ3Ju7rP5jU6U2iAXjfQGeHEE0UEliQMlRx1bYP
mNH2YZC0ZTIa+b8WRf+SGtu0TEJDlmCCGoAXlDuVzq7qL26kSakuDrZUw65wEeaj
7V4qIiF6OqiDXwiilEO1ZOns/LBQ36Es2xNLHBysoSN8ej5m4yo=
=YahF
-----END PGP SIGNATURE-----


?
Your comment

This issue is archived.

To comment on this conversation send an email to 70839@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 70839
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch