unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 65229@debbugs.gnu.org
Cc: maurice.bremond@inria.fr,
	"Ludovic Courtès" <ludovic.courtes@inria.fr>,
	"Simon Tournier" <zimon.toutoune@gmail.com>,
	"Christopher Baines" <mail@cbaines.net>,
	"Josselin Poiret" <dev@jpoiret.xyz>,
	"Ludovic Courtès" <ludo@gnu.org>,
	"Mathieu Othacehe" <othacehe@gnu.org>,
	"Ricardo Wurmus" <rekado@elephly.net>,
	"Simon Tournier" <zimon.toutoune@gmail.com>,
	"Tobias Geerinckx-Rice" <me@tobias.gr>
Subject: [bug#65229] [PATCH 1/2] pull, time-machine: Add '-q' to ignore channel files.
Date: Fri, 11 Aug 2023 17:34:18 +0200	[thread overview]
Message-ID: <0ee5ee05ea81374342740f06915e9dadb1a92a63.1691767568.git.ludo@gnu.org> (raw)
In-Reply-To: <cover.1691767568.git.ludo@gnu.org>

From: Ludovic Courtès <ludovic.courtes@inria.fr>

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>
---
 doc/guix.texi                 | 30 ++++++++++++++++++++++--------
 guix/scripts/pull.scm         | 14 ++++++++++++--
 guix/scripts/time-machine.scm |  7 ++++++-
 3 files changed, 40 insertions(+), 11 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 409ca2ad62..ec36159de1 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -4801,9 +4801,11 @@ Invoking guix pull
 @item
 the @option{--channels} option;
 @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
-the system-wide @file{/etc/guix/channels.scm} file;
+the system-wide @file{/etc/guix/channels.scm} file, unless @option{-q}
+is passed;
 @item
 the built-in default channels specified in the @code{%default-channels}
 variable.
@@ -4905,6 +4907,10 @@ Invoking guix pull
 evaluates to a list of channel objects.  @xref{Channels}, for more
 information.
 
+@item -q
+Inhibit loading of the user and system channel files,
+@file{~/.config/guix/channels.scm} and @file{/etc/guix/channels.scm}.
+
 @cindex channel news
 @item --news
 @itemx -N
@@ -5092,18 +5098,26 @@ Invoking guix time-machine
 Read the list of channels from @var{file}.  @var{file} must contain
 Scheme code that evaluates to a list of channel objects.
 @xref{Channels} for more information.
+
+@item -q
+Inhibit loading of the user and system channel files,
+@file{~/.config/guix/channels.scm} and @file{/etc/guix/channels.scm}.
 @end table
 
-As for @command{guix pull}, the absence of any options means that the
-latest commit on the master branch will be used.  The command
+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 -- build hello
+guix time-machine -q -- build hello
 @end example
 
-will thus build the package @code{hello} as defined in the master branch,
-which is in general a newer revision of Guix than you have installed.
-Time travel works in both directions!
+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!
 
 Note that @command{guix time-machine} can trigger builds of channels and
 their dependencies, and these are controlled by the standard build
diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index ecd264d3fa..f0d4ff36e6 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -84,6 +84,8 @@ (define (show-help)
 Download and deploy the latest version of Guix.\n"))
   (display (G_ "
   -C, --channels=FILE    deploy the channels defined in FILE"))
+  (display (G_ "
+  -q                     inhibit loading of user and system 'channels.scm'"))
   (display (G_ "
       --url=URL          download \"guix\" channel from the Git repository at URL"))
   (display (G_ "
@@ -133,6 +135,9 @@ (define %options
   (cons* (option '(#\C "channels") #t #f
                  (lambda (opt name arg result)
                    (alist-cons 'channel-file arg result)))
+         (option '(#\q) #f #f
+                 (lambda (opt name arg result)
+                   (alist-cons 'ignore-channel-files? #t result)))
          (option '(#\l "list-generations") #f #t
                  (lambda (opt name arg result)
                    (cons `(query list-generations ,arg)
@@ -735,6 +740,9 @@ (define (channel-list opts)
   (define file
     (assoc-ref opts 'channel-file))
 
+  (define ignore-channel-files?
+    (assoc-ref opts 'ignore-channel-files?))
+
   (define default-file
     (string-append (config-directory) "/channels.scm"))
 
@@ -750,9 +758,11 @@ (define (channel-list opts)
   (define channels
     (cond (file
            (load-channels file))
-          ((file-exists? default-file)
+          ((and (not ignore-channel-files?)
+                (file-exists? default-file))
            (load-channels default-file))
-          ((file-exists? global-file)
+          ((and (not ignore-channel-files?)
+                (file-exists? global-file))
            (load-channels global-file))
           (else
            %default-channels)))
diff --git a/guix/scripts/time-machine.scm b/guix/scripts/time-machine.scm
index d7c71ef705..8afea6b35d 100644
--- a/guix/scripts/time-machine.scm
+++ b/guix/scripts/time-machine.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; 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>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -51,6 +51,8 @@ (define (show-help)
 Execute COMMAND ARGS... in an older version of Guix.\n"))
   (display (G_ "
   -C, --channels=FILE    deploy the channels defined in FILE"))
+  (display (G_ "
+  -q                     inhibit loading of user and system 'channels.scm'"))
   (display (G_ "
       --url=URL          use the Git repository at URL"))
   (display (G_ "
@@ -75,6 +77,9 @@ (define %options
   (cons* (option '(#\C "channels") #t #f
                  (lambda (opt name arg result)
                    (alist-cons 'channel-file arg result)))
+         (option '(#\q) #f #f
+                 (lambda (opt name arg result)
+                   (alist-cons 'ignore-channel-files? #t result)))
          (option '("url") #t #f
                  (lambda (opt name arg result)
                    (alist-cons 'repository-url arg
-- 
2.41.0





  reply	other threads:[~2023-08-11 15:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-11 15:31 [bug#65229] [PATCH 0/2] Add '-q' for 'pull' and 'time-machine'; support loading from pipes Ludovic Courtès
2023-08-11 15:34 ` Ludovic Courtès [this message]
2023-08-16 12:59   ` [bug#65229] [PATCH 1/2] pull, time-machine: Add '-q' to ignore channel files Simon Tournier
2023-08-16 13:43     ` Simon Tournier
2023-08-17  8:56     ` Ludovic Courtès
2023-08-17  9:59       ` Simon Tournier
2023-08-17 10:17       ` [bug#65229] [PATCH v2 1/2] ui: 'load*' accepts /dev/fd/N files pointing to a pipe Ludovic Courtès
2023-08-17 10:17       ` [bug#65229] [PATCH v2 2/2] pull, time-machine: Add '-q' to ignore channel files Ludovic Courtès
2023-08-17 11:20         ` Simon Tournier
2023-08-17 17:10           ` bug#65229: [PATCH 0/2] Add '-q' for 'pull' and 'time-machine'; support loading from pipes Ludovic Courtès
2023-08-11 15:34 ` [bug#65229] [PATCH 2/2] ui: 'load*' accepts /dev/fd/N files pointing to a pipe Ludovic Courtès
2023-08-16 13:32   ` Simon Tournier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0ee5ee05ea81374342740f06915e9dadb1a92a63.1691767568.git.ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=65229@debbugs.gnu.org \
    --cc=dev@jpoiret.xyz \
    --cc=ludovic.courtes@inria.fr \
    --cc=mail@cbaines.net \
    --cc=maurice.bremond@inria.fr \
    --cc=me@tobias.gr \
    --cc=othacehe@gnu.org \
    --cc=rekado@elephly.net \
    --cc=zimon.toutoune@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).