[PATCH] pull: Honor '/etc/guix/channels.scm'.

  • Done
  • quality assurance status badge
Details
4 participants
  • Oleg Pykhalov
  • Julien Lepiller
  • Ludovic Courtès
  • Ludovic Courtès
Owner
unassigned
Submitted by
Ludovic Courtès
Severity
normal
L
L
Ludovic Courtès wrote on 22 Oct 2019 18:07
(address . guix-patches@gnu.org)(name . Ludovic Courtès)(address . ludovic.courtes@inria.fr)
20191022160703.20897-1-ludo@gnu.org
From: Ludovic Courtès <ludovic.courtes@inria.fr>

* guix/scripts/pull.scm (channel-list)[global-file]: New variable.
[channels]: Honor it.
* doc/guix.texi (Invoking guix pull): Document it.
---
doc/guix.texi | 18 +++++++++++++++++-
guix/scripts/pull.scm | 5 +++++
2 files changed, 22 insertions(+), 1 deletion(-)

Toggle diff (61 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index b550b1c34a..ec331c37cd 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -3666,6 +3666,21 @@ descriptions, and deploys it. Source code is downloaded from a
@uref{https://git-scm.com, Git} repository, by default the official
GNU@tie{}Guix repository, though this can be customized.
+Specifically, @command{guix pull} downloads code from the @dfn{channels}
+(@pxref{Channels}) specified by one of the followings, in this order:
+
+@enumerate
+@item
+the @option{--channels} option;
+@item
+the user's @file{~/.config/guix/channels.scm} file;
+@item
+the system-wide @file{/etc/guix/channels.scm} file;
+@item
+the built-in default channels specified in the @code{%default-channels}
+variable.
+@end enumerate
+
On completion, @command{guix package} will use packages and package
versions from this just-retrieved copy of Guix. Not only that, but all
the Guix commands and Scheme modules will also be taken from that latest
@@ -3763,7 +3778,8 @@ configuration in the @file{~/.config/guix/channels.scm} file or using the
@item --channels=@var{file}
@itemx -C @var{file}
Read the list of channels from @var{file} instead of
-@file{~/.config/guix/channels.scm}. @var{file} must contain Scheme code that
+@file{~/.config/guix/channels.scm} or @file{/etc/guix/channels.scm}.
+@var{file} must contain Scheme code that
evaluates to a list of channel objects. @xref{Channels}, for more
information.
diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index 7876019eac..80d070652b 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -714,6 +714,9 @@ transformations specified in OPTS (resulting from '--url', '--commit', or
(define default-file
(string-append (config-directory) "/channels.scm"))
+ (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))
@@ -725,6 +728,8 @@ transformations specified in OPTS (resulting from '--url', '--commit', or
(load-channels file))
((file-exists? default-file)
(load-channels default-file))
+ ((file-exists? global-file)
+ (load-channels global-file))
(else
%default-channels)))
--
2.23.0
L
L
Ludovic Courtès wrote on 22 Oct 2019 18:13
(address . 37869@debbugs.gnu.org)
875zkgzrkp.fsf@gnu.org
Hello,

Ludovic Courtès <ludo@gnu.org> skribis:

Toggle quote (15 lines)
> +Specifically, @command{guix pull} downloads code from the @dfn{channels}
> +(@pxref{Channels}) specified by one of the followings, in this order:
> +
> +@enumerate
> +@item
> +the @option{--channels} option;
> +@item
> +the user's @file{~/.config/guix/channels.scm} file;
> +@item
> +the system-wide @file{/etc/guix/channels.scm} file;
> +@item
> +the built-in default channels specified in the @code{%default-channels}
> +variable.
> +@end enumerate

A word on the use case: on clusters at work and in other research
institutes, having a system-wide default channel file allows newcomers
to get started right away, without having to look for the ‘channels.scm’
file that their colleagues happen to be using.

Nothing revolutionary, but it can be convenient. :-)

Ludo’.
L
L
Ludovic Courtès wrote on 25 Oct 2019 17:13
(address . 37869@debbugs.gnu.org)(address . guix-i18n@gnu.org)
8736fgrh72.fsf@gnu.org
Hi there!

I’d like to add this news entry for this patch when I push it (within a
day or two if there aren’t any objections):

