me
/
guix
Archived
1
0
Fork 0

pull, time-machine: Add '-q' to ignore channel files.

This also fixes <https://issues.guix.gnu.org/63726>.

* guix/scripts/pull.scm (show-help, %options): Add '-q'.
(channel-list): Honor it.
* guix/scripts/time-machine.scm (show-help, %options): Add '-q'.
* doc/guix.texi (Invoking guix pull, Invoking guix time-machine):
Document it.

Reported-by: Simon Tournier <zimon.toutoune@gmail.com>
Ludovic Courtès 2023-08-11 16:54:26 +02:00 committed by Ludovic Courtès
parent 3363ff1867
commit 9c8098424b
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
3 changed files with 57 additions and 13 deletions

View File

@ -4802,9 +4802,11 @@ Specifically, @command{guix pull} downloads code from the @dfn{channels}
@item @item
the @option{--channels} option; the @option{--channels} option;
@item @item
the user's @file{~/.config/guix/channels.scm} file; the user's @file{~/.config/guix/channels.scm} file, unless @option{-q}
is passed;
@item @item
the system-wide @file{/etc/guix/channels.scm} file; the system-wide @file{/etc/guix/channels.scm} file, unless @option{-q}
is passed;
@item @item
the built-in default channels specified in the @code{%default-channels} the built-in default channels specified in the @code{%default-channels}
variable. variable.
@ -4906,6 +4908,11 @@ Read the list of channels from @var{file} instead of
evaluates to a list of channel objects. @xref{Channels}, for more evaluates to a list of channel objects. @xref{Channels}, for more
information. information.
@item --no-channel-files
@itemx -q
Inhibit loading of the user and system channel files,
@file{~/.config/guix/channels.scm} and @file{/etc/guix/channels.scm}.
@cindex channel news @cindex channel news
@item --news @item --news
@itemx -N @itemx -N
@ -5051,7 +5058,9 @@ guix time-machine --commit=v1.2.0 -- \
environment -C --ad-hoc guile -- guile environment -C --ad-hoc guile -- guile
@end example @end example
The command above fetches Guix@tie{}1.2.0 and runs its @command{guix The command above fetches Guix@tie{}1.2.0 (and possibly other channels
specified by your @file{channels.scm} configuration files---see
below) and runs its @command{guix
environment} command to spawn an environment in a container running environment} command to spawn an environment in a container running
@command{guile} (@command{guix environment} has since been subsumed by @command{guile} (@command{guix environment} has since been subsumed by
@command{guix shell}; @pxref{Invoking guix shell}). It's like driving a @command{guix shell}; @pxref{Invoking guix shell}). It's like driving a
@ -5061,6 +5070,21 @@ invocation can be expensive: it may have to download or even build a
large number of packages; the result is cached though and subsequent large number of packages; the result is cached though and subsequent
commands targeting the same commit are almost instantaneous. commands targeting the same commit are almost instantaneous.
As for @command{guix pull}, in the absence of any options,
@command{time-machine} fetches the latest commits of the channels
specified in @file{~/.config/guix/channels.scm},
@file{/etc/guix/channels.scm}, or the default channels; the @option{-q}
option lets you ignore these configuration files. The command:
@example
guix time-machine -q -- build hello
@end example
will thus build the package @code{hello} as defined in the main branch
of Guix, without any additional channel, which is in general a newer
revision of Guix than you have installed. Time travel works in both
directions!
@quotation Note @quotation Note
The history of Guix is immutable and @command{guix time-machine} The history of Guix is immutable and @command{guix time-machine}
provides the exact same software as they are in a specific Guix provides the exact same software as they are in a specific Guix
@ -5110,18 +5134,21 @@ string or the name of a tag), or @var{branch}.
Read the list of channels from @var{file}. @var{file} must contain Read the list of channels from @var{file}. @var{file} must contain
Scheme code that evaluates to a list of channel objects. Scheme code that evaluates to a list of channel objects.
@xref{Channels} for more information. @xref{Channels} for more information.
@end table
As for @command{guix pull}, the absence of any options means that the @item --no-channel-files
latest commit on the master branch will be used. The command @itemx -q
Inhibit loading of the user and system channel files,
@file{~/.config/guix/channels.scm} and @file{/etc/guix/channels.scm}.
Thus, @command{guix time-machine -q} is equivalent to the following Bash
command, using the ``process substitution'' syntax (@pxref{Process
Substitution,,, bash, The GNU Bash Reference Manual}):
@example @example
guix time-machine -- build hello guix time-machine -C <(echo %default-channels) @dots{}
@end example @end example
will thus build the package @code{hello} as defined in the master branch, @end table
which is in general a newer revision of Guix than you have installed.
Time travel works in both directions!
Note that @command{guix time-machine} can trigger builds of channels and Note that @command{guix time-machine} can trigger builds of channels and
their dependencies, and these are controlled by the standard build their dependencies, and these are controlled by the standard build

