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




This bug report was last modified 3 days ago.

Previous Next


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