(entry (commit "XXX")
(title (en "@command{guix pull} now honors @file{/etc/guix/channels.scm"))
(body
(en "The @command{guix pull} command will now read the
@file{/etc/guix/channels.scm} file if it exists and if the per-user
@file{~/.config/guix/channels.scm} is not present. This allows administrators
of multi-user systems to define site-wide defaults.")))


Thanks,
Ludo’.
J
J
Julien Lepiller wrote on 25 Oct 2019 20:20
(name . Ludovic Courtès)(address . ludo@gnu.org)
20191025202017.1df7baaa@sybil.lepiller.eu
Le Fri, 25 Oct 2019 17:13:53 +0200,
Ludovic Courtès <ludo@gnu.org> a écrit :

Toggle quote (21 lines)
> Hi there!
>
> I’d like to add this news entry for this patch when I push it (within
> a day or two if there aren’t any objections):
>
> (entry (commit "XXX")
> (title (en "@command{guix pull} now honors
> @file{/etc/guix/channels.scm")) (body
> (en "The @command{guix pull} command will now read the
> @file{/etc/guix/channels.scm} file if it exists and if the per-user
> @file{~/.config/guix/channels.scm} is not present. This allows
> administrators of multi-user systems to define site-wide defaults.")))
>
> (See <https://issues.guix.gnu.org/issue/37869> for context.)
>
> Thanks,
> Ludo’.
>
>
>

French:

(entry (commit "XXX")
(title (en "@command{guix pull} lit maintenant
@file{/etc/guix/channels.scm}"))
(body
(en "La commande @command{guix pull} lira maintenant le fichier
@file{/etc/guix/channels.scm} s'il existe et si le fichier
@file{~/.config/guix/channels.scm} par utilisateur n'est pas présent.
Cela permet aux administrateurs de systèmes multi-utilisateurs de
définir les paramètres par défaut.")))

As always, feel free to adapt or change anything :)
L
L
Ludovic Courtès wrote on 27 Oct 2019 23:23
(address . 37869-done@debbugs.gnu.org)
87tv7thlpe.fsf@gnu.org
Hi,

Ludovic Courtès <ludo@gnu.org> skribis:

Toggle quote (6 lines)
> From: Ludovic Courtès <ludovic.courtes@inria.fr>
>
> * guix/scripts/pull.scm (channel-list)[global-file]: New variable.
> [channels]: Honor it.
> * doc/guix.texi (Invoking guix pull): Document it.

Pushed as 49af34cfac89d384c46269bfd9388b2c73b1220a.

Julien Lepiller <julien@lepiller.eu> skribis:

Toggle quote (2 lines)
> French:

Thank you, Julien; added with minor tweaks.

Ludo’.
Closed
O
O
Oleg Pykhalov wrote on 28 Oct 2019 21:30
Re: bug#37869: [PATCH] pull: Honor '/etc/guix/channels.scm'.
(address . 37869@debbugs.gnu.org)(address . ludo@gnu.org)
8736fczk7z.fsf@gmail.com
Hello,

Ludovic Courtès <ludo@gnu.org> writes:

[…]

Toggle quote (8 lines)
>> From: Ludovic Courtès <ludovic.courtes@inria.fr>
>>
>> * guix/scripts/pull.scm (channel-list)[global-file]: New variable.
>> [channels]: Honor it.
>> * doc/guix.texi (Invoking guix pull): Document it.
>
> Pushed as 49af34cfac89d384c46269bfd9388b2c73b1220a.

I got an error during the guix pull:
Toggle snippet (40 lines)
oleg@guixsd ~$ guix pull
News for channel 'guix'
Backtrace:
In guix/ui.scm:
1730:12 19 (run-guix-command _ . _)
In ice-9/boot-9.scm:
829:9 18 (catch _ _ #<procedure 7f289995e018 at guix/ui.scm:642…> …)
829:9 17 (catch _ _ #<procedure 7f289995e030 at guix/ui.scm:765…> …)
829:9 16 (catch _ _ #<procedure 7f2896e85828 at guix/scripts/pu…> …)
In guix/store.scm:
623:10 15 (call-with-store _)
In guix/status.scm:
768:4 14 (call-with-status-report _ _)
In guix/scripts/pull.scm:
804:24 13 (_)
In guix/store.scm:
1815:24 12 (run-with-store #<store-connection 256.99 7f288e2ff3c0> …)
In guix/scripts/pull.scm:
393:28 11 (_ #<store-connection 256.99 7f288a4366c0>)
356:15 10 (display-channel-news-headlines _)
In srfi/srfi-1.scm:
592:29 9 (map1 _)
592:17 8 (map1 ((#<<channel> name: guix url: "https://git.sa…> …)))
In guix/scripts/pull.scm:
283:11 7 (display-channel-specific-news _ _ #:port _ #:concise? _)
In srfi/srfi-1.scm:
640:9 6 (for-each #<procedure 7f2888451060 at guix/scripts/pul…> …)
In guix/scripts/pull.scm:
241:12 5 (display-news-entry-title _ _ #<output: file /dev/pts/13>)
In guix/ui.scm:
1210:23 4 (texi->plain-text _)
In texinfo.scm:
1131:22 3 (parse _)
979:31 2 (loop #<input: string 7f289890b930> (*fragment*) _ _ _)
910:31 1 (loop #<input: string 7f289890b930> #f #<procedure ide…> …)
745:27 0 (_ #<input: string 7f289890b930> #f #f #<procedure 7f2…> …)

texinfo.scm:745:27: Throw to key `parser-error' with args `(#<input: string 7f289890b930> "EOF while reading a token " "reading char data")'.

Here is a backtrace from guix repl:
Toggle snippet (25 lines)
oleg@guixsd ~$ guix repl
scheme@(guix scripts pull)> (display-channel-news "/gnu/store/36kli1qk27gshy9zfszs1w08jgyigmp0-profile" "/gnu/store/89rwy7mnpwwd7gnnpz4lq8gxd66pnd1a-profile")

News for channel 'guix'
texinfo.scm:745:27: Throw to key `parser-error' with args `(#<input: string 7f79cd794930> "EOF while reading a token " "reading char data")'.

scheme@(guix scripts pull) [1]> ,backtrace #:width 1000
In srfi/srfi-1.scm:
640:9 9 (for-each #<procedure 7f79d830a6e0 at guix/scripts/pull.scm:324:23 (expr)> _)
In guix/scripts/pull.scm:
283:11 8 (display-channel-specific-news _ _ #:port _ #:concise? _)
In srfi/srfi-1.scm:
640:9 7 (for-each #<procedure 7f79ca0d9560 at guix/scripts/pull.scm:285:25 (t-136e29f79df174e1-14e9)> (#<<channel-news-entry> commit: "49af34cfac89d384c46269bfd9388b2c73b1220a" tag: #f title: (("en" . "@command{guix pull} now honors\n@file{/etc/guix/channels.scm") ("fr" . "@command{guix pull} lit maintenant\n@file{/etc/guix/channels.scm}")) body: (("en" . "The @command{guix pull} command will now read the\n@file{/etc/guix/channels.scm} file if it exists and if the per-user\n@file{~/.config/guix/channels.scm} is not present. This allows administrators\nof multi-user systems to define site-wide defaults.") ("fr" . "La commande @command{guix pull} lira maintenant le fichier\n@file{/etc/guix/channels.scm} s'il existe et si le fichier\n@file{~/.config/guix/channels.scm} par utilisateur·rice n'est pas présent.\nCela permet aux personnes administrant des systèmes multi-utilisateurs de\ndéfinir les canaux par défaut."))>))
In guix/scripts/pull.scm:
251:2 6 (display-news-entry #<<channel-news-entry> commit: "49af34cfac89d384c46269bfd9388b2c73b1220a" tag: #f title: (("en" . "@command{guix pull} now honors\n@file{/etc/guix/channels.scm") ("fr" . "@command{guix pull} lit maintenant\n@file{/etc/guix/channels.scm}")) body: (("en" . "The @command{guix pull} command will now read the\n@file{/etc/guix/channels.scm} file if it exists and if the per-user\n@file{~/.config/guix/channels.scm} is not present. This allows administrators\nof multi-user systems to define site-wide defaults.") ("fr" . "La commande @command{guix pull} lira maintenant le fichier\n@file{/etc/guix/channels.scm} s'il existe et si le fichier\n@file{~/.config/guix/channels.scm} par utilisateur·rice n'est pas présent.\nCela permet aux personnes administrant des systèmes multi-utilisateurs de\ndéfinir les canaux par défaut."))> "en" #<output: file /dev/pts/17>)
241:12 5 (display-news-entry-title _ _ #<output: file /dev/pts/17>)
In guix/ui.scm:
1210:23 4 (texi->plain-text _)
In texinfo.scm:
1131:22 3 (parse _)
979:31 2 (loop #<input: string 7f79cdf555b0> (*fragment*) _ _ _)
910:31 1 (loop #<input: string 7f79cdf555b0> #f #<procedure identity (x)> #f ())
745:27 0 (_ #<input: string 7f79cdf555b0> #f #f #<procedure 7f79d9fd1ec0 at texinfo.scm:1068:3 (string1 string2 seed)> _)

Regards,
Oleg.
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEcjhxI46s62NFSFhXFn+OpQAa+pwFAl23T+AACgkQFn+OpQAa
+pxamhAAuEX53zLgQIpM3my4D53X0sfxgrdLeu80qHOduxEYsbOwtplaUbz20ee7
/tnM8Gx9CYOm00Z3OV0wWZkHu2q6NlTaZYAdFrs8gFYA+bZXMz1U2hCyFF878mli
wtUaMhJKEfN46S3ZN3t1fcLisd50/QWTjz0VXFKuFBTaP7RHpG72lQVtqgvWhZsR
9sOtc8w9uW8HDq5MHrhSjpLHVzujrCGeNAcXzGZ+XXgJPH3twsirv0lRvjEZKFR6
CMlEmfNLRlHr+LUEtvl6NS0nVz0ZJpMuIPP7D8qHcaXBy1fvH6fuQ5xWcE3pVU9x
5JDeUen3OSCivf2OYmtKh19vhLEF5LCSlgSMwHy7SioUzlaqVmojhz2R8t3zVW8g
z4QiuqWUPt7S9uDBZJvc3ADsE26dp8sqFo7HOO5CeGpr6/Hp4KW0/lXftxqYLiLG
GYV/E4iv9rQKWlNyNA8LXxY7zV7mQPAHSlj5AYKe4Jou/E/MGh1qKrIOAMG9y+U5
Jfo6ZzztopDeVA80dPxcSathEGW4z+w/nLQ8exLUOxvyycJbSLdkjZct46kAw5+z
PA2Fbp7vbfVkE19nZVZ43n9PYRS2EbamJF+HPwDMfvJvzmQPcVkqV1DkIWX14V+/
eYkwnIc/geaSwYsHm0+FFBzu//bq2Rx1sQjbq/qPRbw9KddOx+w=
=7UyO
-----END PGP SIGNATURE-----

L
L
Ludovic Courtès wrote on 1 Nov 2019 12:24
(name . Oleg Pykhalov)(address . go.wigust@gmail.com)(address . 37869@debbugs.gnu.org)
87pnibdekx.fsf@gnu.org
Hi Oleg,

Oleg Pykhalov <go.wigust@gmail.com> skribis:

Toggle quote (53 lines)
> Ludovic Courtès <ludo@gnu.org> writes:
>
> […]
>
>>> From: Ludovic Courtès <ludovic.courtes@inria.fr>
>>>
>>> * guix/scripts/pull.scm (channel-list)[global-file]: New variable.
>>> [channels]: Honor it.
>>> * doc/guix.texi (Invoking guix pull): Document it.
>>
>> Pushed as 49af34cfac89d384c46269bfd9388b2c73b1220a.
>
> I got an error during the guix pull:
>
> oleg@guixsd ~$ guix pull
> News for channel 'guix'
> Backtrace:
> In guix/ui.scm:
> 1730:12 19 (run-guix-command _ . _)
> In ice-9/boot-9.scm:
> 829:9 18 (catch _ _ #<procedure 7f289995e018 at guix/ui.scm:642…> …)
> 829:9 17 (catch _ _ #<procedure 7f289995e030 at guix/ui.scm:765…> …)
> 829:9 16 (catch _ _ #<procedure 7f2896e85828 at guix/scripts/pu…> …)
> In guix/store.scm:
> 623:10 15 (call-with-store _)
> In guix/status.scm:
> 768:4 14 (call-with-status-report _ _)
> In guix/scripts/pull.scm:
> 804:24 13 (_)
> In guix/store.scm:
> 1815:24 12 (run-with-store #<store-connection 256.99 7f288e2ff3c0> …)
> In guix/scripts/pull.scm:
> 393:28 11 (_ #<store-connection 256.99 7f288a4366c0>)
> 356:15 10 (display-channel-news-headlines _)
> In srfi/srfi-1.scm:
> 592:29 9 (map1 _)
> 592:17 8 (map1 ((#<<channel> name: guix url: "https://git.sa…> …)))
> In guix/scripts/pull.scm:
> 283:11 7 (display-channel-specific-news _ _ #:port _ #:concise? _)
> In srfi/srfi-1.scm:
> 640:9 6 (for-each #<procedure 7f2888451060 at guix/scripts/pul…> …)
> In guix/scripts/pull.scm:
> 241:12 5 (display-news-entry-title _ _ #<output: file /dev/pts/13>)
> In guix/ui.scm:
> 1210:23 4 (texi->plain-text _)
> In texinfo.scm:
> 1131:22 3 (parse _)
> 979:31 2 (loop #<input: string 7f289890b930> (*fragment*) _ _ _)
> 910:31 1 (loop #<input: string 7f289890b930> #f #<procedure ide…> …)
> 745:27 0 (_ #<input: string 7f289890b930> #f #f #<procedure 7f2…> …)
>
> texinfo.scm:745:27: Throw to key `parser-error' with args `(#<input: string 7f289890b930> "EOF while reading a token " "reading char data")'.

My bad! Tobias fixed it in 6b00a5f4a79819db08cb4d8e9f24a01445b7962b,
thanks Tobias!

I think we need (1) a way to validate channel news, and (2) graceful
handling of Texinfo errors. Commit
6330db4d55bf9be3702cc03145470c970fb7ae9b implements #2.

Thanks,
Ludo’.
?