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

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Oleg Pykhalov <go.wigust@HIDDEN>; Keywords: patch; dated Sun, 3 Feb 2019 11:39:01 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at 34295 <at> debbugs.gnu.org:


Received: (at 34295) by debbugs.gnu.org; 16 Feb 2019 16:10:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 16 11:10:44 2019
Received: from localhost ([127.0.0.1]:50469 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gv2Y8-0003Hv-GM
	for submit <at> debbugs.gnu.org; Sat, 16 Feb 2019 11:10:44 -0500
Received: from hera.aquilenet.fr ([185.233.100.1]:57552)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1gv2Y6-0003Hn-Vg
 for 34295 <at> debbugs.gnu.org; Sat, 16 Feb 2019 11:10:43 -0500
Received: from localhost (localhost [127.0.0.1])
 by hera.aquilenet.fr (Postfix) with ESMTP id 6A9CB10665;
 Sat, 16 Feb 2019 17:10:42 +0100 (CET)
X-Virus-Scanned: Debian amavisd-new at aquilenet.fr
Received: from hera.aquilenet.fr ([127.0.0.1])
 by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id N6y_jCNTz3zz; Sat, 16 Feb 2019 17:10:41 +0100 (CET)
Received: from ribbon (unknown [IPv6:2a01:e0a:1d:7270:af76:b9b:ca24:c465])
 by hera.aquilenet.fr (Postfix) with ESMTPSA id A353A105BA;
 Sat, 16 Feb 2019 17:10:41 +0100 (CET)
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Oleg Pykhalov <go.wigust@HIDDEN>
Subject: Re: [bug#34295] [PATCH] pull: Specify channels via command-line.
References: <20190203113749.14825-1-go.wigust@HIDDEN>
Date: Sat, 16 Feb 2019 17:10:40 +0100
In-Reply-To: <20190203113749.14825-1-go.wigust@HIDDEN> (Oleg Pykhalov's
 message of "Sun, 3 Feb 2019 14:37:49 +0300")
Message-ID: <87h8d3hfy7.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 34295
Cc: 34295 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

Hi Oleg,

Oleg Pykhalov <go.wigust@HIDDEN> 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 =E2=80=A6)) =E2=86=92 (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=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#34295; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 3 Feb 2019 11:38:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 03 06:38:33 2019
Received: from localhost ([127.0.0.1]:56765 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gqG6a-000500-La
	for submit <at> debbugs.gnu.org; Sun, 03 Feb 2019 06:38:32 -0500
Received: from eggs.gnu.org ([209.51.188.92]:45869)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <go.wigust@HIDDEN>) id 1gqG6Y-0004zn-WA
 for submit <at> debbugs.gnu.org; Sun, 03 Feb 2019 06:38:31 -0500
Received: from lists.gnu.org ([209.51.188.17]:35578)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <go.wigust@HIDDEN>) id 1gqG6S-000432-W6
 for submit <at> debbugs.gnu.org; Sun, 03 Feb 2019 06:38:25 -0500
Received: from eggs.gnu.org ([209.51.188.92]:60242)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <go.wigust@HIDDEN>) id 1gqG6R-0006tP-U9
 for guix-patches@HIDDEN; Sun, 03 Feb 2019 06:38:24 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 URIBL_BLOCKED autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <go.wigust@HIDDEN>) id 1gqG6Q-00041l-AL
 for guix-patches@HIDDEN; Sun, 03 Feb 2019 06:38:23 -0500
Received: from mail-lj1-x243.google.com ([2a00:1450:4864:20::243]:46950)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <go.wigust@HIDDEN>) id 1gqG6P-00040e-OF
 for guix-patches@HIDDEN; Sun, 03 Feb 2019 06:38:22 -0500
Received: by mail-lj1-x243.google.com with SMTP id v15-v6so9326370ljh.13
 for <guix-patches@HIDDEN>; Sun, 03 Feb 2019 03:38:20 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=cC1UxqNXx5IyMVJXjy3tBIiBe5Jp/bPJwTLHlXCE194=;
 b=M78NcfcPQbzmeATZbCgJcDw/vNBfzChK4m4/sThKKU23hmkKH3rp2XfFwFWvX8x5ru
 xZ5MW9kEiQcrtLqqr3zo+fkXyNrhTVlDAkJ8dx1OVGYZ9Hqw183vLD3xv6GX2ws61LgH
 0AjgkkKaNd2D2cE/7R1TkKbfYp5EAoE7ceU2E92eUeiSYIC8NY1Hr9VlIGaKms55VtQ4
 fk7zfTQd/swDo0HFdr1agDvAO6zmcm6s6sOCDhA5uTkBHGIb8b8r69vK0KirIjvYKRC6
 Ctuqy0kwosluPjnWWnJ/jEfJOt/bvM1vOPyFHXFAKW3+x+EzMzTlyQlQTsssxQ3Ggbbg
 V5Sw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=cC1UxqNXx5IyMVJXjy3tBIiBe5Jp/bPJwTLHlXCE194=;
 b=VW2J5bbJClQL/3GRhAN/PGBlLtsL4mVd+knnXPi3kzfRMapnN+mgOB9BtMLgW91urW
 y/R4puV/Rgt8GL3vGpe4G8scly8IXm964glZSXq4d9xnIB6dW2cZZpPT63XZn3ECE6ik
 8VnfD5arHsnhRwzdjP6c/GcpRKhR1qvmNJnpFo5Zc1UCb5XA5IBjJS2Q2oOc9i45Tems
 2osHOF+b6lcmK5Le58dWzF8xh3G92pjoIcVsMwjA5MxqFKwOr0G4gjvaHkD6fd+SXdLx
 jzHCBg1pNEP9ulqOikFpAwf8ql00+yW1lb7mB0TyoJ04A6rXjMLirZOGozXWSJwUjlwO
 To8w==
X-Gm-Message-State: AHQUAub3tR0/Bd3oeKbMEcErCiIJEeC8m6bLn6KDn8Ojw423KKCLzKg6
 6gLDsZ20h7+ww3rufukc5K5dH+PSVzo=
X-Google-Smtp-Source: AHgI3IYHz5juB9z3LtNhr77fKBUV2sHtfORLoWau34XdFZvqIvMsm5U+xBKMLt9dvNtNKdpsGKKCtA==
X-Received: by 2002:a2e:81a:: with SMTP id 26-v6mr19657659lji.14.1549193898355; 
 Sun, 03 Feb 2019 03:38:18 -0800 (PST)
Received: from localhost.localdomain (ppp91-122-127-106.pppoe.avangarddsl.ru.
 [91.122.127.106])
 by smtp.gmail.com with ESMTPSA id z20sm677488lfg.53.2019.02.03.03.38.17
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 03 Feb 2019 03:38:17 -0800 (PST)
From: Oleg Pykhalov <go.wigust@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH] pull: Specify channels via command-line.
Date: Sun,  3 Feb 2019 14:37:49 +0300
Message-Id: <20190203113749.14825-1-go.wigust@HIDDEN>
X-Mailer: git-send-email 2.20.1
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::243
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
Cc: Oleg Pykhalov <go.wigust@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

* 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@HIDDEN>
 ;;; Copyright © 2017 Marius Bakke <mbakke@HIDDEN>
+;;; Copyright © 2019 Oleg Pykhalov <go.wigust@HIDDEN>
 ;;;
 ;;; 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





Acknowledgement sent to Oleg Pykhalov <go.wigust@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#34295; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

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