From unknown Mon Jun 16 23:53:30 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#40373 <40373@debbugs.gnu.org> To: bug#40373 <40373@debbugs.gnu.org> Subject: Status: [PATCH] guix: new command "guix run-script" Reply-To: bug#40373 <40373@debbugs.gnu.org> Date: Tue, 17 Jun 2025 06:53:30 +0000 retitle 40373 [PATCH] guix: new command "guix run-script" reassign 40373 guix-patches submitter 40373 Konrad Hinsen severity 40373 normal tag 40373 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 01 10:09:25 2020 Received: (at submit) by debbugs.gnu.org; 1 Apr 2020 14:09:25 +0000 Received: from localhost ([127.0.0.1]:38523 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jJe3V-0003QT-Lp for submit@debbugs.gnu.org; Wed, 01 Apr 2020 10:09:25 -0400 Received: from lists.gnu.org ([209.51.188.17]:52673) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jJe3T-0003QE-EI for submit@debbugs.gnu.org; Wed, 01 Apr 2020 10:09:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48592) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJe3R-0005YX-Kt for guix-patches@gnu.org; Wed, 01 Apr 2020 10:09:19 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: ** X-Spam-Status: No, score=2.1 required=5.0 tests=BAYES_50,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,SPOOFED_FREEMAIL,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jJe3P-0004xb-Um for guix-patches@gnu.org; Wed, 01 Apr 2020 10:09:17 -0400 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]:33547) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jJe3P-0004w3-GW for guix-patches@gnu.org; Wed, 01 Apr 2020 10:09:15 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 25943449; Wed, 1 Apr 2020 10:09:13 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Wed, 01 Apr 2020 10:09:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.net; h= from:to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=fm3; bh=/vw+qeGgxoW8OimTIRkryNk49Q Jmt4QHr6LqokyhAWo=; b=xJzU/4jKAKiPZV6sak6U5p89PoSgvzd4FCU3KH69s2 iZUjJkgXDglJgTHEzcMhXKkfpBYBNOyOIs21R3rsFQDQDEkjC22rrESykM/VlM38 sSOu2dkUV0qhM7qFGUhv90+dMG4LNXb0sQR1RXhGeNl7QoRqUbiTWDcA8rRCrgC0 WAa05bCbU6VnV4Ml/WYZstpz0f5p9pCOTh8ZtFYKrj7JmRSXD5Hr+M2Y1vRhm1Ua kDiuqr4c+MIV5iyN+IrWCBkwmoyQHPnOEdSRISqiBfDJJHx3INcfMeiq5wSlAT/o WsiQo877vH+DIGlrCH/oq+ZxCFrS5JdRNmSj93Ubevlw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=/vw+qe GgxoW8OimTIRkryNk49QJmt4QHr6LqokyhAWo=; b=z7uM2pPoU+BdkGoi2P7+dv WaTzF0YrdlR2stM9J9kxNGybCCvh9SAG0GxWDFXxYomxDosAItqXcibIuMvXX5Xl jsFLaiMliGsAhZMwvaXfzrfYMZXcOcyjLoqRJRaeE2Mb4olegBnCZDPRaviympSy P+zCQXC4k7jSB4casyW+1af5x8UKMaC8OVmXYDdZt9ul8SaDXQQ580TKLSJkD0Eq gJ3jue7G/U4UT5AaJPhibGfy/YkP2Ux2zdpSZ3cwzhnHeXstmB5XKyyUaBzoD/Nf Cqo58IgxrKe/dRvGb+vmsuj+SnLXGWoqTQhBs74XgFkMMhHP0AoB69bCA7KHaKGA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrtddvgdejvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkfggtgfgsehtqhertddttd ejnecuhfhrohhmpefmohhnrhgrugcujfhinhhsvghnuceokhhonhhrrggurdhhihhnshgv nhesfhgrshhtmhgrihhlrdhnvghtqeenucffohhmrghinhepghhnuhdrohhrghenucfkph epkeeirddvgeejrdduieegrddvgeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghr rghmpehmrghilhhfrhhomhepkhhonhhrrggurdhhihhnshgvnhesfhgrshhtmhgrihhlrd hnvght X-ME-Proxy: Received: from khs-macbook.home (lfbn-idf2-1-714-245.w86-247.abo.wanadoo.fr [86.247.164.245]) by mail.messagingengine.com (Postfix) with ESMTPA id 0CEDB328005D; Wed, 1 Apr 2020 10:09:11 -0400 (EDT) From: Konrad Hinsen To: guix-patches@gnu.org Subject: [PATCH] guix: new command "guix run-script" Date: Wed, 01 Apr 2020 16:09:11 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.24 X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: * guix/scripts/run-script.scm: New file. * Makefile.am: (MODULES): Add it. * doc/guix.texi: Document "guix time-machine" --- Makefile.am | 1 + doc/guix.texi | 32 +++++++++++ guix/scripts/run-script.sc [...] Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: makefile.am] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (konrad.hinsen[at]fastmail.net) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.7 SPF_NEUTRAL SPF: sender does not match SPF record (neutral) -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [209.51.188.17 listed in list.dnswl.org] 2.0 SPOOFED_FREEMAIL No description available. X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * guix/scripts/run-script.scm: New file. * Makefile.am: (MODULES): Add it. * doc/guix.texi: Document "guix time-machine" --- Makefile.am | 1 + doc/guix.texi | 32 +++++++++++ guix/scripts/run-script.scm | 106 ++++++++++++++++++++++++++++++++++++ 3 files changed, 139 insertions(+) create mode 100644 guix/scripts/run-script.scm diff --git a/Makefile.am b/Makefile.am index 344ecdbc42..28ac7344e8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -283,6 +283,7 @@ MODULES =3D \ guix/scripts/container/exec.scm \ guix/scripts/deploy.scm \ guix/scripts/time-machine.scm \ + guix/scripts/run-script.scm \ guix.scm \ $(GNU_SYSTEM_MODULES) =20 diff --git a/doc/guix.texi b/doc/guix.texi index 8cb85fe62c..0a64af24dc 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -235,6 +235,7 @@ Programming Interface * The Store Monad:: Purely functional interface to the store. * G-Expressions:: Manipulating build expressions. * Invoking guix repl:: Fiddling with Guix interactively. +* Invoking guix run-script:: Running Guix scripts. =20 Defining Packages =20 @@ -5347,6 +5348,7 @@ package definitions. * The Store Monad:: Purely functional interface to the store. * G-Expressions:: Manipulating build expressions. * Invoking guix repl:: Fiddling with Guix interactively. +* Invoking guix run-script:: Running Guix scripts. @end menu =20 @node Package Modules @@ -8121,6 +8123,36 @@ Inhibit loading of the @file{~/.guile} file. By def= ault, that configuration file is loaded when spawning a @code{guile} REPL. @end table =20 +@node Invoking guix run-script +@section Invoking @command{guix run-script} + +@cindex script + +The @command{guix run-script} command executes a Guile script +(@pxref{Running Guile Scripts,,, guile, GNU Guile Reference Manual}). +Compared to just launching the @command{guile} command, +@command{guix run-script} guarantees that all the Guix modules +and all its dependencies are available in the search path. + +The general syntax is: + +@example +guix run-script @var{options} @var{file} +@end example + +The available options are as follows: + +@table @code +@item --load-path=3D@var{directory} +@itemx -L @var{directory} +Add @var{directory} to the front of the package module search path +(@pxref{Package Modules}). + +@item -q +Inhibit loading of the @file{~/.guile} file. By default, that +configuration file is loaded before executing the script. +@end table + @c ********************************************************************* @node Utilities @chapter Utilities diff --git a/guix/scripts/run-script.scm b/guix/scripts/run-script.scm new file mode 100644 index 0000000000..2e948da85f --- /dev/null +++ b/guix/scripts/run-script.scm @@ -0,0 +1,106 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2018, 2019, 2020 Ludovic Court=C3=A8s +;;; Copyright =C2=A9 2020 Konrad Hinsen +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (guix scripts run-script) + #:use-module (guix ui) + #:use-module (guix scripts) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-37) + #:use-module (ice-9 match) + #:export (guix-run-script)) + +;;; Commentary: +;;; +;;; This command allows to run Guile scripts in an environment +;;; that contains all the modules comprising Guix. + +(define %default-options + '()) + +(define %options + (list (option '(#\h "help") #f #f + (lambda args + (show-help) + (exit 0))) + (option '(#\V "version") #f #f + (lambda args + (show-version-and-exit "guix run-script"))) + (option '(#\q) #f #f + (lambda (opt name arg result) + (alist-cons 'ignore-dot-guile? #t result))) + (option '(#\L "load-path") #t #f + (lambda (opt name arg result) + ;; XXX: Imperatively modify the search paths. + (set! %load-path (cons arg %load-path)) + (set! %load-compiled-path (cons arg %load-compiled-path)) + result)))) + + +(define (show-help) + (display (G_ "Usage: guix run-script [OPTIONS...] FILE +Run FILE as a Guile script in the Guix execution environment.\n")) + (display (G_ " + -q inhibit loading of ~/.guile")) + (newline) + (display (G_ " + -L, --load-path=3DDIR prepend DIR to the package module search path")) + (newline) + (display (G_ " + -h, --help display this help and exit")) + (display (G_ " + -V, --version display version information and exit")) + (newline) + (show-bug-report-information)) + +(define user-module + ;; Module where we execute user code. + (let ((module (resolve-module '(guix-user) #f #f #:ensure #t))) + (beautify-user-module! module) + module)) + + +(define (guix-run-script . args) + (define opts + (args-fold* args %options + (lambda (opt name arg result) + (leave (G_ "~A: unrecognized option~%") name)) + (lambda (arg result) + (when (assq 'argument result) + (leave (G_ "~A: extraneous argument~%") arg)) + (alist-cons 'argument arg result)) + %default-options)) + + (define script + (or (assq-ref opts 'argument) + (leave (G_ "no script filename specified~%")))) + + (define user-config + (and=3D> (getenv "HOME") + (lambda (home) + (string-append home "/.guile")))) + + (with-error-handling + (save-module-excursion + (lambda () + (set-current-module user-module) + (when (and (not (assoc-ref opts 'ignore-dot-guile?)) + user-config + (file-exists? user-config)) + (load user-config)) + (load script))))) --=20 2.26.0 From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 01 17:00:41 2020 Received: (at 40373) by debbugs.gnu.org; 1 Apr 2020 21:00:41 +0000 Received: from localhost ([127.0.0.1]:38735 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jJkTZ-0002GG-G2 for submit@debbugs.gnu.org; Wed, 01 Apr 2020 17:00:41 -0400 Received: from eggs.gnu.org ([209.51.188.92]:41029) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jJkTX-0002Fz-C6 for 40373@debbugs.gnu.org; Wed, 01 Apr 2020 17:00:39 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:40956) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jJkTS-0002fa-5H; Wed, 01 Apr 2020 17:00:34 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=53776 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jJkTQ-0007fg-6N; Wed, 01 Apr 2020 17:00:33 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Konrad Hinsen Subject: Re: [bug#40373] [PATCH] guix: new command "guix run-script" References: Date: Wed, 01 Apr 2020 23:00:29 +0200 In-Reply-To: (Konrad Hinsen's message of "Wed, 01 Apr 2020 16:09:11 +0200") Message-ID: <875zeiudjm.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 40373 Cc: 40373@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi Konrad, Konrad Hinsen skribis: > +The @command{guix run-script} command executes a Guile script > +(@pxref{Running Guile Scripts,,, guile, GNU Guile Reference Manual}). > +Compared to just launching the @command{guile} command, > +@command{guix run-script} guarantees that all the Guix modules > +and all its dependencies are available in the search path. What about making that just a new =E2=80=98-s=E2=80=99 flag for =E2=80=98gu= ix repl=E2=80=99 (just like Guile=E2=80=99s =E2=80=98-s=E2=80=99 flag)? =E2=80=98-q=E2=80=99 should al= ways be implied when doing that. Now, this wouldn=E2=80=99t be usable as a shebang due to the fact that only= one argument is allowed, unless we do some extra argument tokenizing. Thanks, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 02 03:13:31 2020 Received: (at 40373) by debbugs.gnu.org; 2 Apr 2020 07:13:31 +0000 Received: from localhost ([127.0.0.1]:39064 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jJu2d-0004ab-AW for submit@debbugs.gnu.org; Thu, 02 Apr 2020 03:13:31 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:49405) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jJu2c-0004aE-H9 for 40373@debbugs.gnu.org; Thu, 02 Apr 2020 03:13:30 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 70C325C0286; Thu, 2 Apr 2020 03:13:25 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 02 Apr 2020 03:13:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.net; h= from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type:content-transfer-encoding; s=fm3; bh= qTyedekAuzUYqGt4Z1lExz/rqh/xMPEu9WetxSGZp7w=; b=pCkCmAs3ZY+v4xa4 YsUAhjPyfW/LdOz7+QHMyTIxaO8kRKIbYyKFZxzhT2wwhD7hj8A/mmbZIjC8wzkT P4xhLje8BnAdjAcaIecfBqAQtRc5SsxR+GlmWp85njCfh6kTl0HEUKm+xwe0lPXf x9UxRjt3tOs+Kf3L8hlFEUYSfVERecaA2/DVLGI5dajK/iUlbceIlPd7WIadKGEP VqD5yidZqGHG21gTG7nJA58dOcTSzfzNhwruESVLpBpOKMVPbYMzVw8pyEXj2uj6 6lb+qeezGHcaRv3rg+o0zUqVBt30YJw+DCfPwcvqupZtmvi2KNYcb4vWoqLZMVoG x8fYJQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=qTyedekAuzUYqGt4Z1lExz/rqh/xMPEu9WetxSGZp 7w=; b=fZoiDVQarRjKAq6nKOrfD+N4BDcv7L5nyAFYDhP4xLSW8OT70W0hbtQEv fVxelyHNe0lzrAyPOotjXzScs86RA8Etd0L3EjMsscR/BbrFAZccz1qrZ/15KQ7E 50ZTcW2yVi2LojpLGFo+y/73IwWam+/m+W88T2TyaBw6/P5HAqp+l187ouQVA+k/ ztTfdXLsehJDs9JQueMRR6LQsAy9MnZRC2SU7xbZKzlPfPGyhT8nXjeujBbBbcAK hkodzDKej+HYYHZMg5Uz9oLRumSQnAtW3EqpFpXBn/bbZLsuasPB/djLZfdr0XB9 pgzKlAIwFMy7Vyud9FdSCdW1DsNcw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrtdefgdduudejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufgjfhffkfggtgfgsehtqhertddttdejnecuhfhrohhmpefmohhnrhgr ugcujfhinhhsvghnuceokhhonhhrrggurdhhihhnshgvnhesfhgrshhtmhgrihhlrdhnvg htqeenucfkphepkeeirddvgeejrdduieegrddvgeehnecuvehluhhsthgvrhfuihiivgep tdenucfrrghrrghmpehmrghilhhfrhhomhepkhhonhhrrggurdhhihhnshgvnhesfhgrsh htmhgrihhlrdhnvght X-ME-Proxy: Received: from khs-macbook.home (lfbn-idf2-1-714-245.w86-247.abo.wanadoo.fr [86.247.164.245]) by mail.messagingengine.com (Postfix) with ESMTPA id 92137306CD98; Thu, 2 Apr 2020 03:13:24 -0400 (EDT) From: Konrad Hinsen To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#40373] [PATCH] guix: new command "guix run-script" In-Reply-To: <875zeiudjm.fsf@gnu.org> References: <875zeiudjm.fsf@gnu.org> Date: Thu, 02 Apr 2020 09:13:23 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 40373 Cc: 40373@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi Ludo, > What about making that just a new =E2=80=98-s=E2=80=99 flag for =E2=80=98= guix repl=E2=80=99 (just like > Guile=E2=80=99s =E2=80=98-s=E2=80=99 flag)? =E2=80=98-q=E2=80=99 should = always be implied when doing that. > > Now, this wouldn=E2=80=99t be usable as a shebang due to the fact that on= ly one > argument is allowed, unless we do some extra argument tokenizing. That is one reason why I opted for a separate command. The other is that I am in tutorial-driven development mode: I need "guix run-script" in order to be able to insert my own scripts (for analyzing dependencies) into a Guix tutorial for an upcoming MOOC. So I need to make sure that people can run my scripts easily, but also that they understand what they are doing. A command that does something else than its name suggests, with a similarity that is only visible to experts, is no good for use in a tutorial. BTW, I opted for a lengthy name ("run-script" rather than just "run" or "script") according to the principle that short words should be left for frequently used concepts (a principle respected by human languages, but also by Lisp tradition). I am of course aware that much of the code in "run-script" is the same as in "repl", which is not good. But I'd rather think about a better framework for code sharing among Guix scripts than about pushing too much semantic differences into obscure options. An example would be reusable "option clusters", such as "options for Guile" or "options for channels". Cheers, Konrad. From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 02 05:08:34 2020 Received: (at 40373) by debbugs.gnu.org; 2 Apr 2020 09:08:34 +0000 Received: from localhost ([127.0.0.1]:39169 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jJvpx-0002X3-R8 for submit@debbugs.gnu.org; Thu, 02 Apr 2020 05:08:34 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:39923) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jJvpw-0002Wp-Kc for 40373@debbugs.gnu.org; Thu, 02 Apr 2020 05:08:32 -0400 Received: by mail-qt1-f195.google.com with SMTP id f20so2628918qtq.6 for <40373@debbugs.gnu.org>; Thu, 02 Apr 2020 02:08:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=RGYWyJWoTZtKrWmtv7WXmJGv9k7GAQOSj/kglSnyS7Y=; b=qdWt07gIxz6yhwS3WaOXhuzK9jHNaEYSL3kLT/DXaH82ZvuvALFcWkp/1hrtr1+Rmg prJW+Aob1XkHvwITmqZ8+7DJ2Q3nYo7SDjek5uxLRQJjFhJHJ+q+jTL1SS6FqQ58CDgR fXTixeb7WiUlFGrSfAcFSJLcmt+5b9dkLTS0feaLjBy51azfocYMxmB5T62rmkgbyIqy 3PiiWniA7T+iwIh0sFQtpg6R3hWCTyTf3BHucEgDWPxQG/lIlpCcvDngpQfy7JvDz0b3 ia8nrBWEZpTb4iwQIcdVT2+YzugU7MPZRgaC5QXutnZ7qrzn6eBLX6STCdU8VX0Wr0i9 Eszg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=RGYWyJWoTZtKrWmtv7WXmJGv9k7GAQOSj/kglSnyS7Y=; b=rpK+MEA3rWo5MWFK9Jf0jO5sz41DrOmR1TKuGk0rEkKIhxhSZl5SZla0+i4fATmLk6 B5+IVATpHEsIHOMvW6Ks0c2uF6kEi1DIPW5w0kcT4zVWTapYFLkeo2X7XdSzPgoFJaJM lfs2/0o0f03b1d7X5pgtpPcdK3qXazIWXsiJic/Xj3rRFEGPsWHlKNTDqVnnfsPr+nWr 5oDNfkBwJ6+mv18xTxiPJqLMVDguT6kQJO8P1F1A+667N/828u522Zmjn71v0k+ym+iv 7S6QkCwwXlwjqkE6f8JCiMdYsR23E8KmOYOL6gLuenwWSLQBpw1Xa8Y76osZr/qHo4GC Zjug== X-Gm-Message-State: AGi0PualHDVGK5V+moXa3IIqB45nphYVI3wpwuz8g6AFH2uTMoelPDY7 8BDKVvi7wJ+IX0GsI5pnN4j+Y4eiSPXCVw3injE= X-Google-Smtp-Source: APiQypJvqh2ocTeuyXuVaVehY/izq/zWYu2yjNxldx6JWzL5GKaXreN6w3HAceb0XbZr6yPYVb3p6tHNKiTg11SvNQk= X-Received: by 2002:ac8:38cc:: with SMTP id g12mr1887006qtc.186.1585818507001; Thu, 02 Apr 2020 02:08:27 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: zimoun Date: Thu, 2 Apr 2020 11:08:15 +0200 Message-ID: Subject: Re: [bug#40373] [PATCH] guix: new command "guix run-script" To: Konrad Hinsen Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 40373 Cc: 40373@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Konrad, On Wed, 1 Apr 2020 at 16:10, Konrad Hinsen wro= te: > > * guix/scripts/run-script.scm: New file. > * Makefile.am: (MODULES): Add it. > * doc/guix.texi: Document "guix time-machine" Wrong copy/paste? Is it not "run-script" instead of "time-machine"? > --- /dev/null > +++ b/guix/scripts/run-script.scm > @@ -0,0 +1,106 @@ > +;;; GNU Guix --- Functional package management for GNU > +;;; Copyright =C2=A9 2018, 2019, 2020 Ludovic Court=C3=A8s > +;;; Copyright =C2=A9 2020 Konrad Hinsen Why Copyright 2018, 2019 is the file is new? And why Ludo is mentioned here? Cheers, simon From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 02 05:17:40 2020 Received: (at 40373) by debbugs.gnu.org; 2 Apr 2020 09:17:40 +0000 Received: from localhost ([127.0.0.1]:39186 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jJvym-00031m-CY for submit@debbugs.gnu.org; Thu, 02 Apr 2020 05:17:40 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:46064) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jJvyj-00031H-Sz for 40373@debbugs.gnu.org; Thu, 02 Apr 2020 05:17:38 -0400 Received: by mail-qk1-f194.google.com with SMTP id o18so329497qko.12 for <40373@debbugs.gnu.org>; Thu, 02 Apr 2020 02:17:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=4YLfIyNnQ9FgjFTv51JJEL8Kd3076DemmPhHpplM3XM=; b=beIxD58mX9r6lu52kHpnmLFBjPZCbYDPSrrxYh804bzln545lE2Fic95kTYplxk0Rc WwSZfTR7EYsbfSnV3vFjDb6LR83WOG08RVc5RENalXeKbRu93pMc2grozYSUbR4uP+Fq o5Y6ZSUJaWqA6EexbxjPVYw0ua84dHHX1mJZy0QRD4rqm08bRuLpgfMIESU244B8ADCR BmiUbHswaBKsGgcpk/e1VP9WXmxdmME6ohv7ATWYbTRZqJeBEl7xIeIdRtubrRxS2++Q rzuJGB3IGClJPmQ4pXrB2j//vhOcZxtvGUDxoxT4XWo6d3sIhEiKHy/+twXfhGMF/aHc k/eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=4YLfIyNnQ9FgjFTv51JJEL8Kd3076DemmPhHpplM3XM=; b=nUuz8o0qbsE1PQ1XYggohGb9m1Sym3DC6+Qj81JTTDtYRA5daqA4dChjAbfN7ZtJ+B kTeLeF0s53ruZip8lv8qbITFAP6Fpd8lR+ATAluwQRfDL16oWgi88b5zZl8nIBiqbqxD 6Nt/Mfq7Ab2oBFHv8wesoOt+Pd2nWw4Ni7ACFHC8HiW/Vfbk4hBND5krTwgpjBGc7uo6 T6UYSVeo5qLbVmswzTv6YWPXxno2XWJPLQ6zRv/bVHGXLgT3XSKs/4AIomcbBJLJIJse 2+9nMS6Yi+WmAwRsXOnq9pNtJ/sjp5cSy/vv5YZ/5P9nFMWNkRzUiODpqwU9Bv0bHES4 CKyw== X-Gm-Message-State: AGi0Pua8RRq56TWqNG/FttrB/BtukJbR1RCqO4QbR/nXTj1OzzbhncTv wD5/wrFNHfIMBvsbsD2wqvI823q87WR5nv19x7Y= X-Google-Smtp-Source: APiQypLbOkhsIfzT/1/u7WEX/S9YyjN3wHKM25nJaiP1PDMwv+hJN2Uu6PMG3npNnQxcJEHalbBeUiLMQDxTit17x2o= X-Received: by 2002:a05:620a:5fd:: with SMTP id z29mr810633qkg.201.1585819051214; Thu, 02 Apr 2020 02:17:31 -0700 (PDT) MIME-Version: 1.0 References: <875zeiudjm.fsf@gnu.org> In-Reply-To: From: zimoun Date: Thu, 2 Apr 2020 11:17:19 +0200 Message-ID: Subject: Re: [bug#40373] [PATCH] guix: new command "guix run-script" To: Konrad Hinsen Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 40373 Cc: =?UTF-8?Q?Ludovic_Court=C3=A8s?= , 40373@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Konrad, On Thu, 2 Apr 2020 at 09:14, Konrad Hinsen wro= te: > > What about making that just a new =E2=80=98-s=E2=80=99 flag for =E2=80= =98guix repl=E2=80=99 (just like > > Guile=E2=80=99s =E2=80=98-s=E2=80=99 flag)? =E2=80=98-q=E2=80=99 shoul= d always be implied when doing that. > > > > Now, this wouldn=E2=80=99t be usable as a shebang due to the fact that = only one > > argument is allowed, unless we do some extra argument tokenizing. > > That is one reason why I opted for a separate command. > > The other is that I am in tutorial-driven development mode: I need "guix > run-script" in order to be able to insert my own scripts (for analyzing > dependencies) into a Guix tutorial for an upcoming MOOC. So I need to > make sure that people can run my scripts easily, but also that they > understand what they are doing. A command that does something else than > its name suggests, with a similarity that is only visible to experts, > is no good for use in a tutorial. > > BTW, I opted for a lengthy name ("run-script" rather than just "run" or > "script") according to the principle that short words should be left for > frequently used concepts (a principle respected by human languages, but > also by Lisp tradition). > > I am of course aware that much of the code in "run-script" is the same > as in "repl", which is not good. But I'd rather think about a better > framework for code sharing among Guix scripts than about pushing too > much semantic differences into obscure options. An example would be > reusable "option clusters", such as "options for Guile" or "options for > channels". Initially, I thought the same as Ludo: "run-script" should be an option to "repl". And I understand your UI concerns. Maybe, we could deprecated "repl" and add "run" with: - guix run (same than the "guix run-script" proposal) - guix run or guix run --repl doing the what "guix repl" does. The new command "guix run" could have more or less the same option than "guile" but prepending all the paths correctly. I mean we need something like "guix name-it " mimicking "guile " adding the correct Guix modules, IMHO. BTW, thank you for this. Because it was missing in my toolbox and I was annoyed until now. Cheers, simon From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 02 05:21:35 2020 Received: (at 40373) by debbugs.gnu.org; 2 Apr 2020 09:21:35 +0000 Received: from localhost ([127.0.0.1]:39196 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jJw2Z-0003G5-8X for submit@debbugs.gnu.org; Thu, 02 Apr 2020 05:21:35 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:41043) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jJw2X-0003Fc-3c for 40373@debbugs.gnu.org; Thu, 02 Apr 2020 05:21:34 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id DF9975C0175; Thu, 2 Apr 2020 05:21:27 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Thu, 02 Apr 2020 05:21:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.net; h= from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; s=fm3; bh=ZgSLLARF5SmTHoss/azvNhsfNF 3jjjYxGAk0Gtc/whs=; b=jaaUvS3vjnzWPPYkZt+errGgc7FXyF+XSZr+YJDC6N 2q1ZyOazT1hAlpIg6vn+LWRQbqdt46YCsEfS4+DELxDzIAmhGfJNINOBLXDfAklY f78AmbEdmsS6C64VixVP1lNOb6PBWK287FbP2eLwGaLsbd3O0yn4wc+H5q8IBi8Y 1yLkPG8Kr9yt5jBdmnCrlQ1oEN1LqUK1rSFl2EOGHW89qase1RBMO86Z6nUIcV1q NU7SF4J++f24gxd3HZftoDxZW93GjWuJxzchPamy86epIDedKH1KH79plXdhED7L A+vikXN3zWRJfPCo/6iueT9VGohEljEuDxwxEfGNLDpg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=ZgSLLA RF5SmTHoss/azvNhsfNF3jjjYxGAk0Gtc/whs=; b=GEUdc8xgv/PYLEGuQ+eC0Q CW/HQtbbOTMaoS2f1wkrh/4bNLm4jUcKdOqDXesYj6mJ+j1nr3m2YV82je6N0b/3 DsvieKbo/FJoqlq0HeWxtta+FUcUUWqbK+aff0Zz59fspD8oV+BGJ0ApVQKrKljp ZdCtQTSM4ZO5USLkKgk1L5DdarM7ZGmty3APUs2F3zIf5uxqczcNKo9IvO98HLcH 7EyeddPmtJ4FjzJsrCvjzCmBRa7TjZ08VFSwdDAmGSuD8o4ogCaGFEtpBJAhUFgZ B44wF/9AnUZq+YC1ZJBIIzB0A9WUn1Ct30x35ceiQmy2H5SX+71c/HdAVrWyWJtg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrtdeggddtlecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufgjfhffkfggtgesthdtredttd dttdenucfhrhhomhepmfhonhhrrgguucfjihhnshgvnhcuoehkohhnrhgrugdrhhhinhhs vghnsehfrghsthhmrghilhdrnhgvtheqnecukfhppeekiedrvdegjedrudeigedrvdeghe enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehkohhn rhgrugdrhhhinhhsvghnsehfrghsthhmrghilhdrnhgvth X-ME-Proxy: Received: from khs-macbook.home (lfbn-idf2-1-714-245.w86-247.abo.wanadoo.fr [86.247.164.245]) by mail.messagingengine.com (Postfix) with ESMTPA id 54FC73280064; Thu, 2 Apr 2020 05:21:27 -0400 (EDT) From: Konrad Hinsen To: zimoun Subject: Re: [bug#40373] [PATCH] guix: new command "guix run-script" In-Reply-To: References: Date: Thu, 02 Apr 2020 11:21:26 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 40373 Cc: 40373@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi Simon, > Wrong copy/paste? Exactly. Same for the next point. Update coming. Cheers, Konrad. From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 02 05:26:07 2020 Received: (at 40373) by debbugs.gnu.org; 2 Apr 2020 09:26:07 +0000 Received: from localhost ([127.0.0.1]:39203 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jJw6w-0003VP-QT for submit@debbugs.gnu.org; Thu, 02 Apr 2020 05:26:07 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:33307) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jJw6u-0003Uh-US for 40373@debbugs.gnu.org; Thu, 02 Apr 2020 05:26:05 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id A0B5E5C01A5; Thu, 2 Apr 2020 05:25:59 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Thu, 02 Apr 2020 05:25:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.net; h= from:to:subject:in-reply-to:references:date:message-id :mime-version:content-type:content-transfer-encoding; s=fm3; bh= bsQcCdvPflSXfDZhwlejprCsgBaItrEvCCB5qlgNM6o=; b=r3d6+EoVFELr7XoH 9lpbrDYxbL2ucbzJYyEfcEF+PVdGvbc4b4FeHa6TruTIgGTOrxg3yqntIm+NnQmH 8M7A3IUJOfwATduQXx6celkH3n2pxLtpqnSzIevL6aJ6gsBc3cmtsv0AqUVf3waY h0MPIaW9Vjw0pP/NwayrGOKDElEXQkLPV13+JM1IvDI6TRVIMV7aDhwGRrlkgBr3 GV6Rf6qiaITQAcSnIHrg8hw/wVIQidt+wHbGn/AVGqVsfE4U54JXbBHCFTZU5Qye 91DgGOwp5CPbfFE2wTmAdbQzKT1Y9/Zb5Q7KFrzKl+c9aBZa4226/tuduOQ8jhtU gshS7w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=bsQcCdvPflSXfDZhwlejprCsgBaItrEvCCB5qlgNM 6o=; b=lZBs2vl4hKVeQFK0rWTXFStrVEvpl0vTgXcB/05Tl6ZBAcg5yFd0F/aZQ S/dg8sbAvbBmQ528S3/eFEUJMHwZFAMavgY1VdNmgHQJAzjVzZWKP14iNx6n7LG6 VxZEwxJLXQ/DSDZgh2L9f/79bnJPObpc606Zc9SEH5SRf/ynKPgfr4MxahNq1USe lmQTghXpgu4UtUK419cC0f1e37nriBhZEA1OIDtGOgV65fpom4U9zXMAg+y74aa/ t2iOYQA86IK6rYaY6WFpbH/tyjdFklk4vyYnvWLtQAUFlU7k7B6uBntvmLKdaVYH HQK5PzUvSPcaJr+xfJPY3eedEXobg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrtdeggddutdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufgjfhffkfggtgfgsehtqhertd dttdejnecuhfhrohhmpefmohhnrhgrugcujfhinhhsvghnuceokhhonhhrrggurdhhihhn shgvnhesfhgrshhtmhgrihhlrdhnvghtqeenucffohhmrghinhepghhnuhdrohhrghenuc fkphepkeeirddvgeejrdduieegrddvgeehnecuvehluhhsthgvrhfuihiivgeptdenucfr rghrrghmpehmrghilhhfrhhomhepkhhonhhrrggurdhhihhnshgvnhesfhgrshhtmhgrih hlrdhnvght X-ME-Proxy: Received: from khs-macbook.home (lfbn-idf2-1-714-245.w86-247.abo.wanadoo.fr [86.247.164.245]) by mail.messagingengine.com (Postfix) with ESMTPA id E9EBE3280065; Thu, 2 Apr 2020 05:25:58 -0400 (EDT) From: Konrad Hinsen To: 40373@debbugs.gnu.org Subject: [PATCH] guix: new command "guix run-script" In-Reply-To: References: Date: Thu, 02 Apr 2020 11:25:44 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 40373 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * guix/scripts/run-script.scm: New file. * Makefile.am: (MODULES): Add it. * doc/guix.texi: Document "guix run-script" --- Makefile.am | 1 + doc/guix.texi | 32 +++++++++++ guix/scripts/run-script.scm | 105 ++++++++++++++++++++++++++++++++++++ 3 files changed, 138 insertions(+) create mode 100644 guix/scripts/run-script.scm diff --git a/Makefile.am b/Makefile.am index 344ecdbc42..28ac7344e8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -283,6 +283,7 @@ MODULES =3D \ guix/scripts/container/exec.scm \ guix/scripts/deploy.scm \ guix/scripts/time-machine.scm \ + guix/scripts/run-script.scm \ guix.scm \ $(GNU_SYSTEM_MODULES) =20 diff --git a/doc/guix.texi b/doc/guix.texi index 8cb85fe62c..0a64af24dc 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -235,6 +235,7 @@ Programming Interface * The Store Monad:: Purely functional interface to the store. * G-Expressions:: Manipulating build expressions. * Invoking guix repl:: Fiddling with Guix interactively. +* Invoking guix run-script:: Running Guix scripts. =20 Defining Packages =20 @@ -5347,6 +5348,7 @@ package definitions. * The Store Monad:: Purely functional interface to the store. * G-Expressions:: Manipulating build expressions. * Invoking guix repl:: Fiddling with Guix interactively. +* Invoking guix run-script:: Running Guix scripts. @end menu =20 @node Package Modules @@ -8121,6 +8123,36 @@ Inhibit loading of the @file{~/.guile} file. By def= ault, that configuration file is loaded when spawning a @code{guile} REPL. @end table =20 +@node Invoking guix run-script +@section Invoking @command{guix run-script} + +@cindex script + +The @command{guix run-script} command executes a Guile script +(@pxref{Running Guile Scripts,,, guile, GNU Guile Reference Manual}). +Compared to just launching the @command{guile} command, +@command{guix run-script} guarantees that all the Guix modules +and all its dependencies are available in the search path. + +The general syntax is: + +@example +guix run-script @var{options} @var{file} +@end example + +The available options are as follows: + +@table @code +@item --load-path=3D@var{directory} +@itemx -L @var{directory} +Add @var{directory} to the front of the package module search path +(@pxref{Package Modules}). + +@item -q +Inhibit loading of the @file{~/.guile} file. By default, that +configuration file is loaded before executing the script. +@end table + @c ********************************************************************* @node Utilities @chapter Utilities diff --git a/guix/scripts/run-script.scm b/guix/scripts/run-script.scm new file mode 100644 index 0000000000..2e0ef2aff3 --- /dev/null +++ b/guix/scripts/run-script.scm @@ -0,0 +1,105 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2020 Konrad Hinsen +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (guix scripts run-script) + #:use-module (guix ui) + #:use-module (guix scripts) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-37) + #:use-module (ice-9 match) + #:export (guix-run-script)) + +;;; Commentary: +;;; +;;; This command allows to run Guile scripts in an environment +;;; that contains all the modules comprising Guix. + +(define %default-options + '()) + +(define %options + (list (option '(#\h "help") #f #f + (lambda args + (show-help) + (exit 0))) + (option '(#\V "version") #f #f + (lambda args + (show-version-and-exit "guix run-script"))) + (option '(#\q) #f #f + (lambda (opt name arg result) + (alist-cons 'ignore-dot-guile? #t result))) + (option '(#\L "load-path") #t #f + (lambda (opt name arg result) + ;; XXX: Imperatively modify the search paths. + (set! %load-path (cons arg %load-path)) + (set! %load-compiled-path (cons arg %load-compiled-path)) + result)))) + + +(define (show-help) + (display (G_ "Usage: guix run-script [OPTIONS...] FILE +Run FILE as a Guile script in the Guix execution environment.\n")) + (display (G_ " + -q inhibit loading of ~/.guile")) + (newline) + (display (G_ " + -L, --load-path=3DDIR prepend DIR to the package module search path")) + (newline) + (display (G_ " + -h, --help display this help and exit")) + (display (G_ " + -V, --version display version information and exit")) + (newline) + (show-bug-report-information)) + +(define user-module + ;; Module where we execute user code. + (let ((module (resolve-module '(guix-user) #f #f #:ensure #t))) + (beautify-user-module! module) + module)) + + +(define (guix-run-script . args) + (define opts + (args-fold* args %options + (lambda (opt name arg result) + (leave (G_ "~A: unrecognized option~%") name)) + (lambda (arg result) + (when (assq 'argument result) + (leave (G_ "~A: extraneous argument~%") arg)) + (alist-cons 'argument arg result)) + %default-options)) + + (define script + (or (assq-ref opts 'argument) + (leave (G_ "no script filename specified~%")))) + + (define user-config + (and=3D> (getenv "HOME") + (lambda (home) + (string-append home "/.guile")))) + + (with-error-handling + (save-module-excursion + (lambda () + (set-current-module user-module) + (when (and (not (assoc-ref opts 'ignore-dot-guile?)) + user-config + (file-exists? user-config)) + (load user-config)) + (load script))))) --=20 2.26.0 From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 02 05:37:26 2020 Received: (at 40373) by debbugs.gnu.org; 2 Apr 2020 09:37:26 +0000 Received: from localhost ([127.0.0.1]:39212 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jJwHu-00047e-An for submit@debbugs.gnu.org; Thu, 02 Apr 2020 05:37:26 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:34957) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jJwHt-00047N-97 for 40373@debbugs.gnu.org; Thu, 02 Apr 2020 05:37:25 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 2C9FF5C0244; Thu, 2 Apr 2020 05:37:20 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 02 Apr 2020 05:37:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.net; h= from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; s=fm3; bh=/WU79Y1kyDQuccLdri4aQbC6Dh O1arG3/ngcekmeVtw=; b=NRoef/Mg/Grzuj/0FxttNHwBVPk80+8H4yp1J/4flx HgGlKMBcfxwgye3WskjKM8FrT5D2QJJBtyGLwVQD+HtWT+0iwyYIMJ5SODeG9C4e r+OHUxP9ZwszLbXAnla0glJejD/3krSKaGKYfQEybjn6XRsuYoR8q0uQjWSQeQmc W9wgzeJ9wBqGEeNckTnBMMXV5BKlFApkhRbvDj9Rlfh6qX5Czrz4i96gsU38C6ve vIkKP+00BUEJjvSXgZFsguaFs8BX3LYVv9WMPeXTebMdraQQjVnR7vlUuO/5a937 vngBJzKqGUjvmo4WFGpTxwIjUdFqo1y+3p16R8efMkLw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=/WU79Y 1kyDQuccLdri4aQbC6DhO1arG3/ngcekmeVtw=; b=RAuIeWII4Ccl+/ITc4XOHB cmidUVSizn6bLoJJH+AObWa/6mfCr1IrQvOUEL4dzj1nYjIRYDy4ZTN2NBkVA6ju m8ervjZ0aucHhcbgbMAjWWBFkOaPNBgfGVmsqMkhn6md8Rplgi9e5d7vv5pK8Iff 5lXNfhoNtL43ywjLB/dr9g3MMSroIcylMhkSZl/YZ3LGwbcqPGhgZ6gFmjHiTZ7y uxXxCuM7Nq0O8hSFKiPDWVHC1qXLgvDkxJ7LvIxw0X7fwMsD66YSvYvBOsQ1vImv vmLihdDr+zU9uBjJOe1EyJrg67aRMFLUZwNt2D1KpcW0x9uYwx+WaRPaByzfeeLg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrtdeggddufecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffujghffffkgggtsehttdertddttddtnecuhfhrohhmpefmohhnrhgrugcu jfhinhhsvghnuceokhhonhhrrggurdhhihhnshgvnhesfhgrshhtmhgrihhlrdhnvghtqe enucfkphepkeeirddvgeejrdduieegrddvgeehnecuvehluhhsthgvrhfuihiivgeptden ucfrrghrrghmpehmrghilhhfrhhomhepkhhonhhrrggurdhhihhnshgvnhesfhgrshhtmh grihhlrdhnvght X-ME-Proxy: Received: from khs-macbook.home (lfbn-idf2-1-714-245.w86-247.abo.wanadoo.fr [86.247.164.245]) by mail.messagingengine.com (Postfix) with ESMTPA id 6E5B0306CDE1; Thu, 2 Apr 2020 05:37:19 -0400 (EDT) From: Konrad Hinsen To: zimoun Subject: Re: [bug#40373] [PATCH] guix: new command "guix run-script" In-Reply-To: References: <875zeiudjm.fsf@gnu.org> Date: Thu, 02 Apr 2020 11:37:18 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 40373 Cc: Ludovic =?utf-8?Q?Court=C3=A8s?= , 40373@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi Simon, > Maybe, we could deprecated "repl" and add "run" with: > - guix run (same than the "guix run-script" proposal) > - guix run or guix run --repl doing the what "guix repl" does. Yes, unifying the two functionalities under a new name is an interesting options. Could we go for "guix guile" and make it option-compatible with plain Guile as much as possible? Just an idea, I am not sure it's a good one! Guile can already be a pain in a shebang line. Cheers, Konrad From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 03 05:18:07 2020 Received: (at 40373) by debbugs.gnu.org; 3 Apr 2020 09:18:07 +0000 Received: from localhost ([127.0.0.1]:41164 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jKISl-0005Yp-Eq for submit@debbugs.gnu.org; Fri, 03 Apr 2020 05:18:07 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:39917) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jKISj-0005Y9-OW for 40373@debbugs.gnu.org; Fri, 03 Apr 2020 05:18:06 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 997C25C0409; Fri, 3 Apr 2020 05:18:00 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Fri, 03 Apr 2020 05:18:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.net; h= from:to:cc:subject:in-reply-to:references:cc:date:message-id :mime-version:content-type; s=fm3; bh=+hkkjQqCpsjLJ4qRXm923w9bpR FPJzhHTekA+TCXpAk=; b=OHhDRjmZLmm81X1ACfKb11Ki9Uo2rTxtQ0z1OWWDPL ng+QCFOyXJUPSbWXQtJISTa4/EeOSOC5T4xerGSkGVj4mXHXFzilVrUAJVCenqwN lxWMRCeMDCKoo6R9tWtYqwH/fVcpZSiEC0vdqF00WnyRSR64AKoU6Nw6EszkVDtp 5buqEK6eCml49AtfO+UPzWu327OB0bOVlvQSQXXsnAmjRbkfTr0MBN1kZmsC/RsC Huyvf1uBe8wG3EeDfLoK83AUDPjtZegAIErWdBzt7ILaaxsyTQIVvnzIrdpydc/a QfACByEwZpa0sUviQT3D3/puiiRmLYVazimF357qzkbw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=+hkkjQ qCpsjLJ4qRXm923w9bpRFPJzhHTekA+TCXpAk=; b=4MHixraiG2qL0X9AIkmZD3 Re390ea0rwIgJCqR43NzKkK3zevC6ZmaovXTLKbu/VK8hdFDZAvFHAyicU1bhixE TOAKcNjUX+kpLAu7BNB3nLZgtHhNDFgWE6BK70AKCIkSyWnM454qZMl3cXASGwtx rtYYQgx8hGGUobDpkj8hw/kLJNOTQvBSFof+SKIdEgEqbQSZTJvToC8DuQcqsp1K UmIqlnrGcZ4YQ2IzkOg9v7GFgpW/MkCCaBXbV2sIpRX0eonT68nYHDZgQ4kR2h3n DQF2QiLNBZKyse5HTYCrKsYRME/9q9Ppb81lmQmeuJUwLW0q5AUqkBFQm6urWJdA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrtdeigddugecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffujghffffkgggtsehttdertddttddtnecuhfhrohhmpefmohhnrhgrugcu jfhinhhsvghnuceokhhonhhrrggurdhhihhnshgvnhesfhgrshhtmhgrihhlrdhnvghtqe enucfkphepkeeirddvgeejrdduieegrddvgeehnecuvehluhhsthgvrhfuihiivgeptden ucfrrghrrghmpehmrghilhhfrhhomhepkhhonhhrrggurdhhihhnshgvnhesfhgrshhtmh grihhlrdhnvght X-ME-Proxy: Received: from khs-macbook.home (lfbn-idf2-1-714-245.w86-247.abo.wanadoo.fr [86.247.164.245]) by mail.messagingengine.com (Postfix) with ESMTPA id CCA4D328005A; Fri, 3 Apr 2020 05:17:59 -0400 (EDT) From: Konrad Hinsen To: 40373@debbugs.gnu.org Subject: Re: [bug#40373] [PATCH] guix: new command "guix run-script" In-Reply-To: References: <875zeiudjm.fsf@gnu.org> Date: Fri, 03 Apr 2020 11:17:58 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 40373 Cc: Ludovic =?utf-8?Q?Court=C3=A8s?= , zimoun X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Konrad Hinsen writes: > Could we go for "guix guile" and make it option-compatible with plain > Guile as much as possible? Just an idea, I am not sure it's a good one! > Guile can already be a pain in a shebang line. After some exploration, that kind of compatibility doesn't seem worth the effort. I will send another patch that implements Simon's proposal: - New command "guix run" that extends "guix repl" by an optional file argument for running a script. - "guix repl" becomes an alias for "guix run" (and could in the long run be declared obsolete). Cheers, Konrad. From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 03 05:19:53 2020 Received: (at 40373) by debbugs.gnu.org; 3 Apr 2020 09:19:53 +0000 Received: from localhost ([127.0.0.1]:41170 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jKIUS-0005eh-RL for submit@debbugs.gnu.org; Fri, 03 Apr 2020 05:19:53 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:46865) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jKIUQ-0005eA-ER for 40373@debbugs.gnu.org; Fri, 03 Apr 2020 05:19:51 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 616575C0415; Fri, 3 Apr 2020 05:19:45 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Fri, 03 Apr 2020 05:19:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.net; h= from:to:subject:in-reply-to:references:date:message-id :mime-version:content-type:content-transfer-encoding; s=fm3; bh= rkEZn6XHBb+L/RMjEJK29gGHMoeBqR0QgQCT4xZAp4A=; b=PH2jt6L9uB5sdEm2 YyQV7VKtQsWLu/KVCaTuaJsMpg76X/Kq8ybBnVTx6IZw/1CgXtTBZR8P3BsTmpiw 3v/BvR3ZY4i4EL4SZfRmq0KOPcE6cJCD8G2qFLffar105F/wNim1V/LR1HcF6ojc 7Ro4kXYuSsJAZ2nJFXKX9W2/Ihnhwd3U23k1RDZi9DxWRGtpQqklux1g7W+Tt827 5Fxe7Nv7F/t8J0bCW3wHnZhTE1msC3B62kr7yh7vby62eWg4xaOg1GwjXPWDC6G3 owh29mNKdgrhllD6iTl9MK3P5f4CZfuxki7qWOUcfUIZCuoTLwNsDqmY5NNQhL6q yaTlZA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=rkEZn6XHBb+L/RMjEJK29gGHMoeBqR0QgQCT4xZAp 4A=; b=eIuiDFDRlZ2k/LEPiyMM8JcdVhnzJwGaF9gxBof8cMtMApLI2QekpLGsG tk2d4o+brOifnOZWen8Q71a+Fzm4I2We2suuZye2/KetTPQFbAASxb1qdGTFTvyi hwoslIF/PITvH0GW2gmmyIoJdgVRGfG0bpEWKnXQ/dXQGQq4Z8iCgNUuhdCVO7N1 VfYPaDEWu51g9VtQHAN3qQ551XyKnR7L4ERwMuY+j68M2RFW7CPgxnlqX/+lyE8g xdTpiSmtU9yxvCQyfMGbYdsT3z5DoQvwX/BsTXMbQODMaiYXOO9su0XYx1E9PMRz O4ebIb3m/iJTUHDgQPvGg8wjlekuw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrtdeigdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufgjfhffkfggtgfgsehtqhertd dttdejnecuhfhrohhmpefmohhnrhgrugcujfhinhhsvghnuceokhhonhhrrggurdhhihhn shgvnhesfhgrshhtmhgrihhlrdhnvghtqeenucffohhmrghinhepghhnuhdrohhrghenuc fkphepkeeirddvgeejrdduieegrddvgeehnecuvehluhhsthgvrhfuihiivgeptdenucfr rghrrghmpehmrghilhhfrhhomhepkhhonhhrrggurdhhihhnshgvnhesfhgrshhtmhgrih hlrdhnvght X-ME-Proxy: Received: from khs-macbook.home (lfbn-idf2-1-714-245.w86-247.abo.wanadoo.fr [86.247.164.245]) by mail.messagingengine.com (Postfix) with ESMTPA id 91994306CF47; Fri, 3 Apr 2020 05:19:44 -0400 (EDT) From: Konrad Hinsen To: 40373@debbugs.gnu.org Subject: [PATCH] guix: new command "guix run" generalizes "guix repl" In-Reply-To: References: <875zeiudjm.fsf@gnu.org> Date: Fri, 03 Apr 2020 11:19:43 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 40373 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * guix/scripts/run.scm: New file. * Makefile.am: (MODULES): Add it. * guix/scripts/repl.scm: Make "guix repl" an alias for "guix run". * doc/guix.texi: Document "guix run" --- Makefile.am | 1 + doc/guix.texi | 51 ++++++++---- guix/scripts/repl.scm | 157 +---------------------------------- guix/scripts/run.scm | 189 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 229 insertions(+), 169 deletions(-) create mode 100644 guix/scripts/run.scm diff --git a/Makefile.am b/Makefile.am index 344ecdbc42..db91c4f5da 100644 --- a/Makefile.am +++ b/Makefile.am @@ -255,6 +255,7 @@ MODULES =3D \ guix/scripts/authenticate.scm \ guix/scripts/refresh.scm \ guix/scripts/repl.scm \ + guix/scripts/run.scm \ guix/scripts/describe.scm \ guix/scripts/system.scm \ guix/scripts/system/search.scm \ diff --git a/doc/guix.texi b/doc/guix.texi index 8cb85fe62c..4e4c12866a 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -234,7 +234,7 @@ Programming Interface * Derivations:: Low-level interface to package derivations. * The Store Monad:: Purely functional interface to the store. * G-Expressions:: Manipulating build expressions. -* Invoking guix repl:: Fiddling with Guix interactively. +* Invoking guix run:: Programming Guix in Guile =20 Defining Packages =20 @@ -1154,7 +1154,7 @@ The @command{guix} command must be in the search path= on the build machines. You can check whether this is the case by running: =20 @example -ssh build-machine guix repl --version +ssh build-machine guix run --version @end example =20 There is one last thing to do once @file{machines.scm} is in place. As @@ -4259,7 +4259,7 @@ revisions in arbitrary ways. =20 @cindex inferior packages Technically, an ``inferior'' is essentially a separate Guix process connec= ted -to your main Guix process through a REPL (@pxref{Invoking guix repl}). The +to your main Guix process through a REPL (@pxref{Invoking guix run}). The @code{(guix inferior)} module allows you to create inferiors and to communicate with them. It also provides a high-level interface to browse = and manipulate the packages that an inferior provides---@dfn{inferior packages= }. @@ -4318,7 +4318,7 @@ As a side effect, this procedure may build or substit= ute binaries for @deffn {Scheme Procedure} open-inferior @var{directory} @ [#:command "bin/guix"] Open the inferior Guix in @var{directory}, running -@code{@var{directory}/@var{command} repl} or equivalent. Return @code{#f}= if +@code{@var{directory}/@var{command} run} or equivalent. Return @code{#f} = if the inferior could not be launched. @end deffn =20 @@ -5346,7 +5346,8 @@ package definitions. * Derivations:: Low-level interface to package derivations. * The Store Monad:: Purely functional interface to the store. * G-Expressions:: Manipulating build expressions. -* Invoking guix repl:: Fiddling with Guix interactively. +* Invoking guix run:: Programming Guix in Guile + @end menu =20 @node Package Modules @@ -8057,25 +8058,43 @@ corresponding to @var{obj} for @var{system}, cross-= compiling for has an associated gexp compiler, such as a @code{}. @end deffn =20 -@node Invoking guix repl -@section Invoking @command{guix repl} +@node Invoking guix run +@section Invoking @command{guix run} + +@cindex script, REPL, read-eval-print loop +The @command{guix run} command makes it easier to program Guix in Guile, +either by running Guile scripts (@pxref{Running Guile Scripts,,, guile, +GNU Guile Reference Manual}) or by launching a Guile +@dfn{read-eval-print loop} (REPL) for interactive programming +(@pxref{Using Guile Interactively,,, guile, GNU Guile Reference Manual}). +Compared to just launching the @command{guile} +command, @command{guix run} guarantees that all the Guix modules and all i= ts +dependencies are available in the search path. + +The general syntax is: + +@example +guix run @var{options} @var{file} +@end example + +When a @var{file} argument is provided, @var{file} is executed as a Guile +script: + +@example +$ guix run my-script.scm +@end example =20 -@cindex REPL, read-eval-print loop -The @command{guix repl} command spawns a Guile @dfn{read-eval-print loop} -(REPL) for interactive programming (@pxref{Using Guile Interactively,,, gu= ile, -GNU Guile Reference Manual}). Compared to just launching the @command{gui= le} -command, @command{guix repl} guarantees that all the Guix modules and all = its -dependencies are available in the search path. You can use it this way: +Otherwise a Guile REPL is started: =20 @example -$ guix repl +$ guix run scheme@@(guile-user)> ,use (gnu packages base) scheme@@(guile-user)> coreutils $1 =3D # @end example =20 @cindex inferiors -In addition, @command{guix repl} implements a simple machine-readable REPL +In addition, @command{guix run} implements a simple machine-readable REPL protocol for use by @code{(guix inferior)}, a facility to interact with @dfn{inferiors}, separate processes running a potentially different revisi= on of Guix. @@ -8114,7 +8133,7 @@ Add @var{directory} to the front of the package modul= e search path (@pxref{Package Modules}). =20 This allows users to define their own packages and make them visible to -the command-line tool. +the script or command-line tool. =20 @item -q Inhibit loading of the @file{~/.guile} file. By default, that diff --git a/guix/scripts/repl.scm b/guix/scripts/repl.scm index ff1f208894..4feca9140a 100644 --- a/guix/scripts/repl.scm +++ b/guix/scripts/repl.scm @@ -1,6 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright =C2=A9 2018, 2019, 2020 Ludovic Court=C3=A8s -;;; Copyright =C2=A9 2020 Simon Tournier +;;; Copyright =C2=A9 2020 Konrad Hinsen ;;; ;;; This file is part of GNU Guix. ;;; @@ -18,159 +17,11 @@ ;;; along with GNU Guix. If not, see . =20 (define-module (guix scripts repl) - #:use-module (guix ui) - #:use-module (guix scripts) - #:use-module (guix repl) - #:use-module (srfi srfi-1) - #:use-module (srfi srfi-37) - #:use-module (ice-9 match) - #:use-module (rnrs bytevectors) - #:autoload (system repl repl) (start-repl) - #:autoload (system repl server) - (make-tcp-server-socket make-unix-domain-server-socket) + #:use-module (guix scripts run) #:export (guix-repl)) =20 ;;; Commentary: ;;; -;;; This command provides a Guile REPL +;;; This is an alias for "guix run", for backwards compatibility =20 -(define %default-options - `((type . guile))) - -(define %options - (list (option '(#\h "help") #f #f - (lambda args - (show-help) - (exit 0))) - (option '(#\V "version") #f #f - (lambda args - (show-version-and-exit "guix repl"))) - (option '(#\t "type") #t #f - (lambda (opt name arg result) - (alist-cons 'type (string->symbol arg) result))) - (option '("listen") #t #f - (lambda (opt name arg result) - (alist-cons 'listen arg result))) - (option '(#\q) #f #f - (lambda (opt name arg result) - (alist-cons 'ignore-dot-guile? #t result))) - (option '(#\L "load-path") #t #f - (lambda (opt name arg result) - ;; XXX: Imperatively modify the search paths. - (set! %load-path (cons arg %load-path)) - (set! %load-compiled-path (cons arg %load-compiled-path)) - result)))) - - -(define (show-help) - (display (G_ "Usage: guix repl [OPTIONS...] -Start a Guile REPL in the Guix execution environment.\n")) - (display (G_ " - -t, --type=3DTYPE start a REPL of the given TYPE")) - (display (G_ " - --listen=3DENDPOINT listen to ENDPOINT instead of standard input")) - (display (G_ " - -q inhibit loading of ~/.guile")) - (newline) - (display (G_ " - -L, --load-path=3DDIR prepend DIR to the package module search path")) - (newline) - (display (G_ " - -h, --help display this help and exit")) - (display (G_ " - -V, --version display version information and exit")) - (newline) - (show-bug-report-information)) - -(define user-module - ;; Module where we execute user code. - (let ((module (resolve-module '(guix-user) #f #f #:ensure #t))) - (beautify-user-module! module) - module)) - -(define (call-with-connection spec thunk) - "Dynamically-bind the current input and output ports according to SPEC a= nd -call THUNK." - (if (not spec) - (thunk) - - ;; Note: the "PROTO:" prefix in SPEC is here so that we can eventual= ly - ;; parse things like "fd:123" in a non-ambiguous way. - (match (string-index spec #\:) - (#f - (leave (G_ "~A: invalid listen specification~%") spec)) - (index - (let ((protocol (string-take spec index)) - (address (string-drop spec (+ index 1)))) - (define socket - (match protocol - ("tcp" - (make-tcp-server-socket #:port (string->number address))) - ("unix" - (make-unix-domain-server-socket #:path address)) - (_ - (leave (G_ "~A: unsupported protocol family~%") - protocol)))) - - (listen socket 10) - (let loop () - (match (accept socket) - ((connection . address) - (if (=3D AF_UNIX (sockaddr:fam address)) - (info (G_ "accepted connection~%")) - (info (G_ "accepted connection from ~a~%") - (inet-ntop (sockaddr:fam address) - (sockaddr:addr address)))) - (dynamic-wind - (const #t) - (lambda () - (parameterize ((current-input-port connection) - (current-output-port connection)) - (thunk))) - (lambda () - (false-if-exception (close-port connection)) - (info (G_ "connection closed~%")))))) - (loop))))))) - - -(define (guix-repl . args) - (define opts - ;; Return the list of package names. - (args-fold* args %options - (lambda (opt name arg result) - (leave (G_ "~A: unrecognized option~%") name)) - (lambda (arg result) - (leave (G_ "~A: extraneous argument~%") arg)) - %default-options)) - - (define user-config - (and=3D> (getenv "HOME") - (lambda (home) - (string-append home "/.guile")))) - - (with-error-handling - (let ((type (assoc-ref opts 'type))) - (call-with-connection (assoc-ref opts 'listen) - (lambda () - (case type - ((guile) - (save-module-excursion - (lambda () - (set-current-module user-module) - (when (and (not (assoc-ref opts 'ignore-dot-guile?)) - user-config - (file-exists? user-config)) - (load user-config)) - - ;; Do not exit repl on SIGINT. - ((@@ (ice-9 top-repl) call-with-sigint) - (lambda () - (start-repl)))))) - ((machine) - (machine-repl)) - (else - (leave (G_ "~a: unknown type of REPL~%") type)))))))) - -;; Local Variables: -;; eval: (put 'call-with-connection 'scheme-indent-function 1) -;; End: +(define guix-repl guix-run) diff --git a/guix/scripts/run.scm b/guix/scripts/run.scm new file mode 100644 index 0000000000..4f3cfb2c47 --- /dev/null +++ b/guix/scripts/run.scm @@ -0,0 +1,189 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2018, 2019, 2020 Ludovic Court=C3=A8s +;;; Copyright =C2=A9 2020 Simon Tournier +;;; Copyright =C2=A9 2020 Konrad Hinsen +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (guix scripts run) + #:use-module (guix ui) + #:use-module (guix scripts) + #:use-module (guix repl) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-37) + #:use-module (ice-9 match) + #:use-module (rnrs bytevectors) + #:autoload (system repl repl) (start-repl) + #:autoload (system repl server) + (make-tcp-server-socket make-unix-domain-server-socket) + #:export (guix-run)) + +;;; Commentary: +;;; +;;; This command provides a Guile script runner and REPL in an environment +;;; that contains all the modules comprising Guix. + +(define %default-options + `((type . guile))) + +(define %options + (list (option '(#\h "help") #f #f + (lambda args + (show-help) + (exit 0))) + (option '(#\V "version") #f #f + (lambda args + (show-version-and-exit "guix repl"))) + (option '(#\t "type") #t #f + (lambda (opt name arg result) + (alist-cons 'type (string->symbol arg) result))) + (option '("listen") #t #f + (lambda (opt name arg result) + (alist-cons 'listen arg result))) + (option '(#\q) #f #f + (lambda (opt name arg result) + (alist-cons 'ignore-dot-guile? #t result))) + (option '(#\L "load-path") #t #f + (lambda (opt name arg result) + ;; XXX: Imperatively modify the search paths. + (set! %load-path (cons arg %load-path)) + (set! %load-compiled-path (cons arg %load-compiled-path)) + result)))) + + +(define (show-help) + (display (G_ "Usage: guix run [OPTIONS...] [FILE] +Run FILE as a Guile script, or start a Guile REPL, in the Guix +execution environment.\n")) + (display (G_ " + -t, --type=3DTYPE start a REPL of the given TYPE")) + (display (G_ " + --listen=3DENDPOINT listen to ENDPOINT instead of standard input")) + (display (G_ " + -q inhibit loading of ~/.guile")) + (newline) + (display (G_ " + -L, --load-path=3DDIR prepend DIR to the package module search path")) + (newline) + (display (G_ " + -h, --help display this help and exit")) + (display (G_ " + -V, --version display version information and exit")) + (newline) + (show-bug-report-information)) + +(define user-module + ;; Module where we execute user code. + (let ((module (resolve-module '(guix-user) #f #f #:ensure #t))) + (beautify-user-module! module) + module)) + +(define (call-with-connection spec thunk) + "Dynamically-bind the current input and output ports according to SPEC a= nd +call THUNK." + (if (not spec) + (thunk) + + ;; Note: the "PROTO:" prefix in SPEC is here so that we can eventual= ly + ;; parse things like "fd:123" in a non-ambiguous way. + (match (string-index spec #\:) + (#f + (leave (G_ "~A: invalid listen specification~%") spec)) + (index + (let ((protocol (string-take spec index)) + (address (string-drop spec (+ index 1)))) + (define socket + (match protocol + ("tcp" + (make-tcp-server-socket #:port (string->number address))) + ("unix" + (make-unix-domain-server-socket #:path address)) + (_ + (leave (G_ "~A: unsupported protocol family~%") + protocol)))) + + (listen socket 10) + (let loop () + (match (accept socket) + ((connection . address) + (if (=3D AF_UNIX (sockaddr:fam address)) + (info (G_ "accepted connection~%")) + (info (G_ "accepted connection from ~a~%") + (inet-ntop (sockaddr:fam address) + (sockaddr:addr address)))) + (dynamic-wind + (const #t) + (lambda () + (parameterize ((current-input-port connection) + (current-output-port connection)) + (thunk))) + (lambda () + (false-if-exception (close-port connection)) + (info (G_ "connection closed~%")))))) + (loop))))))) + + +(define (guix-run . args) + (define opts + (args-fold* args %options + (lambda (opt name arg result) + (leave (G_ "~A: unrecognized option~%") name)) + (lambda (arg result) + (when (assq 'argument result) + (leave (G_ "~A: extraneous argument~%") arg)) + (alist-cons 'argument arg result)) + %default-options)) + + (define user-config + (and=3D> (getenv "HOME") + (lambda (home) + (string-append home "/.guile")))) + + (define (set-user-module) + (set-current-module user-module) + (when (and (not (assoc-ref opts 'ignore-dot-guile?)) + user-config + (file-exists? user-config)) + (load user-config))) +=20=20 + (with-error-handling + (let ((script (assoc-ref opts 'argument)) + (type (assoc-ref opts 'type))) + (if script + (save-module-excursion + (lambda () + (set-user-module) + (load script))) + (call-with-connection (assoc-ref opts 'listen) + (lambda () + (case type + ((guile) + (save-module-excursion + (lambda () + (set-user-module) + ;; Do not exit repl on SIGINT. + ((@@ (ice-9 top-repl) call-with-sigint) + (lambda () + (start-repl)))))) + ((machine) + (machine-repl)) + (else + (leave (G_ "~a: unknown type of REPL~%") type)))))))) + + ;; Local Variables: + ;; eval: (put 'call-with-connection 'scheme-indent-function 1) + ;; End: + ) --=20 2.26.0 From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 03 05:48:22 2020 Received: (at 40373) by debbugs.gnu.org; 3 Apr 2020 09:48:22 +0000 Received: from localhost ([127.0.0.1]:41181 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jKIw1-0007Cp-RE for submit@debbugs.gnu.org; Fri, 03 Apr 2020 05:48:22 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44877) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jKIw0-0007CY-4n for 40373@debbugs.gnu.org; Fri, 03 Apr 2020 05:48:20 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:52521) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jKIvu-0002BQ-Sh; Fri, 03 Apr 2020 05:48:14 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=46668 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jKIvu-0006c7-Gg; Fri, 03 Apr 2020 05:48:14 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Konrad Hinsen Subject: Re: [bug#40373] [PATCH] guix: new command "guix run-script" References: <875zeiudjm.fsf@gnu.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 15 Germinal an 228 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Fri, 03 Apr 2020 11:48:11 +0200 In-Reply-To: (Konrad Hinsen's message of "Fri, 03 Apr 2020 11:17:58 +0200") Message-ID: <87r1x4lx2c.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 40373 Cc: 40373@debbugs.gnu.org, zimoun X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi Konrad, Konrad Hinsen skribis: > Konrad Hinsen writes: > >> Could we go for "guix guile" and make it option-compatible with plain >> Guile as much as possible? Just an idea, I am not sure it's a good one! >> Guile can already be a pain in a shebang line. > > After some exploration, that kind of compatibility doesn't seem worth > the effort. > > I will send another patch that implements Simon's proposal: > > - New command "guix run" that extends "guix repl" by an optional > file argument for running a script. =E2=80=9Cguix run=E2=80=9D was sort of reserved for something else: https://lists.gnu.org/archive/html/help-guix/2018-01/msg00118.html The idea is still floating around so perhaps we should keep that name. > - "guix repl" becomes an alias for "guix run" (and could in the > long run be declared obsolete). I=E2=80=99m worried about a possible increase of the deprecation rate. I understand the rationale, I think it makes sense, but still, I=E2=80=99m not sure we need to deprecate =E2=80=9Cguix repl=E2=80=9D already. In fact, since it=E2=80=99s used by inferiors, we must pay extra attention = to keep it as-is as much as possible or we=E2=80=99ll make communication betwe= en old and new Guixes difficult. Thoughts? Thanks, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 03 05:51:50 2020 Received: (at 40373) by debbugs.gnu.org; 3 Apr 2020 09:51:50 +0000 Received: from localhost ([127.0.0.1]:41185 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jKIzO-0007OW-C3 for submit@debbugs.gnu.org; Fri, 03 Apr 2020 05:51:50 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45397) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jKIzM-0007O3-Vn for 40373@debbugs.gnu.org; Fri, 03 Apr 2020 05:51:49 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:52769) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jKIzH-0006Ue-Pr; Fri, 03 Apr 2020 05:51:43 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=46674 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jKIzH-0006uo-AK; Fri, 03 Apr 2020 05:51:43 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Konrad Hinsen Subject: Re: [bug#40373] [PATCH] guix: new command "guix run-script" References: <875zeiudjm.fsf@gnu.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 15 Germinal an 228 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Fri, 03 Apr 2020 11:51:42 +0200 In-Reply-To: (Konrad Hinsen's message of "Thu, 02 Apr 2020 09:13:23 +0200") Message-ID: <87mu7slwwh.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 40373 Cc: 40373@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hello, Konrad Hinsen skribis: > The other is that I am in tutorial-driven development mode: I need "guix > run-script" in order to be able to insert my own scripts (for analyzing > dependencies) into a Guix tutorial for an upcoming MOOC. So I need to > make sure that people can run my scripts easily, but also that they > understand what they are doing. A command that does something else than > its name suggests, with a similarity that is only visible to experts, > is no good for use in a tutorial. I see. (I have to ponder this a bit more.) > I am of course aware that much of the code in "run-script" is the same > as in "repl", which is not good. Yes, we can probably factorize a bit. We must make sure =E2=80=98-q=E2=80= =99 is not implemented by this command; =E2=80=98-t=E2=80=99 is also useless. > But I'd rather think about a better framework for code sharing among > Guix scripts than about pushing too much semantic differences into > obscure options. An example would be reusable "option clusters", such > as "options for Guile" or "options for channels". We do have that with =E2=80=98%standard-build-options=E2=80=99, for instanc= e, although not as nicely-structured as we=E2=80=99d like (in general, I=E2=80=99d pref= er to have a GNU argp-style command-line API than what we have). Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 07 05:10:50 2020 Received: (at 40373) by debbugs.gnu.org; 7 Apr 2020 09:10:50 +0000 Received: from localhost ([127.0.0.1]:49554 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jLkFt-0002bN-T9 for submit@debbugs.gnu.org; Tue, 07 Apr 2020 05:10:50 -0400 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]:43369) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jLkFs-0002av-78 for 40373@debbugs.gnu.org; Tue, 07 Apr 2020 05:10:48 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 613A6788; Tue, 7 Apr 2020 05:10:42 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Tue, 07 Apr 2020 05:10:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.net; h= from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type:content-transfer-encoding; s=fm3; bh= zQE2WA8tKEqcS76XqDTHA8v2L9Xop/c2PfgmiZhl5b8=; b=rkbfLp2Lye+K4hrO W/ISNsOxVjsZCo8tYwecdjVjlzp3tLv7GaAX5s0fFCzYoIUn2SUWGWsLZ+5Yik4u o1v8vgGRUUIfwjjX++iZsmnlLLttd0iYLIVgxAqFeGISUg8uR6iRSniN2kylKli+ LWqjTVuClDaS/stied1XvzaN3btu2XvU8bPTEbFCTuXHPCi8x95m/hT5fq2ms+eL a5dThi8rEGReIgDf5tNW5fxY8Y0UwRP3fTKBqgQbDqjHl/zx9EEDDulilYC5Bw02 N07BuL9ZNNkeBxnriS7oGBbx3cw4aE0Wbrd8/eqYDXcRPmQLOUHoni4y/y/SbIIZ AxbwVA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=zQE2WA8tKEqcS76XqDTHA8v2L9Xop/c2PfgmiZhl5 b8=; b=akUqpyI3Df+ZKaprLI4fRktHLEICCQCOk29ZQ5aO5RJBxk1gtinRZk1xt 7r0LfYNMpdFNg8sJOe+GrP5+zxhZT/RjR7fL5wwBV8kNDkmJOSdmnnpJwpZ46YDL Sp4SqzUvQ+aqATd/y0ekN2uuDgxNfGT3TK1UH3TsBoqM1/3/shLqzbNIalWqUYCR pyASmH6Q1qq7yPFaG/ygrjOtNLaOC/aQKtnDa0Ob96EGDNXjN3Lj4RAVRFSNY5wn 1nZy29CHSrrwylHoSDNeikVutcNgykM7IsP39G+csUClwMIpnJTtaKevtw8/J/4T F5i6CBuGMHjszioDaCqs0QArXEW4w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudehgddufecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffujghffffkgggtgfesthhqredttddtjeenucfhrhhomhepmfhonhhrrggu ucfjihhnshgvnhcuoehkohhnrhgrugdrhhhinhhsvghnsehfrghsthhmrghilhdrnhgvth eqnecukfhppeekiedrvdegjedrudeigedrvdegheenucevlhhushhtvghrufhiiigvpedt necurfgrrhgrmhepmhgrihhlfhhrohhmpehkohhnrhgrugdrhhhinhhsvghnsehfrghsth hmrghilhdrnhgvth X-ME-Proxy: Received: from khs-macbook.home (lfbn-idf2-1-714-245.w86-247.abo.wanadoo.fr [86.247.164.245]) by mail.messagingengine.com (Postfix) with ESMTPA id 645DC3280065; Tue, 7 Apr 2020 05:10:41 -0400 (EDT) From: Konrad Hinsen To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#40373] [PATCH] guix: new command "guix run-script" In-Reply-To: <87mu7slwwh.fsf@gnu.org> References: <875zeiudjm.fsf@gnu.org> <87mu7slwwh.fsf@gnu.org> Date: Tue, 07 Apr 2020 11:10:40 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 40373 Cc: 40373@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi Ludo, >> I am of course aware that much of the code in "run-script" is the same >> as in "repl", which is not good. > > Yes, we can probably factorize a bit. We must make sure =E2=80=98-q=E2= =80=99 is not > implemented by this command; =E2=80=98-t=E2=80=99 is also useless. Right. > We do have that with =E2=80=98%standard-build-options=E2=80=99, for insta= nce, although > not as nicely-structured as we=E2=80=99d like (in general, I=E2=80=99d pr= efer to have a > GNU argp-style command-line API than what we have). It would also be nice to share the documentation for these options among different scripts. That's actually more lines of code than the code itself. More generally, it would be nice to decouple implementation decisions from user interface decisions. Git provides a nice example of what happens when user interface design follows ease of implementation criteria for a while. It's probably the most hated essential piece of software by now. >From a user interface point of view, it is preferable to have many commands with clear names, rather than few commands overloaded with multiple functions selected by cryptic options. Cheers, Konrad From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 07 06:36:51 2020 Received: (at 40373) by debbugs.gnu.org; 7 Apr 2020 10:36:51 +0000 Received: from localhost ([127.0.0.1]:49629 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jLlb9-00071R-DB for submit@debbugs.gnu.org; Tue, 07 Apr 2020 06:36:51 -0400 Received: from eggs.gnu.org ([209.51.188.92]:57831) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jLlb8-00071E-7B for 40373@debbugs.gnu.org; Tue, 07 Apr 2020 06:36:50 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:53261) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jLlb3-0001jY-2b; Tue, 07 Apr 2020 06:36:45 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=45742 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jLlb1-00054T-HA; Tue, 07 Apr 2020 06:36:43 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Konrad Hinsen Subject: Re: [bug#40373] [PATCH] guix: new command "guix run-script" References: <875zeiudjm.fsf@gnu.org> <87mu7slwwh.fsf@gnu.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 19 Germinal an 228 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Tue, 07 Apr 2020 12:36:41 +0200 In-Reply-To: (Konrad Hinsen's message of "Tue, 07 Apr 2020 11:10:40 +0200") Message-ID: <87mu7na8g6.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 40373 Cc: 40373@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hello, Konrad Hinsen skribis: > From a user interface point of view, it is preferable to have many > commands with clear names, rather than few commands overloaded with > multiple functions selected by cryptic options. I agree overall, though it=E2=80=99s not black and white: the benefit of ha= ving separate commands weakens as they proliferate. A new command may be more difficult to discover than an option to an existing command. But anyway, let=E2=80=99s see how we can get =E2=80=98run-script=E2=80=99 i= n! :-) Thanks, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 17 07:21:59 2020 Received: (at 40373) by debbugs.gnu.org; 17 Apr 2020 11:21:59 +0000 Received: from localhost ([127.0.0.1]:40069 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jPP4I-0005MY-UD for submit@debbugs.gnu.org; Fri, 17 Apr 2020 07:21:59 -0400 Received: from mail-qt1-f193.google.com ([209.85.160.193]:45011) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jPP4H-0005MM-3B for 40373@debbugs.gnu.org; Fri, 17 Apr 2020 07:21:57 -0400 Received: by mail-qt1-f193.google.com with SMTP id w24so1556782qts.11 for <40373@debbugs.gnu.org>; Fri, 17 Apr 2020 04:21:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=JS6wDd8b29ylGMyYrCI75RKGhMuuQaHCDroLN3/Q82g=; b=mdq+inbujqFbxtCAlXXVeX5hbCgwAqeE8K8KBPXYVs7NeeC4gOMBT0eugcbTCXZ2hk OfriSN+sNbKRSJBBjvrQj721j1rjnH6W7zaSE1AO/zHm8aZ9J8xK5CTxJn1VDDTVJpqQ pv9DABeP1F6zP59lHW8jDOm4BJRb2cujc5QuJQKEnGpeEm/d847UYOb9fbf4kTdCOMlr HHj/OxPRrvz/J8lm5Pq8z8cM54kbYtEo5FuEMIMRF41vne5gS5Me51uZZRvzJXcobcG0 iO3lm+E23i8AP2quEntCEiU2mFdnA9qux4pwP7pHp1LtIk3fAQ+tM3H4jPGYlVFhlusG N9Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JS6wDd8b29ylGMyYrCI75RKGhMuuQaHCDroLN3/Q82g=; b=AHcIFkFyzarB3OSZj4zq4v464Y2YH3VLp6iNFZKav0PKyX9pYUlyjuU2lq2bUHPAfH XJN4O6DwLFNLDZSYwflrXt2vX62y8kRIypqGT0L6EqaB5ss5N6KlwGby81D27zF/LGGq MK2bYT09JvOovq8FnYATrXuQh0MiSen37PL8RW4ktRPZllbrstnvyGNSAOsrSDzoaW1v /eNiax9s2MWt4VCAOz+DyGeYWJhGlyNLm/OmJqmWfj2OH96oCgwA8Hj1UWlpQFdhWwD5 VX9Kko10ahTiaYu6GpuPfgOIQpvdetc9JQZysCGFfWl+hivnvRaRxfyIQLfQ9gQ2RI8q v6qg== X-Gm-Message-State: AGi0PuZKAYVj0b+ReNP46wLMo7iX1dR43DWtfnXGqO4Nh0FiMyIAeh+r kR49B6pFI2FyzT8DjSXr6/bKdIrfn1uktcGHHKirjg== X-Google-Smtp-Source: APiQypIRbB8VHY8tROHTGvzvekVbrhfwiJZP8sipYfwBjNR1tyLwOcobQQN3qaoL0sqyRjM96BCTf7E7bQl3Ak9EHuI= X-Received: by 2002:ac8:4254:: with SMTP id r20mr2258738qtm.211.1587122511674; Fri, 17 Apr 2020 04:21:51 -0700 (PDT) MIME-Version: 1.0 References: <875zeiudjm.fsf@gnu.org> <87mu7slwwh.fsf@gnu.org> <87mu7na8g6.fsf@gnu.org> In-Reply-To: <87mu7na8g6.fsf@gnu.org> From: zimoun Date: Fri, 17 Apr 2020 13:21:32 +0200 Message-ID: Subject: Re: [bug#40373] [PATCH] guix: new command "guix run-script" To: =?UTF-8?Q?Ludovic_Court=C3=A8s?= Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 40373 Cc: Konrad Hinsen , 40373@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Dear, Naming is hard. :-) Why not simply add an option to "guix repl"? For example "--batch", mimicking "emacs --batch". Or "--script". Or "guix repl " just run the as the proposed "guix run-script"? I do not have the feeling that adding a new subcommand is mandatory. But running a script using the Guix modules is really useful, I always complain to myself of this lacking feature. :-) Cheers, simon From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 23 06:13:09 2020 Received: (at 40373) by debbugs.gnu.org; 23 Apr 2020 10:13:09 +0000 Received: from localhost ([127.0.0.1]:54086 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jRYqz-0004zG-A3 for submit@debbugs.gnu.org; Thu, 23 Apr 2020 06:13:09 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:60757) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jRYqx-0004yt-Je for 40373@debbugs.gnu.org; Thu, 23 Apr 2020 06:13:07 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 45D3B5C0098; Thu, 23 Apr 2020 06:13:02 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Thu, 23 Apr 2020 06:13:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.net; h= from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type:content-transfer-encoding; s=fm3; bh= Ap6hSi5OpYJvYcRNoX25NXBH88/US+HUtK/yZ+3LX8g=; b=wy8nY8+WyWeT2H6d pH53URxjzh1hMrfKiYaOvw2cpKRR7GPYV3CC4coi0AueIlxEhDL6aik5KTbgdL0M o8ixvow9x/jtmNBc8yCIHYMSAlyMnZZGYCdt+m6gp9CaJwWGXYKrFYBsiQJ5iBZ9 eWuqedCQcxpDtBES93am3cgwO3i4YZWXCCiJIV3LmL4Sz1MLgs39giJoniR/z4Yu Yu5JSOSLJpxYIPjYOkzxfjdc6t4RqWuSQzQQ1qWhiBQzGL2euL2ZQ+1FBx9YEMH5 4sDA0f8aX+FBv0avXUP5dtFmp9aeXpPyL4PzBOvC/l3e7Zkgjupq4tZxhugE2o38 gerH2w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=Ap6hSi5OpYJvYcRNoX25NXBH88/US+HUtK/yZ+3LX 8g=; b=euNGXGS92nPwv6xTla232CyTdssB8ayar42GRIsauZR8nWcUBVKqBRBAU YQaAyYYeq1JdbX6wFEFfWEYFhuJlNH9rHyh5xOvZygH1b+WHmJj8Ko2AxxtISCP0 ZyxdwEnK5B+b9iLEltWo+YRwhgUXkZtylJordhQa47lPTckJgqOiamYhbCdCpwuL PJedUuC1IoVML2Fo5BtfohaCsMPQBkE8yyG40n/iAae/XFNoS83+y/8E078ck41c baRmYIIN7IAVFq8HHkgiH97tmpt3wqRbCV6QmsBGTyOmRAsP6gp1eT4pqf9kuwW/ TgEam4Qx8ofGbXFfH9RbHvuZTfjSA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrgeelgddvhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffujghffffkgggtgfesthhqredttddtjeenucfhrhhomhepmfhonhhrrggu ucfjihhnshgvnhcuoehkohhnrhgrugdrhhhinhhsvghnsehfrghsthhmrghilhdrnhgvth eqnecukfhppeejjedrvddthedrgedurdduudenucevlhhushhtvghrufhiiigvpedtnecu rfgrrhgrmhepmhgrihhlfhhrohhmpehkohhnrhgrugdrhhhinhhsvghnsehfrghsthhmrg hilhdrnhgvth X-ME-Proxy: Received: from KHs-MacBook (11.41.205.77.rev.sfr.net [77.205.41.11]) by mail.messagingengine.com (Postfix) with ESMTPA id C13943280063; Thu, 23 Apr 2020 06:13:00 -0400 (EDT) From: Konrad Hinsen To: zimoun , Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#40373] [PATCH] guix: new command "guix run-script" In-Reply-To: References: <875zeiudjm.fsf@gnu.org> <87mu7slwwh.fsf@gnu.org> <87mu7na8g6.fsf@gnu.org> Date: Thu, 23 Apr 2020 12:12:59 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 40373 Cc: 40373@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi Simon, > Why not simply add an option to "guix repl"? > For example "--batch", mimicking "emacs --batch". > Or "--script". Do you have a suggestion for explaining such a command to someone who want to run a script bu (1) doesn't know what a REPL is, (2) doesn't need to know what a REPL is, (3) would be mystified by the behavior resulting from forgetting the =E2=80=93script argument? I agree of course that naming is hard, but it is also important. Git should be a sufficient demonstration of what happens when you design command-line interfaces by a sequence of cumulative least-effort decisions. Cheers, Konrad From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 23 10:41:21 2020 Received: (at 40373) by debbugs.gnu.org; 23 Apr 2020 14:41:21 +0000 Received: from localhost ([127.0.0.1]:55684 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jRd2X-000818-GL for submit@debbugs.gnu.org; Thu, 23 Apr 2020 10:41:21 -0400 Received: from mail-qv1-f68.google.com ([209.85.219.68]:42209) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jRd2W-00080v-7P for 40373@debbugs.gnu.org; Thu, 23 Apr 2020 10:41:20 -0400 Received: by mail-qv1-f68.google.com with SMTP id v18so2953798qvx.9 for <40373@debbugs.gnu.org>; Thu, 23 Apr 2020 07:41:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=VUiYRAABtQsXH1r6M8etETgcMQDJXoKQYjSEuibSCVA=; b=d2X+y5L5wWLvlL5lj394mhow8tTMzTIKSG+xYlBIkvXs5sAFzVZxNB0bvFk4xTZEU6 j4gVIJC6vP85jjcoicjSe06hu/zmxU7bK/iVOKeScmTiqkZf0Mh4bBgYMZcyt8Nkqo7G Rj/6UgLVNgq4+Bz4EXlgk48WjCgItaUK5vy76L2ZL+N/n8vnX27NTOQmLuCY3+6lx606 LWdJ+iz4jjWHJxFsgMYyUBhWKevadIPMkJvq4+5coIBAVOUqq4pwUn8ydsGw2s8B5JpB UhcuOBLRnJYVFOc90GdeVzbegyjU+v3G7Dvm1/cZeMwK3rbHK3SgZghL/6NU+LydJuxw PEkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=VUiYRAABtQsXH1r6M8etETgcMQDJXoKQYjSEuibSCVA=; b=N90Hbn+Z1P//7mAP271kPWfKXLvS5rNABBXQHCe/uNRQF2bZcOhJBQFffn23MZZnE/ ghn4JCnyL2d+qn5j60kgrtE330KWdQ52XvvWYlvwgdkf5z+FSr+BWK8tAy2m8F7IigEE deuLF2UOXpTDV7tRgmtQt1Ek2z4H10oTOxuyAvDIY/zCTdGNDEeliYFdSkF8rDeh1dWq sVqjVcISvDK9+bMpnIZm7FztCouAAXqXPE0fXAZKAfSMRiXmkF2iONaDmSzKWtiCrqal gVpjGJKAtSwzJJml03Ip7vwHNJ62X6uYvesSzUcFjQl7yyqLGakFEf7+9nbfbNPBO1ZB fg2g== X-Gm-Message-State: AGi0PuZ5SIPlcFbqk1ITvrUSfegAYNKzDgn0jI9zKCJ6WdLoh7aCqF48 lo/KWZK1M+Jz0jVBRoprrxiTVVnbhR4PgI1OE5g= X-Google-Smtp-Source: APiQypLSB7p4OP4YyNZJKqHUZqMU/sJHMFvP8lIZcGFgUiYtJTaHaiAISmcb8F2hqRvRc0B0sHlWhwTWz9cyUS7GeVQ= X-Received: by 2002:ad4:5604:: with SMTP id ca4mr4544520qvb.6.1587652874615; Thu, 23 Apr 2020 07:41:14 -0700 (PDT) MIME-Version: 1.0 References: <875zeiudjm.fsf@gnu.org> <87mu7slwwh.fsf@gnu.org> <87mu7na8g6.fsf@gnu.org> In-Reply-To: From: zimoun Date: Thu, 23 Apr 2020 16:41:03 +0200 Message-ID: Subject: Re: [bug#40373] [PATCH] guix: new command "guix run-script" To: Konrad Hinsen Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 40373 Cc: =?UTF-8?Q?Ludovic_Court=C3=A8s?= , 40373@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Konrad, On Thu, 23 Apr 2020 at 12:13, Konrad Hinsen wr= ote: > > Why not simply add an option to "guix repl"? > > For example "--batch", mimicking "emacs --batch". > > Or "--script". > > Do you have a suggestion for explaining such a command to someone who > want to run a script bu (1) doesn't know what a REPL is, (2) doesn't > need to know what a REPL is, (3) would be mystified by the behavior > resulting from forgetting the =E2=80=93script argument? If I understand well guix run-script file1 file2 is becoming: guix repl --script=3Dfile1,file2,... right? Well, I would say that --8<---------------cut here---------------start------------->8--- the keyword "repl" stand for Read-Eval-Print-Loop therefore the command will: - read the script file1, - eval it, - print the results if they are, - and finally loop if there is more than one script file. --8<---------------cut here---------------end--------------->8--- this fills the condition (1) and (2); at least to me. ;-) I agree that forgetting the argument '--script' could mystified the learner= . But applying the same principles, the command guix environment --ad-hoc python -- python could mystified the learner too, if for example they forgets --ad-hoc or '-- python'. Well, this kind of disconcerting "mistakes" is part of the learning process, IMHO. Others call that "discoverability". ;-) > I agree of course that naming is hard, but it is also important. Git > should be a sufficient demonstration of what happens when you design > command-line interfaces by a sequence of cumulative least-effort > decisions. I agree. And I still have in my stack how to propose another CLI naming as we discussed earlier, e.g., environment, package, etc. reorganized into profile, install, search, etc. Cheers, sion From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 29 12:04:52 2020 Received: (at 40373) by debbugs.gnu.org; 29 Apr 2020 16:04:52 +0000 Received: from localhost ([127.0.0.1]:44389 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jTpCe-0003vL-A9 for submit@debbugs.gnu.org; Wed, 29 Apr 2020 12:04:52 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:35121) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jTpCc-0003v2-PP for 40373@debbugs.gnu.org; Wed, 29 Apr 2020 12:04:51 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id E130966E; Wed, 29 Apr 2020 12:04:44 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Wed, 29 Apr 2020 12:04:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.net; h= from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; s=fm3; bh=7BNraiQ89rUEyt+8LHDGIUz+Br 0+Usy9qNVB7jp7imU=; b=R/rL2HN5WaczaDunS1s5y0XbmYRsyLDwGKakTBHuZa 631GpQj37VTv+hCQmQKKGM+b/BxTl28TfTNYC4ophrpPni23dPaL+8YMgpozztDA HuPaRY0GI/GMWf5sk/ubZHxI2/7NI1F3bSsQx/zlBAR2muJBaQA6psLpNHb8clOH INFSfyBu18cmKx4EFMS9YAV4lcIeGEwwA7B4LOwC9/HVJAmFqUWurlx1c9rRnMXu 10IuPJTC6ll4k2yDCwoGN8lIWujSn+8U2+YAf8lufx7mVaWDeeRXEREEy05WGB1f ZmYlFi6Bbbm/bBYteMqI9Ajt3eQHfkeR6YIDjdzU5hsg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=7BNrai Q89rUEyt+8LHDGIUz+Br0+Usy9qNVB7jp7imU=; b=zkvmq5DeWAla4L2wyTY3/4 PZAc3ZH1nsXBhLxHn9NI3IafIY/Tb2twqT9zigp9exAy85XSaPM+zNWrGJGm0irs QcHogictLhJSCf7xWFkZvv94eBaeJP+mSSblkNZPQUhxmy+PkhnXScq6OeVCl5hP gHom1LE6w+tP+BGR9Ba5DNMgnjPJB6HfkClhERQaVCTE7QkT/jih5GfV7HYLdi6k qutBFqjV33osjCy0X+WMZSbCdEwvFLHHwXwkmWfy/Y4ehRO7jPQk66+xnX3Iux8C b0xZEBXyFEzFlXAAehoBgiackV8Spkg8S8LFWgz/eVx8UWzEm+17OiCzd2nSrAlA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrieefgdelhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffujghffffkgggtsehttdertddttddtnecuhfhrohhmpefmohhnrhgrugcu jfhinhhsvghnuceokhhonhhrrggurdhhihhnshgvnhesfhgrshhtmhgrihhlrdhnvghtqe enucggtffrrghtthgvrhhnpeeikeejjeevueeifeejhedtgeethfdutefgveffhfeuheej veeiieegvdfhtdeifeenucfkphepjeejrddvtdehrdduhedvrddufeehnecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepkhhonhhrrggurdhhihhn shgvnhesfhgrshhtmhgrihhlrdhnvght X-ME-Proxy: Received: from KHs-MacBook (135.152.205.77.rev.sfr.net [77.205.152.135]) by mail.messagingengine.com (Postfix) with ESMTPA id 389153280063; Wed, 29 Apr 2020 12:04:43 -0400 (EDT) From: Konrad Hinsen To: zimoun Subject: Re: [bug#40373] [PATCH] guix: new command "guix run-script" In-Reply-To: References: <875zeiudjm.fsf@gnu.org> <87mu7slwwh.fsf@gnu.org> <87mu7na8g6.fsf@gnu.org> Date: Wed, 29 Apr 2020 18:04:40 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 40373 Cc: Ludovic =?utf-8?Q?Court=C3=A8s?= , 40373@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi Simon, > If I understand well > guix run-script file1 file2 > is becoming: > guix repl --script=file1,file2,... > right? > > Well, I would say that > > --8<---------------cut here---------------start------------->8--- > the keyword "repl" stand for Read-Eval-Print-Loop > therefore the command will: > - read the script file1, > - eval it, > - print the results if they are, > - and finally loop if there is more than one script file. > --8<---------------cut here---------------end--------------->8--- That's very clever! The weak spot is the P, as script evaluation does not print anything. We could make it print the script's return code ;-) > But applying the same principles, the command > guix environment --ad-hoc python -- python > could mystified the learner too, if for example they forgets --ad-hoc > or '-- python'. Indeed. I never said that existing Guix commands are perfect ;-) In fact, I remember some debate about precisely the case of "guix environment". > And I still have in my stack how to propose another CLI naming as we > discussed earlier, e.g., > environment, package, etc. > reorganized into > profile, install, search, etc. The CLI as an eternal construction site ;-) Cheers, Konrad From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 30 08:42:52 2020 Received: (at 40373) by debbugs.gnu.org; 30 Apr 2020 12:42:52 +0000 Received: from localhost ([127.0.0.1]:45463 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jU8Wh-0006sN-U2 for submit@debbugs.gnu.org; Thu, 30 Apr 2020 08:42:52 -0400 Received: from mail-qt1-f193.google.com ([209.85.160.193]:33327) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jU8Wg-0006sA-Li for 40373@debbugs.gnu.org; Thu, 30 Apr 2020 08:42:50 -0400 Received: by mail-qt1-f193.google.com with SMTP id v26so4793508qto.0 for <40373@debbugs.gnu.org>; Thu, 30 Apr 2020 05:42:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8D1P4NjY+AztmU3KTXCSLkyr3cuiVmpHLW+7i8FZffE=; b=KD/PAt8hhypmC5d7YO/7yU1BceVqTELC03OyE5CmJZzox3annLdCJz9P7QJI4bGLw/ ouDF4XfbrvZmJCZ3t1/zP2Y+i2L59zwEe8ccQzU9fqZ76wkGNo/H8v5DhTZ1Fl4aZSIM O9rwjRSwlkfsl5+DQm+kHvbFdEoZWIxcTwgcN+kWTI52Lzkw8RKvcWZ6adZKVF9TYxe6 TfH/w0EA7jAyvT9DVIVedfL17FTGuQacSg6w5B8AbwFez4H7+Kb3ZP47JND9R3Ooc97S hb01M34G4schVlHnsucPUYYI0MMOcyYAh8x+gFaJfKWVii4hMTAGRpxeZUgGdIysH1Da huRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8D1P4NjY+AztmU3KTXCSLkyr3cuiVmpHLW+7i8FZffE=; b=iY4WSSDqlPNYhQ45qTNDd7wiXM4mS46eQNKqNBCiAqLEV3UeReBWStr2SULOSoKU5/ 88lKwPYI9hbTqiTOUwtmU59ExP6Pp/wVwGwv/xrol09dqJ+YW4/tmgH8zVJeieJAvecH 99AzlPyjAjw/lTYkozkPrfpDY4FOC1DtAgSTGmVW+w6hfzmOU+Is8KaX01/R5caW6mfz uaPjU3NNT8wdi/n2x5s+1oq4lx2XFVvYRLq2Udxdvb7T41UaJNYz2upmsKKOZRfz/7EP RmmjYMeIzJRQpV4p6Pick3FMK8A8VB2ZFHmyGk7MKfn7rmgkalo6lxMbmACU/LHIk0Aw B+9A== X-Gm-Message-State: AGi0Pua7oebXfZsZPLHlZwGRCRuMS9Yru3Bm1+cjcIcpUzt7RS400Tov dJHHlRXeHLBWxECEu5zcWCzB/3YDNq6toszIR5s= X-Google-Smtp-Source: APiQypJ5o6tqhjliUeSo1oBEQrxTPthjZg88BOqkUg5TK/tEVvb4YduPSknVi2aFLOfql30LwcGUnM9PB6KvJJZFyMM= X-Received: by 2002:ac8:758a:: with SMTP id s10mr3446411qtq.217.1588250564938; Thu, 30 Apr 2020 05:42:44 -0700 (PDT) MIME-Version: 1.0 References: <875zeiudjm.fsf@gnu.org> <87mu7slwwh.fsf@gnu.org> <87mu7na8g6.fsf@gnu.org> In-Reply-To: From: zimoun Date: Thu, 30 Apr 2020 14:42:33 +0200 Message-ID: Subject: Re: [bug#40373] [PATCH] guix: new command "guix run-script" To: Konrad Hinsen Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 40373 Cc: =?UTF-8?Q?Ludovic_Court=C3=A8s?= , 40373@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Konrad, On Wed, 29 Apr 2020 at 18:04, Konrad Hinsen wrote: > That's very clever! The weak spot is the P, as script evaluation does > not print anything. We could make it print the script's return code ;-) Hum? The usual REPL neither. :-) Quoting Wikipedia: "print function takes the result yielded by eval" but from my understanding 'eval' does not always yield a "printable" result, e.g., "(define foo 42)". Cheers, simon From debbugs-submit-bounces@debbugs.gnu.org Mon May 04 09:55:08 2020 Received: (at 40373) by debbugs.gnu.org; 4 May 2020 13:55:08 +0000 Received: from localhost ([127.0.0.1]:59406 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jVbYq-0008D0-Hk for submit@debbugs.gnu.org; Mon, 04 May 2020 09:55:08 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:58249) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jVbYo-0008At-E7 for 40373@debbugs.gnu.org; Mon, 04 May 2020 09:55:06 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 0F4B65C015B; Mon, 4 May 2020 09:55:01 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Mon, 04 May 2020 09:55:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.net; h= from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; s=fm3; bh=y38vUl4PJfwaALkP0WHaMZhTjq NI7sLy7P4dCByIoy8=; b=yR3LDxSWDFmc/Cr2u1h8qH3J9XuU0WojO9uWRxfyvi 7Ss6I2SyPl5ggyZjU6gzdLfX4BHWlNs5BMJmusjIRkR4/ORkNL/mAVljajj2mG6s u5gIwoWCID24pTEiLuswE9xuedWIBB5+8cZJDdcz/QwffbBOfQFncPLqpHNKp4Zg Uarr5TzqEEU0ZE9dK0KhgxTbRDbBUgXv+4LjN4jfLoIeWRpgjVcySAsLtX64GfEC Mw/NOxOeSwrBL8jlS5i3loJnKJla+i4to1YIaNdWCwJ2hNPsoLW7CV/3iBC7AgHZ nN4fR7W11PVfyTX/784T0Q5xJrsm39FNrblTAW/4VSGg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=y38vUl 4PJfwaALkP0WHaMZhTjqNI7sLy7P4dCByIoy8=; b=2OVKoYz6phhbaMPPKutf5F BuArENkJF9kW41TOA5QRPeDntTZFZ32WrgWIYh5i4rf1hd7YBzq5CwYzS6XhTYPh wMRK8vzXZ0xBHWsMmhmLs903looSGHRgfPIb/87wnGeUCGPWXD6b69x5cBfA+Ppg +kMGCmz1CODQF+iLqtiN5AnFg4PEvCG/u2x2S6xnpWKisQSdR9tfweLIS7hDOYwU 5iHic2ufQNq3Z5Hrd+cd8pUxB2AzEAg6eS0/1bLACyLmOi7GIDH2lwaminXFMUgK 5AzGXENDyXDyd2ytBNg+YkCDm94m8qAGS3BZVShdz4DiP+d65vPJiH77C7R2UOiQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrjeeggdeifecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffujghffffkgggtsehttdertddttddtnecuhfhrohhmpefmohhnrhgrugcu jfhinhhsvghnuceokhhonhhrrggurdhhihhnshgvnhesfhgrshhtmhgrihhlrdhnvghtqe enucggtffrrghtthgvrhhnpeeikeejjeevueeifeejhedtgeethfdutefgveffhfeuheej veeiieegvdfhtdeifeenucfkphepledvrdduieelrddujeefrddvvdehnecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepkhhonhhrrggurdhhihhn shgvnhesfhgrshhtmhgrihhlrdhnvght X-ME-Proxy: Received: from khs-macbook.home (lfbn-idf2-1-1364-225.w92-169.abo.wanadoo.fr [92.169.173.225]) by mail.messagingengine.com (Postfix) with ESMTPA id 225633280059; Mon, 4 May 2020 09:55:00 -0400 (EDT) From: Konrad Hinsen To: zimoun Subject: Re: [bug#40373] [PATCH] guix: new command "guix run-script" In-Reply-To: References: <875zeiudjm.fsf@gnu.org> <87mu7slwwh.fsf@gnu.org> <87mu7na8g6.fsf@gnu.org> Date: Mon, 04 May 2020 15:54:59 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 40373 Cc: Ludovic =?utf-8?Q?Court=C3=A8s?= , 40373@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi Simon, >> That's very clever! The weak spot is the P, as script evaluation does >> not print anything. We could make it print the script's return code ;-) > > Hum? The usual REPL neither. :-) You mean... they have been LYING to us all the time... about the REPL? > Quoting Wikipedia: "print function takes the result yielded by eval" > but from my understanding 'eval' does not always yield a "printable" > result, e.g., "(define foo 42)". True, not always. But for scripts it's never. We have to find some nice three-valued logic rhetoric that applies to all situations ;-) Command line: - read an expression, - eval it, - print the result of the evaluation (if any), - and finally loop to process the next expression Scripts: - read the script file1, - eval it, - print the textual output of the script (if any), - and finally loop if there is more than one script file. That makes "print" look optional in both cases. Cheers, Konrad. From debbugs-submit-bounces@debbugs.gnu.org Mon May 04 13:48:37 2020 Received: (at 40373) by debbugs.gnu.org; 4 May 2020 17:48:37 +0000 Received: from localhost ([127.0.0.1]:33912 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jVfCn-0002JY-83 for submit@debbugs.gnu.org; Mon, 04 May 2020 13:48:37 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:36804) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jVfCm-0002JL-2j for 40373@debbugs.gnu.org; Mon, 04 May 2020 13:48:36 -0400 Received: by mail-qt1-f196.google.com with SMTP id w29so245542qtv.3 for <40373@debbugs.gnu.org>; Mon, 04 May 2020 10:48:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5wE+kA6HwWQ2Vu3Pc4flTWgMHjbTSTsGb51gCVvgBIo=; b=Z4NdvwsQuLCq3ZgbmgdYqCogywr2lvo41iNpt3nuk82jNEaTHtKe/e6LCJLc65K+sq pLdaBxUSULcqriVHyZydUJ4dpo5j7gJJmwUkZS2T+OBmVHxkk9YYHHbGrCjXp11dgm7G wgV3CZVjCUyV54bXFtIY5YdgyVBgXOgPMhnyrlZX82z80zCxPEcpa5WjQtKdBbnHYLKo tnwZv6s6uWY4MKSAigKbCEDs9gUaJGhzuc2N8mfpOkwkY5WUTyIIsc8T+a0GS5Lmos09 m/4Z3AiZGGxYOio0MHn+gtGChbM1rpuUxXjinyOecLqpymr2ytUkV87Sh9Qg9+Td/leQ 0/6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5wE+kA6HwWQ2Vu3Pc4flTWgMHjbTSTsGb51gCVvgBIo=; b=U6QTScuckc+wZmbkUzbQieY/wsa568ehS8FwQv7toZ64iS5Y+93fEIBsZmJG9rBpu9 d8sHTVGczHzzv/a+d5ogZbRnZJdfhiYpqqK28ebOY98YckvN81BLunwQcjkiEj/GspwK dl2w8u0OaVhT8xZSeDemNCuP8JBgzeK6LD+0f4i2lQkEyS/kQfgf/h7jxXhFzTzAgC/Y +WInSrqTfSzPV+tSjnux2IIh0Ps+6tfQB1fCm3w6crYz768LvuXvx8FeOQJBYH2k+ag4 04fMu8k76BFeQanlGIAHfHlcFtU3yXdW8BMg9NiHGIhn255JaO5R2lFu6eTxa3Y9M5bY +GTA== X-Gm-Message-State: AGi0PuZ/4jkpKmFzTqyYJTEaRXJqnDIH9U1IYS0rNFIYEWuyVr/b8Jit KUN6m7l3ZU0Ul3AAPEIevyC8cecG6yy1eS05+E0= X-Google-Smtp-Source: APiQypJxD2AWD4G5jFi3uQ7v7J7avfPjEsWfyiKNgMnLGfkI2c2IeRCt/t6566V44K6UpSDHeAiCnTG5jA3G4WNT9nQ= X-Received: by 2002:ac8:4e0f:: with SMTP id c15mr225700qtw.211.1588614510429; Mon, 04 May 2020 10:48:30 -0700 (PDT) MIME-Version: 1.0 References: <875zeiudjm.fsf@gnu.org> <87mu7slwwh.fsf@gnu.org> <87mu7na8g6.fsf@gnu.org> In-Reply-To: From: zimoun Date: Mon, 4 May 2020 19:48:19 +0200 Message-ID: Subject: Re: [bug#40373] [PATCH] guix: new command "guix run-script" To: Konrad Hinsen Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 40373 Cc: =?UTF-8?Q?Ludovic_Court=C3=A8s?= , 40373@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Konrad, On Mon, 4 May 2020 at 15:55, Konrad Hinsen wrote: > True, not always. But for scripts it's never. We have to find some nice > three-valued logic rhetoric that applies to all situations ;-) > > Command line: > - read an expression, > - eval it, > - print the result of the evaluation (if any), > - and finally loop to process the next expression > > Scripts: > - read the script file1, > - eval it, > - print the textual output of the script (if any), > - and finally loop if there is more than one script file. > > That makes "print" look optional in both cases. It is how I personally understand all that. :-) So that's why I proposed "guix repl --script" (in short '-s') ;-) In this frame of "guix repl", the future additions/evolution could be: --eval,-e for evaluating one expression just after the script is loaded --debug for starting the "debugging" VM engine (personally never used with Guile) --language for switching to WISP (optimistic evolution of GWL :-)) --use-srfi for loading SRFI modules So it ends up with this kind of command-line: guix repl -L /path/to/stuff --use-srfi=9 guix repl -L /path/to/custom -s file.scm guix repl --language=wisp --script file.wsp guix repl -s file.scm -e '(package-name foo)' Well, 'repl' meaning "use the interpreter in the context of Guix". Is 'repl' enough meaningful for these use cases? Personally, I think so. :-) All the best, simon From debbugs-submit-bounces@debbugs.gnu.org Thu May 14 05:29:45 2020 Received: (at 40373) by debbugs.gnu.org; 14 May 2020 09:29:45 +0000 Received: from localhost ([127.0.0.1]:60271 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jZABV-0008DR-7N for submit@debbugs.gnu.org; Thu, 14 May 2020 05:29:45 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:51823) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jZABT-0008DA-Cr for 40373@debbugs.gnu.org; Thu, 14 May 2020 05:29:43 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 04D535C013B; Thu, 14 May 2020 05:29:38 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 14 May 2020 05:29:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.net; h= from:to:subject:in-reply-to:references:date:message-id :mime-version:content-type; s=fm3; bh=UMnJhXUcGQbi6k8KIr7ipzhhu3 pwJDgOrdCYYPE8iDs=; b=dRYDRL65/NxzGhb3mq0vc2VbcWUja8nY7s9aYQMK0j CQzIl72rrNaNYfDFzmkEE3C23AYB2bDaAdtCMS5Jf5wwGguGcENqeyk9WKJBzZZ+ K847Syi82BZvHOvu0ogG+ROVHrAzpFKjRo6YSBOm72LsvXlVQR5rWaUlgVqkyIbn MqKC6impqw9IJlXazs2S+D6mvDaeKDW+2keVT7/jocbWZRsEud3oLhQ/47R6np3k aDgJ5iQxJfC6mJL5XW09+bue0woiGJgZuo5yA6QxADGtngBSP2V/EomcyQ9M4fpQ e74FRhy8dnObPE8xNDMJPs6kxUE4xEl93OAahIk4ShkA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=UMnJhX UcGQbi6k8KIr7ipzhhu3pwJDgOrdCYYPE8iDs=; b=c+M/uL2XiTSXZ/ZLk9bL9c tOgYNH08Ble6yAPPK+tPhhLEliQBJlwygdCt+tKVhx/aWSE3G+giS/XqqhJTNt6F RZBoqQR4PG/w+0qwAHXpFL55jDiVs/c63uwdFt9hIrycOjnkPqV1UTn7fqEKdzaw 2z7bmWqZxt81zCD3cVveJK1HaVghpsUslxC9Kl8eKapeE2ZkSG4LRYYJMwlO1YAb 49DC18s0FfYGrDdghytQwIKW+BzkvU58HgaezLKhN4Y8IZVHrJ82FnWZqHHoOduW FiBWK8fQeB+6jAlkqUemOm7Wk5KDqaoBVzkPy3LJraG7sN4pAkGZXfrD1MXKxgqQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrleeigddugecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufgjfhffkfggtgesthdtredttd dttdenucfhrhhomhepmfhonhhrrgguucfjihhnshgvnhcuoehkohhnrhgrugdrhhhinhhs vghnsehfrghsthhmrghilhdrnhgvtheqnecuggftrfgrthhtvghrnhepieekjeejveeuie efjeehtdegtefhudetgfevfffhueehjeevieeigedvhfdtieefnecukfhppeelvddrudei ledrudejfedrvddvheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpehkohhnrhgrugdrhhhinhhsvghnsehfrghsthhmrghilhdrnhgvth X-ME-Proxy: Received: from khs-macbook.home (lfbn-idf2-1-1364-225.w92-169.abo.wanadoo.fr [92.169.173.225]) by mail.messagingengine.com (Postfix) with ESMTPA id 63A153060BE4; Thu, 14 May 2020 05:29:37 -0400 (EDT) From: Konrad Hinsen To: 40373@debbugs.gnu.org Subject: Re: [bug#40373] [PATCH] guix: new command "guix run-script" In-Reply-To: References: <875zeiudjm.fsf@gnu.org> <87mu7slwwh.fsf@gnu.org> <87mu7na8g6.fsf@gnu.org> Date: Thu, 14 May 2020 11:29:36 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 40373 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi everyone, Since this proposition does not seem to be going anywhere, I have submitted an alternative patch as bug#41253 which simply adds script execution to "guix repl", with no changes to the existing behavior, nor any new command. For my tutorial, I will use shell scripts that hide the guix command line from view, so that I do not have to explain it. This bug can thus be closed, and I'd have done it already if I knew how. I couldn't find any instructions. Cheers, Konrad. From debbugs-submit-bounces@debbugs.gnu.org Thu May 14 05:45:12 2020 Received: (at 40373-done) by debbugs.gnu.org; 14 May 2020 09:45:12 +0000 Received: from localhost ([127.0.0.1]:60276 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jZAQS-0000HN-GK for submit@debbugs.gnu.org; Thu, 14 May 2020 05:45:12 -0400 Received: from mail-qv1-f65.google.com ([209.85.219.65]:46484) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jZAQQ-0000H2-Sm for 40373-done@debbugs.gnu.org; Thu, 14 May 2020 05:45:11 -0400 Received: by mail-qv1-f65.google.com with SMTP id 59so1329406qva.13 for <40373-done@debbugs.gnu.org>; Thu, 14 May 2020 02:45:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5Lj7HKrPTUbbRv7VrU7BIZJ0aK98lkDa2J8zyrocpLc=; b=kaItGni3ebbjJAOj9X4Au5E5fNPNNgxBgCiG3Q4Md+rnvSFA3iHab2jtq9Zzh6jfA6 ZCojI9+UDV1tMt8zgYHGFLiiNvONdQ6gkpXa35NzxBGAYLP21Y8BG/d1MJUzIaGFEJpI Q0klc/5QoAVbtfOLeXS93L26WVC9Rup/LJZtAmUYWSCXGmnlLaTapKYTeC6WyvNfDyAJ R6p4SZIbvOlthfk0KO8qXHzfBc8Y3MV0GYt2bzAhHhtEi7rfd3d72hwhj5aqAYJGX0Fw 8TlpBQZnrKsAxPgdtIE4LgizSyk971GPcD02gE49ZElJv3bb2AomS5ZUI0JbEkVJr0/r /VcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5Lj7HKrPTUbbRv7VrU7BIZJ0aK98lkDa2J8zyrocpLc=; b=tBqM4Rx3O/C9yfx4McSWcHsoy0shYmu+4WBgLYr2TyHqzCo+ARH1o73hC3LT0RutCD Ds2CjZlqy13HwsQagLWpDwoYrkfrfR5mKSuLBMKqI9e0LYj4AakbLMBmtwkqoLenWIBO ksFbj0UiEKrAhghtFHmFjBFQ8tMSqsd3iTNI6DTd9OLkjLBDhhq4ryTutRoa3xOpDjwL zMRL6zzVQa+YxJg2cNelEHuleeEo639ClxnvhEDZ06AcpELogMvhvsTogcMWoshIgCEA k4SPhdEjVbHTBGmAVxICQwvKcmpGltQKa2sw4vclsEhaQV/punA+Mm6TDPRJI/mklRr7 M1wg== X-Gm-Message-State: AOAM531iRj/CYu7Yb7WT1VH4H01CeB9BszJDVtbC/1HYPKCeBQBex70V c/P2F5hikkeK7jmqf2zLx9ha6fhsf1AjCY2refg= X-Google-Smtp-Source: ABdhPJxC+fNGOgjlbPUIOW34bHyMns/QUTT6ldo4DNRzdRe6mHvJ6rNzu65uJa2YyIe58N5mtbKWdKfAfpxTvWIxfwk= X-Received: by 2002:a0c:b45c:: with SMTP id e28mr3919393qvf.74.1589449505000; Thu, 14 May 2020 02:45:05 -0700 (PDT) MIME-Version: 1.0 References: <875zeiudjm.fsf@gnu.org> <87mu7slwwh.fsf@gnu.org> <87mu7na8g6.fsf@gnu.org> In-Reply-To: From: zimoun Date: Thu, 14 May 2020 11:44:53 +0200 Message-ID: Subject: Re: [bug#40373] [PATCH] guix: new command "guix run-script" To: Konrad Hinsen Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 40373-done Cc: 40373-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Konrad, On Thu, 14 May 2020 at 11:30, Konrad Hinsen wrote: > Since this proposition does not seem to be going anywhere, I have > submitted an alternative patch as bug#41253 which simply adds script > execution to "guix repl", with no changes to the existing behavior, nor > any new command. For my tutorial, I will use shell scripts that hide the > guix command line from view, so that I do not have to explain it. Cool! > This bug can thus be closed, and I'd have done it already if I knew > how. I couldn't find any instructions. Two ways: - answer to 40373-done@debbugs.gnu.org; as it is done here. - send to controls@debbugs.gnu.org with the body: close 30373 thanks https://debbugs.gnu.org/server-control.html Cheers, simon From unknown Mon Jun 16 23:53:30 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 11 Jun 2020 11:24:08 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator