GNU bug report logs - #34295
[PATCH] pull: Specify channels via command-line.

Previous Next

Package: guix-patches;

Reported by: Oleg Pykhalov <go.wigust <at> gmail.com>

Date: Sun, 3 Feb 2019 11:39:01 UTC

Severity: normal

Tags: patch

Done: Oleg Pykhalov <go.wigust <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 34295 in the body.
You can then email your comments to 34295 AT debbugs.gnu.org in the normal way.

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-patches <at> gnu.org:
bug#34295; Package guix-patches. (Sun, 03 Feb 2019 11:39:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Oleg Pykhalov <go.wigust <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sun, 03 Feb 2019 11:39:03 GMT) Full text and rfc822 format available.

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

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Oleg Pykhalov <go.wigust <at> gmail.com>
Subject: [PATCH] pull: Specify channels via command-line.
Date: Sun,  3 Feb 2019 14:37:49 +0300
* guix/scripts/pull.scm (show-help, %options): Add 'channel'.
(channel-list): Use this.
* doc/guix.texi (Invoking guix pull): Document this.
---
 doc/guix.texi         | 10 +++++++++-
 guix/scripts/pull.scm | 45 ++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 53 insertions(+), 2 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 868f1959e8..ee854072e1 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -50,7 +50,7 @@ Copyright @copyright{} 2017 Andy Wingo@*
 Copyright @copyright{} 2017, 2018 Arun Isaac@*
 Copyright @copyright{} 2017 nee@*
 Copyright @copyright{} 2018 Rutger Helling@*
-Copyright @copyright{} 2018 Oleg Pykhalov@*
+Copyright @copyright{} 2018, 2019 Oleg Pykhalov@*
 Copyright @copyright{} 2018 Mike Gerwitz@*
 Copyright @copyright{} 2018 Pierre-Antoine Rouby@*
 Copyright @copyright{} 2018 Gábor Boskovits@*
@@ -3564,6 +3564,14 @@ but it supports the following options:
 Download code from the specified @var{url}, at the given @var{commit} (a valid
 Git commit ID represented as a hexadecimal string), or @var{branch}.
 
+@item --channel=@var{name},@var{url}[,@var{branch}][,@var{commit}]
+Specify channels via command-line arguments ignoring @file{channels.scm}.
+
+@example
+guix pull --channel=guix,https://git.savannah.gnu.org/git/guix.git,branch=staging \
+          --channel=my-personal-packages,https://example.org/personal-packages.git
+@end example
+
 @cindex @file{channels.scm}, configuration file
 @cindex configuration file for channels
 These options are provided for convenience, but you can also specify your
diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index 683ab3f059..36c4967596 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2013, 2014, 2015, 2017, 2018, 2019 Ludovic Courtès <ludo <at> gnu.org>
 ;;; Copyright © 2017 Marius Bakke <mbakke <at> fastmail.com>
