GNU bug report logs - #51948
[PATCH] [core-updates-frozen] Wrap meson with python code

Previous Next

Package: guix-patches;

Reported by: Vivien Kraus <vivien <at> planete-kraus.eu>

Date: Thu, 18 Nov 2021 14:24:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

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

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#51948; Package guix-patches. (Thu, 18 Nov 2021 14:24:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Vivien Kraus <vivien <at> planete-kraus.eu>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Thu, 18 Nov 2021 14:24:02 GMT) Full text and rfc822 format available.

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

From: Vivien Kraus <vivien <at> planete-kraus.eu>
To: guix-patches <at> gnu.org
Subject: [PATCH] Meson needs proper wrapping
Date: Thu, 18 Nov 2021 15:23:48 +0100
[Message part 1 (text/plain, inline)]
Dear guix,

Meson needs to be wrapped, but the wrapping must not execute a new
process, if I understand correctly. I could use wrap-script, but I think
it’s more pythonic to set the path through sys.path rather than setting
an environment variable.

Now, this will create a world rebuild… What do you think?

Vivien

[0001-gnu-meson-Extend-the-python-path-in-the-installed-pr.patch (text/x-patch, attachment)]
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#51948; Package guix-patches. (Thu, 18 Nov 2021 16:02:02 GMT) Full text and rfc822 format available.

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

From: Vivien Kraus <vivien <at> planete-kraus.eu>
To: 51948 <at> debbugs.gnu.org
Subject: Re: bug#51948: Acknowledgement ([PATCH] Meson needs proper wrapping)
Date: Thu, 18 Nov 2021 17:00:25 +0100
[Message part 1 (text/plain, inline)]
If I put the code in a new variable, we avoid a world rebuild, is it
better?

Vivien

[0001-gnu-meson-Extend-the-python-path-in-the-installed-pr.patch (text/x-patch, attachment)]
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#51948; Package guix-patches. (Fri, 19 Nov 2021 13:13:01 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Vivien Kraus <vivien <at> planete-kraus.eu>
Cc: 51948 <at> debbugs.gnu.org
Subject: Re: bug#51948: [PATCH] Meson needs proper wrapping
Date: Fri, 19 Nov 2021 14:12:43 +0100
Hi!

Vivien Kraus <vivien <at> planete-kraus.eu> skribis:

> Meson needs to be wrapped, but the wrapping must not execute a new
> process, if I understand correctly. I could use wrap-script, but I think
> it’s more pythonic to set the path through sys.path rather than setting
> an environment variable.

Isn’t that what ‘wrap-script’ does?

> Now, this will create a world rebuild… What do you think?

Not good!  :-)

This Meson issue is not a regression compared to master, is it?

How about providing a user-facing ‘meson’ package that incorporates this
fix, while keeping the other ‘meson’ packages unchanged, to avoid
rebuilding too much?  This can be achieved by marking the other packages
as hidden.

