Subject: bug#39945: closed (Re: [bug#39945] [PATCH 0/1] Introducing 'with-parameters' for gexp dynamic binding)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 12 Mar 2020 17:35:01 +0000

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 [email-masked].

-- 
39945: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=39945
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: [bug#39945] [PATCH 0/1] Introducing 'with-parameters' for gexp dynamic binding
From: Ludovic Courtès <[email-masked]>
To: Mathieu Othacehe <[email-masked]>
Cc: [email-masked]
Date: Thu, 12 Mar 2020 18:34:03 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi Mathieu,

Mathieu Othacehe <[email-masked]> skribis:

>> Thoughts?
>>
>> Besides, ‘with-parameters’ is the dual of what was discussed at
>> <https://issues.guix.gnu.org/issue/29296>.
>
> 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 <native-qemu> package
you proposed:

  #~(… #+(with-parameters ((%current-system %system)) qemu) …)

However, the issue I mentioned before with this approach remain:

  […] now the result of:

    guix system build -s armhf-linux -d …

  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’.

Subject: [PATCH 0/1] Introducing 'with-parameters' for gexp dynamic binding
From: Ludovic Courtès <[email-masked]>
To: [email-masked]
Cc: Ludovic Courtès <[email-masked]>
Date: Fri, 6 Mar 2020 11:41:08 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

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
<https://issues.guix.gnu.org/issue/29296>.

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