GNU bug report logs - #78580
[PATCH] pull: allow filtering which channels to pull from the CLI

Previous Next

Package: guix-patches;

Reported by: Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com>

Date: Sat, 24 May 2025 17:14:02 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 78580 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix <at> cbaines.net, dev <at> jpoiret.xyz, ludo <at> gnu.org, othacehe <at> gnu.org, zimon.toutoune <at> gmail.com, me <at> tobias.gr, guix-patches <at> gnu.org:
bug#78580; Package guix-patches. (Sat, 24 May 2025 17:14:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix <at> cbaines.net, dev <at> jpoiret.xyz, ludo <at> gnu.org, othacehe <at> gnu.org, zimon.toutoune <at> gmail.com, me <at> tobias.gr, guix-patches <at> gnu.org. (Sat, 24 May 2025 17:14:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com>
Subject: [PATCH] pull: allow filtering which channels to pull from the CLI
Date: Sat, 24 May 2025 19:12:35 +0200
* guix/scripts/pull.scm (guix-pull): treat non-prefix CLI arguments as a list
of channels to pull.

Change-Id: I5d08c4b1cc84ab58a9c4e7600eb86468f92d10f0
---
 guix/scripts/pull.scm | 33 +++++++++++++++++++++++++++------
 1 file changed, 27 insertions(+), 6 deletions(-)

diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index 76aed0b5cc..61a68b8d70 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -839,21 +839,41 @@ (define (validate-cache-directory-ownership)
 (define-command (guix-pull . args)
   (synopsis "pull the latest revision of Guix")
 
-  (define (no-arguments arg _)
-    (leave (G_ "~A: extraneous argument~%") arg))
+  (define (filter-channels channels names)
+    "Filter CHANNELS whose name symbol is present in NAMES list.
+If NAMES is an empty list, don't filter anything.  Warn when a name is not
+available in the channels list."
+    (if (null? names)
+        channels
+        (let ((available-names (map channel-name
+                                    channels)))
+          (for-each (lambda (name)
+                      (unless (member name available-names)
+                        (warning (G_ "Channel '~a' not present in channel list~%")
+                                 name)))
+                    names)
+          (filter (lambda (ch)
+                    (member (channel-name ch)
+                            ;; A channel named guix must always be present.
+                            (cons* 'guix names)))
+                  channels))))
 
   (with-error-handling
     (with-git-error-handling
      (let* ((opts         (parse-command-line args %options
-                                              (list %default-options)
-                                              #:argument-handler no-arguments))
+                                              (list %default-options)))
             (substitutes? (assoc-ref opts 'substitutes?))
             (dry-run?     (assoc-ref opts 'dry-run?))
             (profile      (or (assoc-ref opts 'profile) %current-profile))
             (current-channels (profile-channels profile))
             (validate-pull    (assoc-ref opts 'validate-pull))
             (authenticate?    (assoc-ref opts 'authenticate-channels?))
-            (verify-certificate? (assoc-ref opts 'verify-certificate?)))
+            (verify-certificate? (assoc-ref opts 'verify-certificate?))
+            (selected-channels (filter-map
+                                (match-lambda
+                                  (('argument . name) (string->symbol name))
+                                  (_ #f))
+                                opts)))
        (cond
         ((assoc-ref opts 'query)
          (process-query opts profile))
@@ -877,7 +897,8 @@ (define-command (guix-pull . args)
                  (ensure-default-profile)
                  (honor-x509-certificates store)
 
-                 (let* ((channels (channel-list opts))
+                 (let* ((channels (filter-channels (channel-list opts)
+                                                   selected-channels))
                         (instances
                          (latest-channel-instances store channels
                                                    #:current-channels

base-commit: 096dedd0bb13523002c814b001429c2f65b6f10d
-- 
2.49.0





Information forwarded to sergio.pastorperez <at> gmail.com, guix <at> cbaines.net, gabriel <at> erlikon.ch, dev <at> jpoiret.xyz, ludo <at> gnu.org, othacehe <at> gnu.org, maxim.cournoyer <at> gmail.com, zimon.toutoune <at> gmail.com, me <at> tobias.gr, guix-patches <at> gnu.org:
bug#78580; Package guix-patches. (Sat, 24 May 2025 21:24:02 GMT) Full text and rfc822 format available.

Message #8 received at 78580 <at> debbugs.gnu.org (full text, mbox):

From: Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com>
To: 78580 <at> debbugs.gnu.org
Cc: Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com>
Subject: [PATCH v2] pull: allow filtering which channels to pull from the CLI
Date: Sat, 24 May 2025 23:22:01 +0200
* guix/scripts/pull.scm (guix-pull): treat non-prefix CLI arguments as a list
of channels to pull.

Change-Id: I5d08c4b1cc84ab58a9c4e7600eb86468f92d10f0
---
 doc/guix.texi         | 11 +++++++++--
 guix/scripts/pull.scm | 42 ++++++++++++++++++++++++++++++++++--------
 2 files changed, 43 insertions(+), 10 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index e4e2b853f1..e3de7ce47b 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -4656,8 +4656,15 @@ Invoking guix pull
 deleting /var/guix/profiles/per-user/charlie/current-guix-1-link
 @end example
 
-The @command{guix pull} command is usually invoked with no arguments,
-but it supports the following options:
+The general syntax is:
+
+@example
+guix pull [@var{options}] [@var{CHANNELS}@dots{}]
+@end example
+
+The optional @var{channels} argument filters the list of pulled channels
+to those whose names match the given list.  The channel named @dfn{guix}
+is always pulled.
 
 @table @code
 @item --url=@var{url}
diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index 76aed0b5cc..677df965bb 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -81,8 +81,13 @@ (define %default-options
     (validate-pull . ,ensure-forward-channel-update)))
 
 (define (show-help)
-  (display (G_ "Usage: guix pull [OPTION]...
-Download and deploy the latest version of Guix.\n"))
+  (display (G_ "Usage: guix pull [OPTION]... [CHANNELS...]
+Download and deploy the latest version of Guix.
+
+If CHANNELS are specified, pull only from channels with those names (e.g.:
+'guix pull rde nonguix' pulls only from the 'guix', 'rde', and 'nonguix'
+channels as defined in your channel configuration).
+The channel named 'guix' is always pulled.\n"))
   (display (G_ "
   -C, --channels=FILE    deploy the channels defined in FILE"))
   (display (G_ "
@@ -839,21 +844,41 @@ (define (validate-cache-directory-ownership)
 (define-command (guix-pull . args)
   (synopsis "pull the latest revision of Guix")
 
-  (define (no-arguments arg _)
-    (leave (G_ "~A: extraneous argument~%") arg))
+  (define (filter-channels channels names)
+    "Filter CHANNELS whose name symbol is present in NAMES list.
+If NAMES is an empty list, don't filter anything.  Warn when a name is not
+available in the channels list."
+    (if (null? names)
+        channels
+        (let ((available-names (map channel-name
+                                    channels)))
+          (for-each (lambda (name)
+                      (unless (member name available-names)
+                        (warning (G_ "Channel '~a' not present in channel list~%")
+                                 name)))
+                    names)
+          (filter (lambda (ch)
+                    (member (channel-name ch)
+                            ;; A channel named guix must always be present.
+                            (cons* 'guix names)))
+                  channels))))
 
   (with-error-handling
     (with-git-error-handling
      (let* ((opts         (parse-command-line args %options
-                                              (list %default-options)
-                                              #:argument-handler no-arguments))
+                                              (list %default-options)))
             (substitutes? (assoc-ref opts 'substitutes?))
             (dry-run?     (assoc-ref opts 'dry-run?))
             (profile      (or (assoc-ref opts 'profile) %current-profile))
             (current-channels (profile-channels profile))
             (validate-pull    (assoc-ref opts 'validate-pull))
             (authenticate?    (assoc-ref opts 'authenticate-channels?))
-            (verify-certificate? (assoc-ref opts 'verify-certificate?)))
+            (verify-certificate? (assoc-ref opts 'verify-certificate?))
+            (selected-channels (filter-map
+                                (match-lambda
+                                  (('argument . name) (string->symbol name))
+                                  (_ #f))
+                                opts)))
        (cond
         ((assoc-ref opts 'query)
          (process-query opts profile))
@@ -877,7 +902,8 @@ (define-command (guix-pull . args)
                  (ensure-default-profile)
                  (honor-x509-certificates store)
 
-                 (let* ((channels (channel-list opts))
+                 (let* ((channels (filter-channels (channel-list opts)
+                                                   selected-channels))
                         (instances
                          (latest-channel-instances store channels
                                                    #:current-channels

base-commit: 096dedd0bb13523002c814b001429c2f65b6f10d
-- 
2.49.0





Information forwarded to guix-patches <at> gnu.org:
bug#78580; Package guix-patches. (Sun, 25 May 2025 07:07:02 GMT) Full text and rfc822 format available.

Message #11 received at 78580 <at> debbugs.gnu.org (full text, mbox):

From: Sergey Trofimov <sarg <at> sarg.org.ru>
To: Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com>
Cc: Josselin Poiret <dev <at> jpoiret.xyz>, Tobias Geerinckx-Rice <me <at> tobias.gr>,
 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 Simon Tournier <zimon.toutoune <at> gmail.com>, Mathieu Othacehe <othacehe <at> gnu.org>,
 Ludovic Courtès <ludo <at> gnu.org>,
 Gabriel Wicki <gabriel <at> erlikon.ch>, Christopher Baines <guix <at> cbaines.net>,
 78580 <at> debbugs.gnu.org
Subject: Re: [bug#78580] [PATCH v2] pull: allow filtering which channels to
 pull from the CLI
Date: Sun, 25 May 2025 09:06:20 +0200
Hi Sergio,

Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com> writes:

> * guix/scripts/pull.scm (guix-pull): treat non-prefix CLI arguments as a list
> of channels to pull.
>
> Change-Id: I5d08c4b1cc84ab58a9c4e7600eb86468f92d10f0
> ---
>  doc/guix.texi         | 11 +++++++++--
>  guix/scripts/pull.scm | 42 ++++++++++++++++++++++++++++++++++--------
>  2 files changed, 43 insertions(+), 10 deletions(-)
>
> diff --git a/doc/guix.texi b/doc/guix.texi
> index e4e2b853f1..e3de7ce47b 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -4656,8 +4656,15 @@ Invoking guix pull
>  deleting /var/guix/profiles/per-user/charlie/current-guix-1-link
>  @end example
>  
> -The @command{guix pull} command is usually invoked with no arguments,
> -but it supports the following options:
> +The general syntax is:
> +
> +@example
> +guix pull [@var{options}] [@var{CHANNELS}@dots{}]
> +@end example
> +
> +The optional @var{channels} argument filters the list of pulled channels
> +to those whose names match the given list.  The channel named @dfn{guix}
> +is always pulled.
>

wouldn't it be better to let user decide whether `guix` channel has to
be pulled? The use-case is simple - I've made a change in my personal
channel and I want to apply it without risking to build missing /
download new substitutes of the main channel.





Information forwarded to guix-patches <at> gnu.org:
bug#78580; Package guix-patches. (Sun, 25 May 2025 07:23:01 GMT) Full text and rfc822 format available.

Message #14 received at 78580 <at> debbugs.gnu.org (full text, mbox):

From: Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com>
To: Sergey Trofimov <sarg <at> sarg.org.ru>
Cc: Josselin Poiret <dev <at> jpoiret.xyz>, Tobias Geerinckx-Rice <me <at> tobias.gr>,
 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 Simon Tournier <zimon.toutoune <at> gmail.com>, Mathieu Othacehe <othacehe <at> gnu.org>,
 Ludovic Courtès <ludo <at> gnu.org>,
 Gabriel Wicki <gabriel <at> erlikon.ch>, Christopher Baines <guix <at> cbaines.net>,
 78580 <at> debbugs.gnu.org
Subject: Re: [bug#78580] [PATCH v2] pull: allow filtering which channels to
 pull from the CLI
Date: Sun, 25 May 2025 09:22:09 +0200
Hello Sergey.

Sergey Trofimov <sarg <at> sarg.org.ru> writes:
>> +The optional @var{channels} argument filters the list of pulled channels
>> +to those whose names match the given list.  The channel named @dfn{guix}
>> +is always pulled.
>>
>
> wouldn't it be better to let user decide whether `guix` channel has to
> be pulled? The use-case is simple - I've made a change in my personal
> channel and I want to apply it without risking to build missing /
> download new substitutes of the main channel.

Unfortunately this is not possible. That was my initial idea as well,
but the `guix' channel is required. If you allow it to compose the list
of channels to pull without the `guix' channel, you get this error:
--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix pull rde
Updating channel 'rde' from Git repository at 'https://git.sr.ht/~abcdw/rde'...
Building from this channel:
  rde       https://git.sr.ht/~abcdw/rde        bf8f628
/home/pastor/projects/guix/puntos/dots/.config/guix/channels.scm:12:6: error: 'guix' channel is lacking
hint: Make sure your list of channels contains one channel named `guix' providing the core of Guix.
--8<---------------cut here---------------end--------------->8---

Once thing we could do, is to pin the Guix channel to the current commit
so it does not pull. I can try to implement that if you would like to
have that behaviour.




Information forwarded to guix-patches <at> gnu.org:
bug#78580; Package guix-patches. (Sun, 25 May 2025 07:31:02 GMT) Full text and rfc822 format available.

Message #17 received at 78580 <at> debbugs.gnu.org (full text, mbox):

From: Sergey Trofimov <sarg <at> sarg.org.ru>
To: Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com>
Cc: Josselin Poiret <dev <at> jpoiret.xyz>, Tobias Geerinckx-Rice <me <at> tobias.gr>,
 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 Simon Tournier <zimon.toutoune <at> gmail.com>, Mathieu Othacehe <othacehe <at> gnu.org>,
 Ludovic Courtès <ludo <at> gnu.org>,
 Gabriel Wicki <gabriel <at> erlikon.ch>, Christopher Baines <guix <at> cbaines.net>,
 78580 <at> debbugs.gnu.org
Subject: Re: [bug#78580] [PATCH v2] pull: allow filtering which channels to
 pull from the CLI
Date: Sun, 25 May 2025 09:30:46 +0200
Hi Sergio, 

Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com> writes:

> Hello Sergey.
>
> Sergey Trofimov <sarg <at> sarg.org.ru> writes:
>>> +The optional @var{channels} argument filters the list of pulled channels
>>> +to those whose names match the given list.  The channel named @dfn{guix}
>>> +is always pulled.
>>>
>>
>> wouldn't it be better to let user decide whether `guix` channel has to
>> be pulled? The use-case is simple - I've made a change in my personal
>> channel and I want to apply it without risking to build missing /
>> download new substitutes of the main channel.
>
> Unfortunately this is not possible. That was my initial idea as well,
> but the `guix' channel is required. If you allow it to compose the list
> of channels to pull without the `guix' channel, you get this error:
> --8<---------------cut here---------------start------------->8---
> $ ./pre-inst-env guix pull rde
> Updating channel 'rde' from Git repository at 'https://git.sr.ht/~abcdw/rde'...
> Building from this channel:
>   rde       https://git.sr.ht/~abcdw/rde        bf8f628
> /home/pastor/projects/guix/puntos/dots/.config/guix/channels.scm:12:6: error: 'guix' channel is lacking
> hint: Make sure your list of channels contains one channel named `guix' providing the core of Guix.
> --8<---------------cut here---------------end--------------->8---
>
> Once thing we could do, is to pin the Guix channel to the current commit
> so it does not pull. I can try to implement that if you would like to
> have that behaviour.

It'd be nice, otherwise one would need to use `--commit=$(guix describe
...)` which might work, but is not that user friendly.




Information forwarded to sergio.pastorperez <at> gmail.com, sarg <at> sarg.org.ru, guix <at> cbaines.net, gabriel <at> erlikon.ch, dev <at> jpoiret.xyz, ludo <at> gnu.org, othacehe <at> gnu.org, maxim.cournoyer <at> gmail.com, zimon.toutoune <at> gmail.com, me <at> tobias.gr, guix-patches <at> gnu.org:
bug#78580; Package guix-patches. (Sun, 25 May 2025 08:21:02 GMT) Full text and rfc822 format available.

Message #20 received at 78580 <at> debbugs.gnu.org (full text, mbox):

From: Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com>
To: 78580 <at> debbugs.gnu.org
Cc: Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com>
Subject: [PATCH v3] pull: allow filtering which channels to pull from the CLI
Date: Sun, 25 May 2025 10:20:17 +0200
* guix/scripts/pull.scm (guix-pull): treat non-prefix CLI arguments as a list
of channels to pull.

Change-Id: I5d08c4b1cc84ab58a9c4e7600eb86468f92d10f0
---
 doc/guix.texi         | 10 +++++++--
 guix/scripts/pull.scm | 52 ++++++++++++++++++++++++++++++++++++-------
 2 files changed, 52 insertions(+), 10 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index e4e2b853f1..26f16cfa7a 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -4656,8 +4656,14 @@ Invoking guix pull
 deleting /var/guix/profiles/per-user/charlie/current-guix-1-link
 @end example
 
-The @command{guix pull} command is usually invoked with no arguments,
-but it supports the following options:
+The general syntax is:
+
+@example
+guix pull [@var{options}] [@var{CHANNELS}@dots{}]
+@end example
+
+The optional @var{channels} argument filters the list of pulled channels
+to those whose names match the given list.
 
 @table @code
 @item --url=@var{url}
diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index 76aed0b5cc..8da7ec7ac4 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -81,8 +81,12 @@ (define %default-options
     (validate-pull . ,ensure-forward-channel-update)))
 
 (define (show-help)
-  (display (G_ "Usage: guix pull [OPTION]...
-Download and deploy the latest version of Guix.\n"))
+  (display (G_ "Usage: guix pull [OPTION]... [CHANNELS...]
+Download and deploy the latest version of Guix.
+
+If CHANNELS are specified, pull only from channels with those names (e.g.:
+'guix pull rde nonguix' pulls only from the 'guix', 'rde', and 'nonguix'
+channels as defined in your channel configuration).\n"))
   (display (G_ "
   -C, --channels=FILE    deploy the channels defined in FILE"))
   (display (G_ "
@@ -839,21 +843,51 @@ (define (validate-cache-directory-ownership)
 (define-command (guix-pull . args)
   (synopsis "pull the latest revision of Guix")
 
-  (define (no-arguments arg _)
-    (leave (G_ "~A: extraneous argument~%") arg))
+  (define (filter-channels channels current-channels names)
+    "Filter CHANNELS whose name symbol is present in NAMES list.
+If NAMES is an empty list, don't filter anything.  Warn when a name is not
+available in the channels list."
+    (if (null? names)
+        channels
+        (let ((available-names (map channel-name
+                                    channels)))
+          (for-each (lambda (name)
+                      (unless (member name available-names)
+                        (warning (G_ "Channel '~a' not present in channel list~%")
+                                 name)))
+                    names)
+          (let ((program (car (command-line)))
+                (current-guix (find (lambda (ch)
+                                      (eq? (channel-name ch) 'guix))
+                                    current-channels))
+                (selected-channels (filter (lambda (ch)
+                                             (member (channel-name ch)
+                                                     names))
+                                           channels)))
+            ;; The guix channel must always be present.
+            (if (member 'guix names)
+                ;; If the guix channel is selected, let it pull.
+                selected-channels
+                ;; If the guix channel is not, pin it.
+                (cons* current-guix
+                       selected-channels))))))
 
   (with-error-handling
     (with-git-error-handling
      (let* ((opts         (parse-command-line args %options
-                                              (list %default-options)
-                                              #:argument-handler no-arguments))
+                                              (list %default-options)))
             (substitutes? (assoc-ref opts 'substitutes?))
             (dry-run?     (assoc-ref opts 'dry-run?))
             (profile      (or (assoc-ref opts 'profile) %current-profile))
             (current-channels (profile-channels profile))
             (validate-pull    (assoc-ref opts 'validate-pull))
             (authenticate?    (assoc-ref opts 'authenticate-channels?))
-            (verify-certificate? (assoc-ref opts 'verify-certificate?)))
+            (verify-certificate? (assoc-ref opts 'verify-certificate?))
+            (selected-channels (filter-map
+                                (match-lambda
+                                  (('argument . name) (string->symbol name))
+                                  (_ #f))
+                                opts)))
        (cond
         ((assoc-ref opts 'query)
          (process-query opts profile))
@@ -877,7 +911,9 @@ (define-command (guix-pull . args)
                  (ensure-default-profile)
                  (honor-x509-certificates store)
 
-                 (let* ((channels (channel-list opts))
+                 (let* ((channels (filter-channels (channel-list opts)
+                                                   current-channels
+                                                   selected-channels))
                         (instances
                          (latest-channel-instances store channels
                                                    #:current-channels

base-commit: 096dedd0bb13523002c814b001429c2f65b6f10d
-- 
2.49.0





Information forwarded to guix-patches <at> gnu.org:
bug#78580; Package guix-patches. (Sun, 25 May 2025 08:24:01 GMT) Full text and rfc822 format available.

Message #23 received at 78580 <at> debbugs.gnu.org (full text, mbox):

From: Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com>
To: Sergey Trofimov <sarg <at> sarg.org.ru>
Cc: Josselin Poiret <dev <at> jpoiret.xyz>, Tobias Geerinckx-Rice <me <at> tobias.gr>,
 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 Simon Tournier <zimon.toutoune <at> gmail.com>, Mathieu Othacehe <othacehe <at> gnu.org>,
 Ludovic Courtès <ludo <at> gnu.org>,
 Gabriel Wicki <gabriel <at> erlikon.ch>, Christopher Baines <guix <at> cbaines.net>,
 78580 <at> debbugs.gnu.org
Subject: Re: [bug#78580] [PATCH v2] pull: allow filtering which channels to
 pull from the CLI
Date: Sun, 25 May 2025 10:23:23 +0200
Sergey Trofimov <sarg <at> sarg.org.ru> writes:
>> Once thing we could do, is to pin the Guix channel to the current commit
>> so it does not pull. I can try to implement that if you would like to
>> have that behaviour.
>
> It'd be nice, otherwise one would need to use `--commit=$(guix describe
> ...)` which might work, but is not that user friendly.

Done[1] :)

Please let me know if you have any more feedback!

[1] https://issues.guix.gnu.org/78580#5




Information forwarded to guix-patches <at> gnu.org:
bug#78580; Package guix-patches. (Sun, 25 May 2025 09:55:01 GMT) Full text and rfc822 format available.

Message #26 received at 78580 <at> debbugs.gnu.org (full text, mbox):

From: Sergey Trofimov <sarg <at> sarg.org.ru>
To: Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com>
Cc: Josselin Poiret <dev <at> jpoiret.xyz>, Tobias Geerinckx-Rice <me <at> tobias.gr>,
 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 Simon Tournier <zimon.toutoune <at> gmail.com>, Mathieu Othacehe <othacehe <at> gnu.org>,
 Ludovic Courtès <ludo <at> gnu.org>,
 Gabriel Wicki <gabriel <at> erlikon.ch>, Christopher Baines <guix <at> cbaines.net>,
 78580 <at> debbugs.gnu.org
Subject: Re: [bug#78580] [PATCH v2] pull: allow filtering which channels to
 pull from the CLI
Date: Sun, 25 May 2025 11:54:22 +0200
Hi, 

Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com> writes:

> Sergey Trofimov <sarg <at> sarg.org.ru> writes:
>>> Once thing we could do, is to pin the Guix channel to the current commit
>>> so it does not pull. I can try to implement that if you would like to
>>> have that behaviour.
>>
>> It'd be nice, otherwise one would need to use `--commit=$(guix describe
>> ...)` which might work, but is not that user friendly.
>
> Done[1] :)
>
> Please let me know if you have any more feedback!
>
> [1] https://issues.guix.gnu.org/78580#5

Ok, after a test I see it does something unexpected. I have 4 channels
in my system (guix/nonguix/sops/personal). After `guix pull nonguix`
I've ended up with a generation containing only guix and nonguix, other
channels were gone. If I get your intent right, then instead of
`filter-channels` you need to implement `unpin-channels`, so that the
new generation is built from the current channels and the ones specified
by the user are updated.




Information forwarded to guix-patches <at> gnu.org:
bug#78580; Package guix-patches. (Sun, 25 May 2025 10:22:01 GMT) Full text and rfc822 format available.

Message #29 received at 78580 <at> debbugs.gnu.org (full text, mbox):

From: Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com>
To: Sergey Trofimov <sarg <at> sarg.org.ru>
Cc: Josselin Poiret <dev <at> jpoiret.xyz>, Tobias Geerinckx-Rice <me <at> tobias.gr>,
 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 Simon Tournier <zimon.toutoune <at> gmail.com>, Mathieu Othacehe <othacehe <at> gnu.org>,
 Ludovic Courtès <ludo <at> gnu.org>,
 Gabriel Wicki <gabriel <at> erlikon.ch>, Christopher Baines <guix <at> cbaines.net>,
 78580 <at> debbugs.gnu.org
Subject: Re: [bug#78580] [PATCH v2] pull: allow filtering which channels to
 pull from the CLI
Date: Sun, 25 May 2025 12:20:55 +0200
Sergey Trofimov <sarg <at> sarg.org.ru> writes:
> Hi, 
>
> Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com> writes:
>
>> Sergey Trofimov <sarg <at> sarg.org.ru> writes:
>>>> Once thing we could do, is to pin the Guix channel to the current commit
>>>> so it does not pull. I can try to implement that if you would like to
>>>> have that behaviour.
>>>
>>> It'd be nice, otherwise one would need to use `--commit=$(guix describe
>>> ...)` which might work, but is not that user friendly.
>>
>> Done[1] :)
>>
>> Please let me know if you have any more feedback!
>>
>> [1] https://issues.guix.gnu.org/78580#5
>
> Ok, after a test I see it does something unexpected. I have 4 channels
> in my system (guix/nonguix/sops/personal). After `guix pull nonguix`
> I've ended up with a generation containing only guix and nonguix, other
> channels were gone. If I get your intent right, then instead of
> `filter-channels` you need to implement `unpin-channels`, so that the
> new generation is built from the current channels and the ones specified
> by the user are updated.

You are right. I did not realise that the internals of `guix pull' does
not take a list of channels to update but a whole channel profile to
deploy I will correct.

Thanks for pointing it out.




Information forwarded to sergio.pastorperez <at> gmail.com, sarg <at> sarg.org.ru, guix <at> cbaines.net, gabriel <at> erlikon.ch, dev <at> jpoiret.xyz, ludo <at> gnu.org, othacehe <at> gnu.org, maxim.cournoyer <at> gmail.com, zimon.toutoune <at> gmail.com, me <at> tobias.gr, guix-patches <at> gnu.org:
bug#78580; Package guix-patches. (Sun, 25 May 2025 10:56:02 GMT) Full text and rfc822 format available.

Message #32 received at 78580 <at> debbugs.gnu.org (full text, mbox):

From: Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com>
To: 78580 <at> debbugs.gnu.org
Cc: Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com>
Subject: [PATCH v4] pull: allow filtering which channels to pull from the CLI
Date: Sun, 25 May 2025 12:55:02 +0200
* guix/scripts/pull.scm (guix-pull): treat non-prefix CLI arguments as a list
of channels to pull.

Change-Id: I5d08c4b1cc84ab58a9c4e7600eb86468f92d10f0
---
 doc/guix.texi         | 10 ++++++--
 guix/scripts/pull.scm | 53 ++++++++++++++++++++++++++++++++++++-------
 2 files changed, 53 insertions(+), 10 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index e4e2b853f1..26f16cfa7a 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -4656,8 +4656,14 @@ Invoking guix pull
 deleting /var/guix/profiles/per-user/charlie/current-guix-1-link
 @end example
 
-The @command{guix pull} command is usually invoked with no arguments,
-but it supports the following options:
+The general syntax is:
+
+@example
+guix pull [@var{options}] [@var{CHANNELS}@dots{}]
+@end example
+
+The optional @var{channels} argument filters the list of pulled channels
+to those whose names match the given list.
 
 @table @code
 @item --url=@var{url}
diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index 76aed0b5cc..fc6809d68c 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -81,8 +81,12 @@ (define %default-options
     (validate-pull . ,ensure-forward-channel-update)))
 
 (define (show-help)
-  (display (G_ "Usage: guix pull [OPTION]...
-Download and deploy the latest version of Guix.\n"))
+  (display (G_ "Usage: guix pull [OPTION]... [CHANNELS...]
+Download and deploy the latest version of Guix.
+
+If CHANNELS are specified, pull only from channels with those names (e.g.:
+'guix pull rde nonguix' pulls only from the 'guix', 'rde', and 'nonguix'
+channels as defined in your channel configuration).\n"))
   (display (G_ "
   -C, --channels=FILE    deploy the channels defined in FILE"))
   (display (G_ "
@@ -839,21 +843,52 @@ (define (validate-cache-directory-ownership)
 (define-command (guix-pull . args)
   (synopsis "pull the latest revision of Guix")
 
-  (define (no-arguments arg _)
-    (leave (G_ "~A: extraneous argument~%") arg))
+  (define (unpin-channels channels current-channels names)
+    "Unpin CHANNELS whose name symbol is present in NAMES list.
+If NAMES is an empty list, don't filter anything.  Warn when a name is not
+available in the channels list."
+    (if (null? names)
+        channels
+        (let ((available-names (map channel-name
+                                    channels))
+              (selected-channels (filter (lambda (ch)
+                                           (member (channel-name ch)
+                                                   names))
+                                         channels)))
+          (for-each (lambda (name)
+                      (unless (member name available-names)
+                        (warning (G_ "Channel '~a' not present in channel list~%")
+                                 name)))
+                    names)
+
+          (map (lambda (cur-ch)
+                 (let ((selected-channel (find (lambda (ch)
+                                                 (eq? (channel-name ch)
+                                                      (channel-name cur-ch)))
+                                               selected-channels)))
+                   ;; If the user selected this channel. Follow channel file
+                   ;; specification. Otherwise, leave the channel pinned as
+                   ;; defined by the current profile.
+                   (or selected-channel
+                       cur-ch)))
+               current-channels))))
 
   (with-error-handling
     (with-git-error-handling
      (let* ((opts         (parse-command-line args %options
-                                              (list %default-options)
-                                              #:argument-handler no-arguments))
+                                              (list %default-options)))
             (substitutes? (assoc-ref opts 'substitutes?))
             (dry-run?     (assoc-ref opts 'dry-run?))
             (profile      (or (assoc-ref opts 'profile) %current-profile))
             (current-channels (profile-channels profile))
             (validate-pull    (assoc-ref opts 'validate-pull))
             (authenticate?    (assoc-ref opts 'authenticate-channels?))
-            (verify-certificate? (assoc-ref opts 'verify-certificate?)))
+            (verify-certificate? (assoc-ref opts 'verify-certificate?))
+            (selected-channels (filter-map
+                                (match-lambda
+                                  (('argument . name) (string->symbol name))
+                                  (_ #f))
+                                opts)))
        (cond
         ((assoc-ref opts 'query)
          (process-query opts profile))
@@ -877,7 +912,9 @@ (define-command (guix-pull . args)
                  (ensure-default-profile)
                  (honor-x509-certificates store)
 
-                 (let* ((channels (channel-list opts))
+                 (let* ((channels (unpin-channels (channel-list opts)
+                                                  current-channels
+                                                  selected-channels))
                         (instances
                          (latest-channel-instances store channels
                                                    #:current-channels

base-commit: 096dedd0bb13523002c814b001429c2f65b6f10d
-- 
2.49.0





Information forwarded to guix-patches <at> gnu.org:
bug#78580; Package guix-patches. (Sun, 25 May 2025 11:04:02 GMT) Full text and rfc822 format available.

Message #35 received at 78580 <at> debbugs.gnu.org (full text, mbox):

From: Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com>
To: Sergey Trofimov <sarg <at> sarg.org.ru>
Cc: Josselin Poiret <dev <at> jpoiret.xyz>, Tobias Geerinckx-Rice <me <at> tobias.gr>,
 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 Simon Tournier <zimon.toutoune <at> gmail.com>, Mathieu Othacehe <othacehe <at> gnu.org>,
 Ludovic Courtès <ludo <at> gnu.org>,
 Gabriel Wicki <gabriel <at> erlikon.ch>, Christopher Baines <guix <at> cbaines.net>,
 78580 <at> debbugs.gnu.org
Subject: Re: [bug#78580] [PATCH v4] pull: allow filtering which channels to
 pull from the CLI
Date: Sun, 25 May 2025 13:03:49 +0200
Sergey Trofimov <sarg <at> sarg.org.ru> writes:
> Hi, 
>
> Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com> writes:
>
>> Sergey Trofimov <sarg <at> sarg.org.ru> writes:
>>>> Once thing we could do, is to pin the Guix channel to the current commit
>>>> so it does not pull. I can try to implement that if you would like to
>>>> have that behaviour.
>>>
>>> It'd be nice, otherwise one would need to use `--commit=$(guix describe
>>> ...)` which might work, but is not that user friendly.
>>
>> Done[1] :)
>>
>> Please let me know if you have any more feedback!
>>
>> [1] https://issues.guix.gnu.org/78580#5
>
> Ok, after a test I see it does something unexpected. I have 4 channels
> in my system (guix/nonguix/sops/personal). After `guix pull nonguix`
> I've ended up with a generation containing only guix and nonguix, other
> channels were gone. If I get your intent right, then instead of
> `filter-channels` you need to implement `unpin-channels`, so that the
> new generation is built from the current channels and the ones specified
> by the user are updated.

Alright, now you should get the expected behaviour[1]. Please let me
know if you see any problem.

[1] https://issues.guix.gnu.org/78580#9




Information forwarded to guix-patches <at> gnu.org:
bug#78580; Package guix-patches. (Sun, 25 May 2025 14:22:03 GMT) Full text and rfc822 format available.

Message #38 received at 78580 <at> debbugs.gnu.org (full text, mbox):

From: Sergey Trofimov <sarg <at> sarg.org.ru>
To: Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com>
Cc: Josselin Poiret <dev <at> jpoiret.xyz>, Tobias Geerinckx-Rice <me <at> tobias.gr>,
 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 Simon Tournier <zimon.toutoune <at> gmail.com>, Mathieu Othacehe <othacehe <at> gnu.org>,
 Ludovic Courtès <ludo <at> gnu.org>,
 Gabriel Wicki <gabriel <at> erlikon.ch>, Christopher Baines <guix <at> cbaines.net>,
 78580 <at> debbugs.gnu.org
Subject: Re: [bug#78580] [PATCH v4] pull: allow filtering which channels to
 pull from the CLI
Date: Sun, 25 May 2025 16:20:59 +0200
X-Draft-From: ("nndoc+ephemeral:bug#78580" 3)
Hi, 

Pérez <sergio.pastorperez <at> gmail.com> writes:

[...]
>
> Alright, now you should get the expected behaviour[1]. Please let me
> know if you see any problem.
>
> [1] https://issues.guix.gnu.org/78580#9

Confirming it works now correctly.
Date: Sun, 25 May 2025 16:20:59 +0200




Information forwarded to guix-patches <at> gnu.org:
bug#78580; Package guix-patches. (Wed, 04 Jun 2025 08:52:02 GMT) Full text and rfc822 format available.

Message #41 received at 78580 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com>
Cc: Tobias Geerinckx-Rice <me <at> tobias.gr>, Josselin Poiret <dev <at> jpoiret.xyz>,
 Sergey Trofimov <sarg <at> sarg.org.ru>,
 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 Simon Tournier <zimon.toutoune <at> gmail.com>, Mathieu Othacehe <othacehe <at> gnu.org>,
 Gabriel Wicki <gabriel <at> erlikon.ch>, Christopher Baines <guix <at> cbaines.net>,
 78580 <at> debbugs.gnu.org
Subject: Re: [bug#78580] [PATCH v4] pull: allow filtering which channels to
 pull from the CLI
Date: Tue, 03 Jun 2025 10:14:36 +0200
Hi Sergio,

Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com> writes:

> * guix/scripts/pull.scm (guix-pull): treat non-prefix CLI arguments as a list
> of channels to pull.
>
> Change-Id: I5d08c4b1cc84ab58a9c4e7600eb86468f92d10f0

Please mention the doc/guix.texi changes.

Some comments:

> +@example
> +guix pull [@var{options}] [@var{CHANNELS}@dots{}]

“channels” (lower-case).

> +The optional @var{channels} argument filters the list of pulled channels
> +to those whose names match the given list.

This would need to be clarified.  IIUC, what ‘guix pull A’ does is that
it updates A but keeps the other channels unchanged, right?

There’s a risk with this practice though: channels are typically tested
against the latest version of each other.  For example, ‘guix-science’
in continuous integration is built against the latest ‘guix’; if one
tries to update ‘guix-science’ without updating ‘guix’, there’s a
gradient of problems that might occur: it might work fine, or
substitutes might be missing, or some packages from ‘guix-science’ will
fail to build, or ‘guix pull’ will fail upfront.

> +  (display (G_ "Usage: guix pull [OPTION]... [CHANNELS...]
> +Download and deploy the latest version of Guix.

“Download and deploy the latest version of Guix, possibly limited to CHANNELS.”

> +If CHANNELS are specified, pull only from channels with those names (e.g.:
> +'guix pull rde nonguix' pulls only from the 'guix', 'rde', and 'nonguix'
> +channels as defined in your channel configuration).\n"))

I’d drop this paragraph: ‘--help’ is concise by convention and further
explanations should go to the manual.

> +  (define (unpin-channels channels current-channels names)
> +    "Unpin CHANNELS whose name symbol is present in NAMES list.
> +If NAMES is an empty list, don't filter anything.  Warn when a name is not
> +available in the channels list."

You can turn the docstring into a comment since it’s not a top-level
procedure.

> +    (if (null? names)
> +        channels
> +        (let ((available-names (map channel-name
> +                                    channels))
> +              (selected-channels (filter (lambda (ch)
> +                                           (member (channel-name ch)
> +                                                   names))
> +                                         channels)))

As per our coding conventions (info "(guix) Formatting Code"),
s/ch/channel/
but you can shorten the other identifiers: ‘names’, ‘selected’.

> +          (for-each (lambda (name)
> +                      (unless (member name available-names)
> +                        (warning (G_ "Channel '~a' not present in channel list~%")

“channel '~a~' selected but missing from channel list~%" (messages are lower-case).

> +          (map (lambda (cur-ch)

s/cur-ch/channel/

> +                 (let ((selected-channel (find (lambda (ch)
> +                                                 (eq? (channel-name ch)
> +                                                      (channel-name cur-ch)))
> +                                               selected-channels)))
> +                   ;; If the user selected this channel. Follow channel file
                                                          ^
Should be a comma.

Thanks,
Ludo’.




Information forwarded to sergio.pastorperez <at> gmail.com, sarg <at> sarg.org.ru, ludo <at> gnu.org, guix <at> cbaines.net, gabriel <at> erlikon.ch, dev <at> jpoiret.xyz, othacehe <at> gnu.org, maxim.cournoyer <at> gmail.com, zimon.toutoune <at> gmail.com, me <at> tobias.gr, guix-patches <at> gnu.org:
bug#78580; Package guix-patches. (Wed, 04 Jun 2025 21:25:02 GMT) Full text and rfc822 format available.

Message #44 received at 78580 <at> debbugs.gnu.org (full text, mbox):

From: Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com>
To: 78580 <at> debbugs.gnu.org
Cc: Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com>
Subject: [PATCH v5] pull: allow filtering which channels to pull from the CLI
Date: Wed,  4 Jun 2025 23:23:32 +0200
* guix/scripts/pull.scm (guix-pull): Treat non-prefix CLI arguments as a list
of channels to pull.
* doc/guix.texi (guix pull): Document new command syntax and behavior for
filtering pulled channels by name.

Change-Id: I5d08c4b1cc84ab58a9c4e7600eb86468f92d10f0
---
 doc/guix.texi         | 18 ++++++++++++++--
 guix/scripts/pull.scm | 50 ++++++++++++++++++++++++++++++++++++-------
 2 files changed, 58 insertions(+), 10 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 5fefba3634..b6d7461f34 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -4656,8 +4656,22 @@ Invoking guix pull
 deleting /var/guix/profiles/per-user/charlie/current-guix-1-link
 @end example
 
-The @command{guix pull} command is usually invoked with no arguments,
-but it supports the following options:
+The general syntax is:
+
+@example
+guix pull [@var{options}] [@var{channels}@dots{}]
+@end example
+
+The optional @var{channels} argument filters the list of pulled channels
+to those whose names match the given list.
+
+For example, given a list of channels with names A B C:
+
+@example
+guix pull A B
+@end example
+
+would update channels A and B while keeping C unchanged.
 
 @table @code
 @item --url=@var{url}
diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index 76aed0b5cc..3d8e613171 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2013-2015, 2017-2024 Ludovic Courtès <ludo <at> gnu.org>
 ;;; Copyright © 2017 Marius Bakke <mbakke <at> fastmail.com>
 ;;; Copyright © 2020, 2021 Tobias Geerinckx-Rice <me <at> tobias.gr>
+;;; Copyright © 2025 Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -81,8 +82,8 @@ (define %default-options
     (validate-pull . ,ensure-forward-channel-update)))
 
 (define (show-help)
-  (display (G_ "Usage: guix pull [OPTION]...
-Download and deploy the latest version of Guix.\n"))
+  (display (G_ "Usage: guix pull [OPTION]... [CHANNELS...]
+Download and deploy the latest version of Guix, possibly limited to CHANNELS.\n"))
   (display (G_ "
   -C, --channels=FILE    deploy the channels defined in FILE"))
   (display (G_ "
@@ -839,21 +840,52 @@ (define (validate-cache-directory-ownership)
 (define-command (guix-pull . args)
   (synopsis "pull the latest revision of Guix")
 
-  (define (no-arguments arg _)
-    (leave (G_ "~A: extraneous argument~%") arg))
+  ;; Unpin CHANNELS whose name symbol is present in the NAMES list. If NAMES
+  ;; is an empty list, do not filter anything. Warn if a name is not available
+  ;; in the channels list.
+  (define (unpin-channels channels current-channels names)
+    (if (null? names)
+        channels
+        (let ((available-names (map channel-name
+                                    channels))
+              (selected-channels (filter (lambda (channel)
+                                           (member (channel-name channel)
+                                                   names))
+                                         channels)))
+          (for-each (lambda (name)
+                      (unless (member name available-names)
+                        (warning (G_ "channel '~a~' selected but missing from channel list~%")
+                                 name)))
+                    names)
+
+          (map (lambda (channel)
+                 (let ((selected-channel (find (lambda (ch)
+                                                 (eq? (channel-name ch)
+                                                      (channel-name channel)))
+                                               selected-channels)))
+                   ;; If the user selected this channel, follow channel file
+                   ;; specification. Otherwise, leave the channel pinned as
+                   ;; defined by the current profile.
+                   (or selected-channel
+                       channel)))
+               current-channels))))
 
   (with-error-handling
     (with-git-error-handling
      (let* ((opts         (parse-command-line args %options
-                                              (list %default-options)
-                                              #:argument-handler no-arguments))
+                                              (list %default-options)))
             (substitutes? (assoc-ref opts 'substitutes?))
             (dry-run?     (assoc-ref opts 'dry-run?))
             (profile      (or (assoc-ref opts 'profile) %current-profile))
             (current-channels (profile-channels profile))
             (validate-pull    (assoc-ref opts 'validate-pull))
             (authenticate?    (assoc-ref opts 'authenticate-channels?))
-            (verify-certificate? (assoc-ref opts 'verify-certificate?)))
+            (verify-certificate? (assoc-ref opts 'verify-certificate?))
+            (selected-channels (filter-map
+                                (match-lambda
+                                  (('argument . name) (string->symbol name))
+                                  (_ #f))
+                                opts)))
        (cond
         ((assoc-ref opts 'query)
          (process-query opts profile))
@@ -877,7 +909,9 @@ (define-command (guix-pull . args)
                  (ensure-default-profile)
                  (honor-x509-certificates store)
 
-                 (let* ((channels (channel-list opts))
+                 (let* ((channels (unpin-channels (channel-list opts)
+                                                  current-channels
+                                                  selected-channels))
                         (instances
                          (latest-channel-instances store channels
                                                    #:current-channels

base-commit: ed5988f0d2cf14e3cc35a32e6ad91d7cbf535e2f
-- 
2.49.0





Information forwarded to guix-patches <at> gnu.org:
bug#78580; Package guix-patches. (Wed, 04 Jun 2025 21:33:02 GMT) Full text and rfc822 format available.

Message #47 received at 78580 <at> debbugs.gnu.org (full text, mbox):

From: Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Tobias Geerinckx-Rice <me <at> tobias.gr>, Josselin Poiret <dev <at> jpoiret.xyz>,
 Sergey Trofimov <sarg <at> sarg.org.ru>,
 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 Simon Tournier <zimon.toutoune <at> gmail.com>, Mathieu Othacehe <othacehe <at> gnu.org>,
 Gabriel Wicki <gabriel <at> erlikon.ch>, Christopher Baines <guix <at> cbaines.net>,
 78580 <at> debbugs.gnu.org
Subject: Re: [bug#78580] [PATCH v4] pull: allow filtering which channels to
 pull from the CLI
Date: Wed, 04 Jun 2025 23:32:07 +0200
Hello Ludo, thanks for reviewing my patch!

Ludovic Courtès <ludo <at> gnu.org> writes:
>> +The optional @var{channels} argument filters the list of pulled channels
>> +to those whose names match the given list.
>
> This would need to be clarified.  IIUC, what ‘guix pull A’ does is that
> it updates A but keeps the other channels unchanged, right?
>
> There’s a risk with this practice though: channels are typically tested
> against the latest version of each other.  For example, ‘guix-science’
> in continuous integration is built against the latest ‘guix’; if one
> tries to update ‘guix-science’ without updating ‘guix’, there’s a
> gradient of problems that might occur: it might work fine, or
> substitutes might be missing, or some packages from ‘guix-science’ will
> fail to build, or ‘guix pull’ will fail upfront.

Well, since channels are not updated synchronously and atomically, the
same situation can happen by a pull before channels are
synchronized. Anyways, many users maintain their own channel for testing
packages that are not yet ready to be upstreamed. In this cases, you
usually want to update your channel for quick testing, but you don't
necessarily want to pull the latest Guix, possible leaving your without
substitutes.

All in all, I think providing this interface is un upgrade without
downsides. Channels that are pinned in your channel specification will
remain pinned, so it's really one more layer of control for the
user. For example, it that allows the user to circumvent the unpleasant
update to a substituteless channel configuration.

>> +  (display (G_ "Usage: guix pull [OPTION]... [CHANNELS...]
>> +Download and deploy the latest version of Guix.
>
> “Download and deploy the latest version of Guix, possibly limited to CHANNELS.”
>
>> +If CHANNELS are specified, pull only from channels with those names (e.g.:
>> +'guix pull rde nonguix' pulls only from the 'guix', 'rde', and 'nonguix'
>> +channels as defined in your channel configuration).\n"))
>
> I’d drop this paragraph: ‘--help’ is concise by convention and further
> explanations should go to the manual.
>
>> +  (define (unpin-channels channels current-channels names)
>> +    "Unpin CHANNELS whose name symbol is present in NAMES list.
>> +If NAMES is an empty list, don't filter anything.  Warn when a name is not
>> +available in the channels list."
>
> You can turn the docstring into a comment since it’s not a top-level
> procedure.
>
>> +    (if (null? names)
>> +        channels
>> +        (let ((available-names (map channel-name
>> +                                    channels))
>> +              (selected-channels (filter (lambda (ch)
>> +                                           (member (channel-name ch)
>> +                                                   names))
>> +                                         channels)))
>
> As per our coding conventions (info "(guix) Formatting Code"),
> s/ch/channel/
> but you can shorten the other identifiers: ‘names’, ‘selected’.
>
>> +          (for-each (lambda (name)
>> +                      (unless (member name available-names)
>> +                        (warning (G_ "Channel '~a' not present in channel list~%")
>
> “channel '~a~' selected but missing from channel list~%" (messages are lower-case).
>
>> +          (map (lambda (cur-ch)
>
> s/cur-ch/channel/
>
>> +                 (let ((selected-channel (find (lambda (ch)
>> +                                                 (eq? (channel-name ch)
>> +                                                      (channel-name cur-ch)))
>> +                                               selected-channels)))
>> +                   ;; If the user selected this channel. Follow channel file
>                                                           ^
> Should be a comma.

Alright, I've already sent v5[1] of the patch with all your suggestions.

[1] https://issues.guix.gnu.org/78580#13


Best regards,
Sergio.




This bug report was last modified 8 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.