+;;; Copyright © 2019 Oleg Pykhalov <go.wigust <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -76,6 +77,9 @@
 Download and deploy the latest version of Guix.\n"))
   (display (G_ "
       --verbose          produce verbose output"))
+  (display (G_ "
+      --channel=CHANNEL,URL[,branch][,commit]
+                         deploy the CHANNEL at URL"))
   (display (G_ "
   -C, --channels=FILE    deploy the channels defined in FILE"))
   (display (G_ "
@@ -128,6 +132,20 @@ Download and deploy the latest version of Guix.\n"))
          (option '("branch") #t #f
                  (lambda (opt name arg result)
                    (alist-cons 'ref `(branch . ,arg) result)))
+         (option '("channel") #t #f
+                 (lambda (opt name arg result . rest)
+                   (let ((list->alist (match-lambda
+                                        ((key value)
+                                         (cons key value)))))
+                     (alist-cons 'channel
+                                 (match (map (cut string-split <> #\=)
+                                             (string-split arg #\,))
+                                   (((name) (url) args ...)
+                                    (map list->alist
+                                         `(("name" ,name)
+                                           ("url" ,url)
+                                           ,@args))))
+                                 result))))
          (option '(#\p "profile") #t #f
                  (lambda (opt name arg result)
                    (alist-cons 'profile (canonicalize-profile arg)
@@ -477,8 +495,33 @@ transformations specified in OPTS (resulting from '--url', '--commit', or
           result
           (leave (G_ "'~a' did not return a list of channels~%") file))))
 
+  (define alist->channel
+    (match-lambda
+      ((_ meta ...)
+       (channel
+        (name (string->symbol (assoc-ref meta "name")))
+        (url (assoc-ref meta "url"))
+        (branch (or (assoc-ref meta "branch") "master"))
+        (commit (assoc-ref meta "commit"))))))
+
+  (define (guix-channel? channel)
+    (case (channel-name channel)
+      ((guix) #t)
+      (else #f)))
+
+  (define channel-options
+    (filter (match-lambda
+              (('channel args ...) #t)
+              (_ #f))
+            opts))
+
   (define channels
-    (cond (file
+    (cond (channel-options
+           (let ((channels (map alist->channel channel-options)))
+             (if (null? (filter guix-channel? channels))
+                 (append channels %default-channels)
+                 channels)))
+          (file
            (load-channels file))
           ((file-exists? default-file)
            (load-channels default-file))
-- 
2.20.1





Information forwarded to guix-patches <at> gnu.org:
bug#34295; Package guix-patches. (Sat, 16 Feb 2019 16:11:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Oleg Pykhalov <go.wigust <at> gmail.com>
Cc: 34295 <at> debbugs.gnu.org
Subject: Re: [bug#34295] [PATCH] pull: Specify channels via command-line.
Date: Sat, 16 Feb 2019 17:10:40 +0100
Hi Oleg,

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

> * guix/scripts/pull.scm (show-help, %options): Add 'channel'.
> (channel-list): Use this.
> * doc/guix.texi (Invoking guix pull): Document this.

Why not, but I wonder if we really want to do this much on the command
line?  Do you personally find it more convenient than having a
channels.scm file?

What do people think?

> +    (cond (channel-options
> +           (let ((channels (map alist->channel channel-options)))
> +             (if (null? (filter guix-channel? channels))
> +                 (append channels %default-channels)
> +                 channels)))

(null? (filter …)) → (not (any guix-channel? channels))

But note that %DEFAULT-CHANNELS possibly contains more than the 'guix
channel so this test is not quite accurate.

Thanks,
Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#34295; Package guix-patches. (Tue, 01 Feb 2022 15:05:02 GMT) Full text and rfc822 format available.

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

From: Ricardo Wurmus <rekado <at> elephly.net>
To: 34295 <at> debbugs.gnu.org
Cc: Oleg Pykhalov <go.wigust <at> gmail.com>,
 Ludovic Courtès <ludo <at> gnu.org>
Subject: [PATCH] pull: Specify channels via command-line.
Date: Tue, 01 Feb 2022 15:46:46 +0100
Hi Oleg,

are you still interested in this patch?

I think it’s going just a little beyond what a command line option
should do, especially considering that with Bash an ad-hoc file handle
could be passed to the channels option.

-- 
Ricardo




Reply sent to Oleg Pykhalov <go.wigust <at> gmail.com>:
You have taken responsibility. (Tue, 01 Feb 2022 16:28:02 GMT) Full text and rfc822 format available.

Notification sent to Oleg Pykhalov <go.wigust <at> gmail.com>:
bug acknowledged by developer. (Tue, 01 Feb 2022 16:28:02 GMT) Full text and rfc822 format available.

Message #16 received at 34295-done <at> debbugs.gnu.org (full text, mbox):

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: Ricardo Wurmus <rekado <at> elephly.net>
Cc: 34295-done <at> debbugs.gnu.org
Subject: Re: [PATCH] pull: Specify channels via command-line.
Date: Tue, 01 Feb 2022 19:27:00 +0300
[Message part 1 (text/plain, inline)]
Hi,

Apologies for this forgotten patch.

Ricardo Wurmus <rekado <at> elephly.net> writes:

> are you still interested in this patch?

No.

> I think it’s going just a little beyond what a command line option
> should do, especially considering that with Bash an ad-hoc file handle
> could be passed to the channels option.

OK, then I'll close the issue.

Thanks,
Oleg.
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 02 Mar 2022 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 56 days ago.

Previous Next


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