View File

@ -84,6 +84,9 @@
Download and deploy the latest version of Guix.\n")) Download and deploy the latest version of Guix.\n"))
(display (G_ " (display (G_ "
-C, --channels=FILE deploy the channels defined in FILE")) -C, --channels=FILE deploy the channels defined in FILE"))
(display (G_ "
-q, --no-channel-files
inhibit loading of user and system 'channels.scm'"))
(display (G_ " (display (G_ "
--url=URL download \"guix\" channel from the Git repository at URL")) --url=URL download \"guix\" channel from the Git repository at URL"))
(display (G_ " (display (G_ "
@ -133,6 +136,9 @@ Download and deploy the latest version of Guix.\n"))
(cons* (option '(#\C "channels") #t #f (cons* (option '(#\C "channels") #t #f
(lambda (opt name arg result) (lambda (opt name arg result)
(alist-cons 'channel-file arg result))) (alist-cons 'channel-file arg result)))
(option '(#\q "no-channel-files") #f #f
(lambda (opt name arg result)
(alist-cons 'ignore-channel-files? #t result)))
(option '(#\l "list-generations") #f #t (option '(#\l "list-generations") #f #t
(lambda (opt name arg result) (lambda (opt name arg result)
(cons `(query list-generations ,arg) (cons `(query list-generations ,arg)
@ -735,6 +741,9 @@ transformations specified in OPTS (resulting from '--url', '--commit', or
(define file (define file
(assoc-ref opts 'channel-file)) (assoc-ref opts 'channel-file))
(define ignore-channel-files?
(assoc-ref opts 'ignore-channel-files?))
(define default-file (define default-file
(string-append (config-directory) "/channels.scm")) (string-append (config-directory) "/channels.scm"))
@ -750,9 +759,11 @@ transformations specified in OPTS (resulting from '--url', '--commit', or
(define channels (define channels
(cond (file (cond (file
(load-channels file)) (load-channels file))
((file-exists? default-file) ((and (not ignore-channel-files?)
(file-exists? default-file))
(load-channels default-file)) (load-channels default-file))
((file-exists? global-file) ((and (not ignore-channel-files?)
(file-exists? global-file))
(load-channels global-file)) (load-channels global-file))
(else (else
%default-channels))) %default-channels)))

View File

@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2019 Konrad Hinsen <konrad.hinsen@fastmail.net> ;;; Copyright © 2019 Konrad Hinsen <konrad.hinsen@fastmail.net>
;;; Copyright © 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2019, 2020, 2021, 2023 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com> ;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com> ;;; Copyright © 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; ;;;
@ -62,6 +62,9 @@
Execute COMMAND ARGS... in an older version of Guix.\n")) Execute COMMAND ARGS... in an older version of Guix.\n"))
(display (G_ " (display (G_ "
-C, --channels=FILE deploy the channels defined in FILE")) -C, --channels=FILE deploy the channels defined in FILE"))
(display (G_ "
-q, --no-channel-files
inhibit loading of user and system 'channels.scm'"))
(display (G_ " (display (G_ "
--url=URL use the Git repository at URL")) --url=URL use the Git repository at URL"))
(display (G_ " (display (G_ "
@ -86,6 +89,9 @@ Execute COMMAND ARGS... in an older version of Guix.\n"))
(cons* (option '(#\C "channels") #t #f (cons* (option '(#\C "channels") #t #f
(lambda (opt name arg result) (lambda (opt name arg result)
(alist-cons 'channel-file arg result))) (alist-cons 'channel-file arg result)))
(option '(#\q "no-channel-files") #f #f
(lambda (opt name arg result)
(alist-cons 'ignore-channel-files? #t result)))
(option '("url") #t #f (option '("url") #t #f
(lambda (opt name arg result) (lambda (opt name arg result)
(alist-cons 'repository-url arg (alist-cons 'repository-url arg