From unknown Fri Aug 15 15:37:43 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#39945] [PATCH 0/1] Introducing 'with-parameters' for gexp dynamic binding Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 06 Mar 2020 10:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 39945 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 39945@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.158349128628592 (code B ref -1); Fri, 06 Mar 2020 10:42:02 +0000 Received: (at submit) by debbugs.gnu.org; 6 Mar 2020 10:41:26 +0000 Received: from localhost ([127.0.0.1]:44128 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jAAQ2-0007R6-Hf for submit@debbugs.gnu.org; Fri, 06 Mar 2020 05:41:26 -0500 Received: from lists.gnu.org ([209.51.188.17]:57852) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jAAQ0-0007Qx-F7 for submit@debbugs.gnu.org; Fri, 06 Mar 2020 05:41:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34555) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jAAPz-0001Mq-8y for guix-patches@gnu.org; Fri, 06 Mar 2020 05:41:24 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_20, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:470:142:3::e]:37128) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jAAPz-0003Rc-4r; Fri, 06 Mar 2020 05:41:23 -0500 Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=59888 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jAAPy-0002HJ-B7; Fri, 06 Mar 2020 05:41:22 -0500 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Fri, 6 Mar 2020 11:41:08 +0100 Message-Id: <20200306104108.19503-1-ludo@gnu.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) 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 Guix! This patch adds a new ‘with-parameters’ form. It is like ‘parameterize’ except that it takes effect when a file-like object is lowered, as in: ;; Return coreutils for i686. (with-parameters ((%current-system "i686-linux")) coreutils) ‘with-parameters’ is necessary because if you would use ‘parameterize’ in the example above, it wouldn’t have any effect at all: the dynamic binding would be installed at the wrong time. It works for any SRFI-39 parameter, though ‘%current-system’ is my main use case. It makes it possible to have gexps or manifests that include things explicitly targeting a given system. (For instance, I’d like to have a manifest for release-critical things that explicitly pins the targeted systems.) Note that ‘with-parameters’ applies to file-like objects; it is _not_ a property of the gexp itself. So one cannot, for example, write: (with-parameters ((%current-system "i686-linux")) #~(a b c d)) I feel like it’s better this way, though it could be confusing. Thoughts? Besides, ‘with-parameters’ is the dual of what was discussed at . Thanks, Ludo’. Ludovic Courtès (1): gexp: Add 'with-parameters'. .dir-locals.el | 1 + doc/guix.texi | 19 ++++++++++++++++ guix/gexp.scm | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/gexp.scm | 28 ++++++++++++++++++++++++ 4 files changed, 107 insertions(+) -- 2.25.1 From unknown Fri Aug 15 15:37:43 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#39945] [PATCH 1/1] gexp: Add 'with-parameters'. References: <20200306104108.19503-1-ludo@gnu.org> In-Reply-To: <20200306104108.19503-1-ludo@gnu.org> Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 06 Mar 2020 10:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39945 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 39945@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 39945-submit@debbugs.gnu.org id=B39945.158349203929700 (code B ref 39945); Fri, 06 Mar 2020 10:54:02 +0000 Received: (at 39945) by debbugs.gnu.org; 6 Mar 2020 10:53:59 +0000 Received: from localhost ([127.0.0.1]:44140 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jAAcB-0007ix-CR for submit@debbugs.gnu.org; Fri, 06 Mar 2020 05:53:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44040) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jAAc9-0007il-RN for 39945@debbugs.gnu.org; Fri, 06 Mar 2020 05:53:58 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:37994) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jAAc4-0004EH-3z; Fri, 06 Mar 2020 05:53:52 -0500 Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=59898 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jAAc3-0003rI-Ii; Fri, 06 Mar 2020 05:53:51 -0500 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Fri, 6 Mar 2020 11:53:45 +0100 Message-Id: <20200306105345.19782-1-ludo@gnu.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) 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/gexp.scm (): New record type. (with-parameters): New macro. (compile-parameterized): New gexp compiler. * tests/gexp.scm ("with-parameters for %current-system") ("with-parameters + file-append"): New tests. * doc/guix.texi (G-Expressions): Document it. --- .dir-locals.el | 1 + doc/guix.texi | 19 ++++++++++++++++ guix/gexp.scm | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/gexp.scm | 28 ++++++++++++++++++++++++ 4 files changed, 107 insertions(+) diff --git a/.dir-locals.el b/.dir-locals.el index 5ce3fbc9a5..1976f7e60d 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -83,6 +83,7 @@ (eval . (put 'wrap-program 'scheme-indent-function 1)) (eval . (put 'with-imported-modules 'scheme-indent-function 1)) (eval . (put 'with-extensions 'scheme-indent-function 1)) + (eval . (put 'with-parameters 'scheme-indent-function 1)) (eval . (put 'with-database 'scheme-indent-function 2)) (eval . (put 'call-with-transaction 'scheme-indent-function 2)) diff --git a/doc/guix.texi b/doc/guix.texi index fab9159530..9ad6db7fc0 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -8021,6 +8021,25 @@ the second case, the resulting script contains a @code{(string-append @dots{})} expression to construct the file name @emph{at run time}. @end deffn +@deffn {Scheme Syntax} with-parameters ((@var{parameter} @var{value}) @dots{}) @var{exp} +This macro is similar to the @code{parameterize} form for +dynamically-bound @dfn{parameters} (@pxref{Parameters,,, guile, GNU +Guile Reference Manual}). The key difference is that it takes effect +when the file-like object returned by @var{exp} is lowered to a +derivation or store item. + +A typical use of @code{with-parameters} is to force the system in effect +for a given object: + +@lisp +(with-parameters ((%current-system "i686-linux")) + coreutils) +@end lisp + +The example above returns an object that corresponds to the i686 build +of Coreutils, regardless of the current value of @code{%current-system}. +@end deffn + Of course, in addition to gexps embedded in ``host'' code, there are also modules containing build tools. To make it clear that they are diff --git a/guix/gexp.scm b/guix/gexp.scm index c4f4e80209..d3e1b34dac 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -82,6 +82,9 @@ raw-derivation-file raw-derivation-file? + with-parameters + parameterized? + load-path-expression gexp-modules @@ -520,6 +523,62 @@ SUFFIX." (base (expand base lowered output))) (string-append base (string-concatenate suffix))))))) +;; Representation of SRFI-39 parameter settings in the dynamic scope of an +;; object lowering. +(define-record-type + (parameterized bindings thunk) + parameterized? + (bindings parameterized-bindings) ;list of parameter/value pairs + (thunk parameterized-thunk)) ;thunk + +(define-syntax-rule (with-parameters ((param value) ...) body ...) + "Bind each PARAM to the corresponding VALUE for the extent during which BODY +is lowered. Consider this example: + + (with-parameters ((%current-system \"x86_64-linux\")) + coreutils) + +It returns a object that ensures %CURRENT-SYSTEM is set to +x86_64-linux when COREUTILS is lowered." + (parameterized (list (list param (lambda () value)) ...) + (lambda () + body ...))) + +(define-gexp-compiler compile-parameterized + compiler => + (lambda (parameterized system target) + (match (parameterized-bindings parameterized) + (((parameters values) ...) + (let ((fluids (map parameter-fluid parameters)) + (thunk (parameterized-thunk parameterized))) + ;; Install the PARAMETERS for the dynamic extent of THUNK. + (with-fluids* fluids + (map (lambda (thunk) (thunk)) values) + (lambda () + ;; Special-case '%current-system' and '%current-target-system' to + ;; make sure we get the desired effect. + (let ((system (if (memq %current-system parameters) + (%current-system) + system)) + (target (if (memq %current-target-system parameters) + (%current-target-system) + target))) + (lower-object (thunk) system #:target target)))))))) + + expander => (lambda (parameterized lowered output) + (match (parameterized-bindings parameterized) + (((parameters values) ...) + (let ((fluids (map parameter-fluid parameters)) + (thunk (parameterized-thunk parameterized))) + ;; Install the PARAMETERS for the dynamic extent of THUNK. + (with-fluids* fluids + (map (lambda (thunk) (thunk)) values) + (lambda () + ;; Delegate to the expander of the wrapped object. + (let* ((base (thunk)) + (expand (lookup-expander base))) + (expand base lowered output))))))))) + ;;; ;;; Inputs & outputs. diff --git a/tests/gexp.scm b/tests/gexp.scm index 7c8985d846..904b1a687a 100644 --- a/tests/gexp.scm +++ b/tests/gexp.scm @@ -284,6 +284,34 @@ (((thing "out")) (eq? thing file)))))) +(test-assertm "with-parameters for %current-system" + (mlet* %store-monad ((system -> (match (%current-system) + ("aarch64-linux" "x86_64-linux") + (_ "aarch64-linux"))) + (drv (package->derivation coreutils system)) + (obj -> (with-parameters ((%current-system system)) + coreutils)) + (result (lower-object obj))) + (return (string=? (derivation-file-name drv) + (derivation-file-name result))))) + +(test-assert "with-parameters + file-append" + (let* ((system (match (%current-system) + ("aarch64-linux" "x86_64-linux") + (_ "aarch64-linux"))) + (drv (package-derivation %store coreutils system)) + (param (make-parameter 7)) + (exp #~(here we go #$(with-parameters ((%current-system system) + (param 42)) + (if (= (param) 42) + (file-append coreutils "/bin/touch") + %bootstrap-guile))))) + (match (gexp->sexp* exp) + (('here 'we 'go (? string? result)) + (string=? result + (string-append (derivation->output-path drv) + "/bin/touch")))))) + (test-assert "ungexp + ungexp-native" (let* ((exp (gexp (list (ungexp-native %bootstrap-guile) (ungexp coreutils) -- 2.25.1 From unknown Fri Aug 15 15:37:43 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#39945] [PATCH 0/1] Introducing 'with-parameters' for gexp dynamic binding Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 06 Mar 2020 11:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39945 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 39945@debbugs.gnu.org Cc: ludo@gnu.org X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , 39945@debbugs.gnu.org Received: via spool by submit@debbugs.gnu.org id=B.158349282830964 (code B ref -1); Fri, 06 Mar 2020 11:08:02 +0000 Received: (at submit) by debbugs.gnu.org; 6 Mar 2020 11:07:08 +0000 Received: from localhost ([127.0.0.1]:44162 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jAAou-00083K-4O for submit@debbugs.gnu.org; Fri, 06 Mar 2020 06:07:08 -0500 Received: from lists.gnu.org ([209.51.188.17]:56019) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jAAor-000837-Kh for submit@debbugs.gnu.org; Fri, 06 Mar 2020 06:07:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60134) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jAAoq-0002Nu-Gj for guix-patches@gnu.org; Fri, 06 Mar 2020 06:07:05 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jAAop-00019t-FJ for guix-patches@gnu.org; Fri, 06 Mar 2020 06:07:04 -0500 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:52988) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jAAon-00011W-K0; Fri, 06 Mar 2020 06:07:01 -0500 Received: by mail-wm1-x344.google.com with SMTP id p9so1917696wmc.2; Fri, 06 Mar 2020 03:07:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version:content-transfer-encoding; bh=bk/sWim5ZQ31gstLVqkIUw5PXStMw/T3SBC4g6gFL9Q=; b=NHWQ6IJ1XHN4XiWTc38MlHTjt3ds8QdJvcYLysLg4654781bElbAIgDWu6FPUzCSho +vinM5BLI69YN18QsyZGOBNnOV8XX6fUGw3OrYAIW5KVNI3RWOSwdXSbZtcmXl24G0x7 4BsLb2xlJz4niU52q17nHcThYwIykBrxfI+oNVhcChYGmxPdO6HLJR+ziTAIdeEnS9Yu W36fkNyRagDhXOPDwS0sPZe+XwydqQ9cODuTtUkvLvXvv3QbrLMOdYDhnQXr820+kK6Q qMb+F8XzmVrNARTrhwOsgMOzBfrjM4eNiksEWqNYJUodiDVX775USLbQdGcmQ8Q5/bPR Eziw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version:content-transfer-encoding; bh=bk/sWim5ZQ31gstLVqkIUw5PXStMw/T3SBC4g6gFL9Q=; b=jO1mSRw8vzG+m8L61EgmrZsT6bNAWlFrlediz8wAyeJGcs5Al/K/4/FPoimezT5IhP WapefBu5vJ3NRimt+RqdYMo5dGEQcTQPaAbxdtmQsAzfzuQ4SgPJdqHbtFL1MYtS1woJ LyfMcJ7BwUNuXyuYsCEbT11gCfz7KDUAgWT/pFDCWMe063TtQLo3IOn6wbbsh/Ow8wKb gTqqY5B1glp7aitUHJ6og9cK7wmF161o+GW12LAXsftf6Ec6EoLxnrjrqRweKWasOSlE H1rCweSVmL28H11wYJxlO82/I7IneIi/1ee7SxzlW2vB4TQi7StKQdlhH57A2FTIxhYn Gqgg== X-Gm-Message-State: ANhLgQ3RJi9jG0TzpupUCXU/tiLna7JCPyoo8wmspHj/hOLxRcfAM6OJ 7rYj/WzDjFs/QoIMr+U2DAsJKwAa X-Google-Smtp-Source: ADFU+vteQpslUby/SSSfbtNHvQrBgk9h6M7gAMbY0+bVPNEHXSRq3uaRPzQ7C3aKQieLv7QwgPt/XQ== X-Received: by 2002:a1c:7ec5:: with SMTP id z188mr3437855wmc.52.1583492820180; Fri, 06 Mar 2020 03:07:00 -0800 (PST) Received: from meru (lfbn-ann-1-269-240.w86-200.abo.wanadoo.fr. [86.200.224.240]) by smtp.gmail.com with ESMTPSA id s7sm9965051wrm.13.2020.03.06.03.06.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2020 03:06:59 -0800 (PST) References: <20200306104108.19503-1-ludo@gnu.org> User-agent: mu4e 1.2.0; emacs 26.3 From: Mathieu Othacehe In-reply-to: <20200306104108.19503-1-ludo@gnu.org> Date: Fri, 06 Mar 2020 12:06:58 +0100 Message-ID: <87pndpeo8d.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 X-Spam-Score: 0.3 (/) 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: -0.7 (/) Hey! > Thoughts? > > Besides, =E2=80=98with-parameters=E2=80=99 is the dual of what was discus= sed at > . Super nice! Maybe you could add a test-case involving %current-target-system but otherwise this LGTM. Do you think we could use this to get around this issue we discussed there: https://lists.gnu.org/archive/html/guix-devel/2019-12/msg00099.html. Thanks, Mathieu From unknown Fri Aug 15 15:37:43 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Subject: bug#39945: closed (Re: [bug#39945] [PATCH 0/1] Introducing 'with-parameters' for gexp dynamic binding) Message-ID: References: <87eetxqxys.fsf@gnu.org> <20200306104108.19503-1-ludo@gnu.org> X-Gnu-PR-Message: they-closed 39945 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 39945@debbugs.gnu.org Date: Thu, 12 Mar 2020 17:35:01 +0000 Content-Type: multipart/mixed; boundary="----------=_1584034501-12716-1" This is a multi-part message in MIME format... ------------=_1584034501-12716-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #39945: [PATCH 0/1] Introducing 'with-parameters' for gexp dynamic binding which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 39945@debbugs.gnu.org. --=20 39945: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D39945 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1584034501-12716-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 39945-done) by debbugs.gnu.org; 12 Mar 2020 17:34:13 +0000 Received: from localhost ([127.0.0.1]:57761 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jCRin-0003Hu-FL for submit@debbugs.gnu.org; Thu, 12 Mar 2020 13:34:13 -0400 Received: from eggs.gnu.org ([209.51.188.92]:57453) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jCRil-0003HZ-C6 for 39945-done@debbugs.gnu.org; Thu, 12 Mar 2020 13:34:11 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:34216) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jCRig-0005Fh-7f; Thu, 12 Mar 2020 13:34:06 -0400 Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=50932 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jCRif-0002ne-Oi; Thu, 12 Mar 2020 13:34:06 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Mathieu Othacehe Subject: Re: [bug#39945] [PATCH 0/1] Introducing 'with-parameters' for gexp dynamic binding References: <20200306104108.19503-1-ludo@gnu.org> <87pndpeo8d.fsf@gmail.com> Date: Thu, 12 Mar 2020 18:34:03 +0100 In-Reply-To: <87pndpeo8d.fsf@gmail.com> (Mathieu Othacehe's message of "Fri, 06 Mar 2020 12:06:58 +0100") Message-ID: <87eetxqxys.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: 39945-done Cc: 39945-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.7 (-) Hi Mathieu, Mathieu Othacehe skribis: >> Thoughts? >> >> Besides, =E2=80=98with-parameters=E2=80=99 is the dual of what was discu= ssed at >> . > > Super nice! Maybe you could add a test-case involving > %current-target-system but otherwise this LGTM. Done and pushed as cf2ac04f13d9266c7c8a2ebd2e85ef593231ac9d. > Do you think we could use this to get around this issue we discussed > there: > https://lists.gnu.org/archive/html/guix-devel/2019-12/msg00099.html. It could be use to achieve the same result as the package you proposed: #~(=E2=80=A6 #+(with-parameters ((%current-system %system)) qemu) =E2=80= =A6) However, the issue I mentioned before with this approach remain: [=E2=80=A6] now the result of: guix system build -s armhf-linux -d =E2=80=A6 would be dependent on the actual system type. In other words, the result would be different if you run it on armhf-linux, if you run it on x86_64-linux, or if you run it on i686-linux. Not great. Thanks for your feedback! Ludo=E2=80=99. ------------=_1584034501-12716-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 6 Mar 2020 10:41:26 +0000 Received: from localhost ([127.0.0.1]:44128 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jAAQ2-0007R6-Hf for submit@debbugs.gnu.org; Fri, 06 Mar 2020 05:41:26 -0500 Received: from lists.gnu.org ([209.51.188.17]:57852) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jAAQ0-0007Qx-F7 for submit@debbugs.gnu.org; Fri, 06 Mar 2020 05:41:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34555) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jAAPz-0001Mq-8y for guix-patches@gnu.org; Fri, 06 Mar 2020 05:41:24 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_20, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:470:142:3::e]:37128) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jAAPz-0003Rc-4r; Fri, 06 Mar 2020 05:41:23 -0500 Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=59888 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jAAPy-0002HJ-B7; Fri, 06 Mar 2020 05:41:22 -0500 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: guix-patches@gnu.org Subject: [PATCH 0/1] Introducing 'with-parameters' for gexp dynamic binding Date: Fri, 6 Mar 2020 11:41:08 +0100 Message-Id: <20200306104108.19503-1-ludo@gnu.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: submit Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= 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 Guix! This patch adds a new ‘with-parameters’ form. It is like ‘parameterize’ except that it takes effect when a file-like object is lowered, as in: ;; Return coreutils for i686. (with-parameters ((%current-system "i686-linux")) coreutils) ‘with-parameters’ is necessary because if you would use ‘parameterize’ in the example above, it wouldn’t have any effect at all: the dynamic binding would be installed at the wrong time. It works for any SRFI-39 parameter, though ‘%current-system’ is my main use case. It makes it possible to have gexps or manifests that include things explicitly targeting a given system. (For instance, I’d like to have a manifest for release-critical things that explicitly pins the targeted systems.) Note that ‘with-parameters’ applies to file-like objects; it is _not_ a property of the gexp itself. So one cannot, for example, write: (with-parameters ((%current-system "i686-linux")) #~(a b c d)) I feel like it’s better this way, though it could be confusing. Thoughts? Besides, ‘with-parameters’ is the dual of what was discussed at . Thanks, Ludo’. Ludovic Courtès (1): gexp: Add 'with-parameters'. .dir-locals.el | 1 + doc/guix.texi | 19 ++++++++++++++++ guix/gexp.scm | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/gexp.scm | 28 ++++++++++++++++++++++++ 4 files changed, 107 insertions(+) -- 2.25.1 ------------=_1584034501-12716-1--