> From 08845844e8e1a18232bf54f9f3f0b71d5e0c71ef Mon Sep 17 00:00:00 2001
> From: Vivien Kraus <vivien <at> planete-kraus.eu>
> Date: Thu, 18 Nov 2021 15:17:52 +0100
> Subject: [PATCH] gnu: meson: Extend the python path in the installed program.
>
> * gnu/packages/build-tools.scm (meson) [phase wrap]: Wrap the python path as
> python code.
> ---
>  gnu/packages/build-tools.scm | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/build-tools.scm b/gnu/packages/build-tools.scm
> index 849101c2a4..ef5aa4bd35 100644
> --- a/gnu/packages/build-tools.scm
> +++ b/gnu/packages/build-tools.scm
> @@ -283,7 +283,21 @@ (define-public meson
>         #:phases (modify-phases %standard-phases
>                    ;; Meson calls the various executables in out/bin through the
>                    ;; Python interpreter, so we cannot use the shell wrapper.
> -                  (delete 'wrap))))
> +                  (replace 'wrap
> +                    (lambda* (#:key outputs #:allow-other-keys)
> +                      (let ((path (string-split (getenv "GUIX_PYTHONPATH") #\:)))
> +                        (substitute* (string-append (assoc-ref outputs "out") "/bin/meson")

Could you check ‘guix gc --references meson’ to make sure it does not
capture too much?  (GUIX_PYTHONPATH might contain references to
build-time dependencies.)

I suppose GUIX_PYTHONPATH contains the package’s “out”, right?

Thanks!

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#51948; Package guix-patches. (Fri, 19 Nov 2021 13:56:02 GMT) Full text and rfc822 format available.

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

From: Vivien Kraus <vivien <at> planete-kraus.eu>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 51948 <at> debbugs.gnu.org
Subject: Re: bug#51948: [PATCH] Meson needs proper wrapping
Date: Fri, 19 Nov 2021 14:20:50 +0100
[Message part 1 (text/plain, inline)]
Ludovic Courtès <ludo <at> gnu.org> writes:
> Vivien Kraus <vivien <at> planete-kraus.eu> skribis:
>> Meson needs to be wrapped, but the wrapping must not execute a new
>> process, if I understand correctly. I could use wrap-script, but I think
>> it’s more pythonic to set the path through sys.path rather than setting
>> an environment variable.
>
> Isn’t that what ‘wrap-script’ does?
I think wrap-script converts the python script to a guile script that
happens to be the same file as the python script. I realize it won’t
even insert python code in the final program, so the wrapping code won’t
be executed when the python module is loaded by the python interpreter.

> How about providing a user-facing ‘meson’ package that incorporates this
> fix, while keeping the other ‘meson’ packages unchanged, to avoid
> rebuilding too much?  This can be achieved by marking the other packages
> as hidden.
I pushed an update that does precisely that. Is the name "meson-wrapped"
OK? Also, how can I influence guix to rather install the wrapped version
when the user invokes "guix install meson"?

> Could you check ‘guix gc --references meson’ to make sure it does not
> capture too much?  (GUIX_PYTHONPATH might contain references to
> build-time dependencies.)

I see, the only thing to wrap is just the "out" output in fact.

[0001-gnu-meson-Extend-the-python-path-in-the-installed-pr.patch (text/x-patch, attachment)]
[Message part 3 (text/plain, inline)]
Vivien
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#51948; Package guix-patches. (Fri, 19 Nov 2021 22:18:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Vivien Kraus <vivien <at> planete-kraus.eu>
Cc: 51948 <at> debbugs.gnu.org
Subject: Re: bug#51948: [PATCH] Meson needs proper wrapping
Date: Fri, 19 Nov 2021 23:17:21 +0100
Hi,

Vivien Kraus <vivien <at> planete-kraus.eu> skribis:

>> How about providing a user-facing ‘meson’ package that incorporates this
>> fix, while keeping the other ‘meson’ packages unchanged, to avoid
>> rebuilding too much?  This can be achieved by marking the other packages
>> as hidden.
> I pushed an update that does precisely that. Is the name "meson-wrapped"
> OK? Also, how can I influence guix to rather install the wrapped version
> when the user invokes "guix install meson"?

I you just add another meson <at> 0.60 package like this patch does, the UI
will complain that “meson <at> 0.60” is ambiguous, that there are two of them.

To work around it, I’d mark the unwrapped meson <at> 0.60 as hidden (using
the ‘properties’ field) while keeping the other one visible.

That way “guix install meson” will install the wrapped one.

Does that make sense?

TIA,
Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#51948; Package guix-patches. (Fri, 19 Nov 2021 22:41:02 GMT) Full text and rfc822 format available.

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

From: Vivien Kraus <vivien <at> planete-kraus.eu>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 51948 <at> debbugs.gnu.org
Subject: Re: bug#51948: [PATCH] Meson needs proper wrapping
Date: Fri, 19 Nov 2021 23:34:19 +0100
[Message part 1 (text/plain, inline)]
Ludovic Courtès <ludo <at> gnu.org> writes:
>> I pushed an update that does precisely that. Is the name "meson-wrapped"
>> OK? Also, how can I influence guix to rather install the wrapped version
>> when the user invokes "guix install meson"?
>
> I you just add another meson <at> 0.60 package like this patch does, the UI
> will complain that “meson <at> 0.60” is ambiguous, that there are two of them.
>
> To work around it, I’d mark the unwrapped meson <at> 0.60 as hidden (using
> the ‘properties’ field) while keeping the other one visible.
>
> That way “guix install meson” will install the wrapped one.

I think that’s good: I build it with guix shell meson or guix build
meson, and I can run its absolute file name in a guix shell --pure
gcc. However, it does not seem to cause a world rebuild.

Vivien

[0001-gnu-meson-Extend-the-python-path-in-the-installed-pr.patch (text/x-patch, attachment)]
[signature.asc (application/pgp-signature, inline)]

Changed bug title to '[PATCH] [core-updates-frozen] Wrap meson with python code' from '[PATCH] Meson needs proper wrapping' Request was from Vivien Kraus <vivien <at> planete-kraus.eu> to control <at> debbugs.gnu.org. (Mon, 22 Nov 2021 17:27:02 GMT) Full text and rfc822 format available.

Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Mon, 22 Nov 2021 21:45:02 GMT) Full text and rfc822 format available.

Notification sent to Vivien Kraus <vivien <at> planete-kraus.eu>:
bug acknowledged by developer. (Mon, 22 Nov 2021 21:45:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Vivien Kraus <vivien <at> planete-kraus.eu>
Cc: 51948-done <at> debbugs.gnu.org
Subject: Re: bug#51948: [PATCH] [core-updates-frozen] Wrap meson with python
 code
Date: Mon, 22 Nov 2021 22:44:21 +0100
Hi,

Vivien Kraus <vivien <at> planete-kraus.eu> skribis:

> From 3f77d8d5c652725411a21434443cbf2a2d135575 Mon Sep 17 00:00:00 2001
> From: Vivien Kraus <vivien <at> planete-kraus.eu>
> Date: Thu, 18 Nov 2021 15:17:52 +0100
> Subject: [PATCH] gnu: meson: Extend the python path in the installed program.
>
> * gnu/packages/build-tools.scm (meson-wrapped): New variable.

Applied, thanks!

As discussed on IRC, I followed up with a patch that moves Python from
‘propagated-inputs’ (!) to ‘inputs’ in ‘meson-wrapped’.  Most likely
Python was propagated just for the sake of setting GUIX_PYTHONPATH, but
it’s bad style as it forces it into user profiles.

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 21 Dec 2021 12:24:08 GMT) Full text and rfc822 format available.

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

Previous Next


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