unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#37869] [PATCH] pull: Honor '/etc/guix/channels.scm'.
@ 2019-10-22 16:07 Ludovic Courtès
  2019-10-22 16:13 ` Ludovic Courtès
  2019-10-27 22:23 ` bug#37869: " Ludovic Courtès
  0 siblings, 2 replies; 7+ messages in thread
From: Ludovic Courtès @ 2019-10-22 16:07 UTC (permalink / raw)
  To: 37869; +Cc: Ludovic Courtès

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(-)

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

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

* [bug#37869] [PATCH] pull: Honor '/etc/guix/channels.scm'.
  2019-10-22 16:07 [bug#37869] [PATCH] pull: Honor '/etc/guix/channels.scm' Ludovic Courtès
@ 2019-10-22 16:13 ` Ludovic Courtès
  2019-10-25 15:13   ` Ludovic Courtès
  2019-10-27 22:23 ` bug#37869: " Ludovic Courtès
  1 sibling, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2019-10-22 16:13 UTC (permalink / raw)
  To: 37869

Hello,

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

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

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

* [bug#37869] [PATCH] pull: Honor '/etc/guix/channels.scm'.
  2019-10-22 16:13 ` Ludovic Courtès
@ 2019-10-25 15:13   ` Ludovic Courtès
  2019-10-25 18:20     ` Julien Lepiller
  0 siblings, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2019-10-25 15:13 UTC (permalink / raw)
  To: 37869; +Cc: guix-i18n

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

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

* [bug#37869] [PATCH] pull: Honor '/etc/guix/channels.scm'.
  2019-10-25 15:13   ` Ludovic Courtès
@ 2019-10-25 18:20     ` Julien Lepiller
  0 siblings, 0 replies; 7+ messages in thread
From: Julien Lepiller @ 2019-10-25 18:20 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-i18n, 37869

Le Fri, 25 Oct 2019 17:13:53 +0200,
Ludovic Courtès <ludo@gnu.org> a écrit :

> 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 :)

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

* bug#37869: [PATCH] pull: Honor '/etc/guix/channels.scm'.
  2019-10-22 16:07 [bug#37869] [PATCH] pull: Honor '/etc/guix/channels.scm' Ludovic Courtès
  2019-10-22 16:13 ` Ludovic Courtès
@ 2019-10-27 22:23 ` Ludovic Courtès
  2019-10-28 20:30   ` [bug#37869] " Oleg Pykhalov
  1 sibling, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2019-10-27 22:23 UTC (permalink / raw)
  To: 37869-done

Hi,

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

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

> French:

Thank you, Julien; added with minor tweaks.

Ludo’.

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

* [bug#37869] [PATCH] pull: Honor '/etc/guix/channels.scm'.
  2019-10-27 22:23 ` bug#37869: " Ludovic Courtès
@ 2019-10-28 20:30   ` Oleg Pykhalov
  2019-11-01 11:24     ` Ludovic Courtès
  0 siblings, 1 reply; 7+ messages in thread
From: Oleg Pykhalov @ 2019-10-28 20:30 UTC (permalink / raw)
  To: 37869; +Cc: ludo

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

Hello,

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:
--8<---------------cut here---------------start------------->8---
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")'.
--8<---------------cut here---------------end--------------->8---

Here is a backtrace from guix repl:
--8<---------------cut here---------------start------------->8---
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)> _)
--8<---------------cut here---------------end--------------->8---

Regards,
Oleg.

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

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

* [bug#37869] [PATCH] pull: Honor '/etc/guix/channels.scm'.
  2019-10-28 20:30   ` [bug#37869] " Oleg Pykhalov
@ 2019-11-01 11:24     ` Ludovic Courtès
  0 siblings, 0 replies; 7+ messages in thread
From: Ludovic Courtès @ 2019-11-01 11:24 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 37869

Hi Oleg,

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

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

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

end of thread, other threads:[~2019-11-01 11:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-22 16:07 [bug#37869] [PATCH] pull: Honor '/etc/guix/channels.scm' Ludovic Courtès
2019-10-22 16:13 ` Ludovic Courtès
2019-10-25 15:13   ` Ludovic Courtès
2019-10-25 18:20     ` Julien Lepiller
2019-10-27 22:23 ` bug#37869: " Ludovic Courtès
2019-10-28 20:30   ` [bug#37869] " Oleg Pykhalov
2019-11-01 11:24     ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).