Subject: [bug#30761] [PATCH staging 1/9] gnu: meson: Don't wrap the meson executable.

From: Marius Bakke <[email-masked]>
Date: Mon, 12 Mar 2018 14:08:29 +0100

Marius Bakke <[email-masked]> writes:

> Ludovic Courtès <[email-masked]> writes:
>
>> Hello!
>>
>> Marius Bakke <[email-masked]> skribis:
>>
>>> * gnu/packages/build-tools.scm (meson)[arguments]: Delete WRAP-PHASE.
>>> ---
>>>  gnu/packages/build-tools.scm | 5 +++++
>>>  1 file changed, 5 insertions(+)
>>>
>>> diff --git a/gnu/packages/build-tools.scm b/gnu/packages/build-tools.scm
>>> index 2abb44fdb..1ebccca43 100644
>>> --- a/gnu/packages/build-tools.scm
>>> +++ b/gnu/packages/build-tools.scm
>>> @@ -81,6 +81,11 @@ makes a few sacrifices to acquire fast full and incremental build times.")
>>>                 (base32
>>>                  "06r8limj38mv884s5riiz6lpzw37cvhbf9jd0smzcbi7fwmv3yah"))))
>>>      (build-system python-build-system)
>>> +    (arguments
>>> +     `(#:phases (modify-phases %standard-phases
>>> +                  ;; Meson runs itself through the Python interpreter, so
>>> +                  ;; we cannot use the shell wrapper.
>>> +                  (delete 'wrap))))
>>
>> I’m not sure what this means.  The ‘wrap’ phase is precisely for things
>> with #!/…/python, right?
>>
>> What problem does it solve?
>
> The problem is that at some point after 0.42 (the current
> meson-for-build), Meson does the equivalent of `python $(which meson)`
> at runtime.  Which ends up tripping over the shell wrapper.
>
> I don't remember exactly where I saw the problem, it could have been
> with "mesontest" which also resides in "meson/bin".  The only downside
> to deleting the wrapper is that you cannot call meson directly from the
> store; it works fine as long as PYTHONPATH is set (e.g. in a profile).

Actually, I just checked; "meson" in master does not work at all,
whether from the store or from a profile:

$ guix environment --ad-hoc meson -- meson --help
Traceback (most recent call last):
  File "/gnu/store/lv22yqqnwaz7zjacmgqi8v18d9manr0y-meson-0.44.0/bin/.meson-real", line 17, in <module>
    from mesonbuild import mesonmain, mesonlib
  File "/gnu/store/lv22yqqnwaz7zjacmgqi8v18d9manr0y-meson-0.44.0/lib/python3.6/site-packages/mesonbuild/mesonmain.py", line 18, in <module>
    from . import environment, interpreter, mesonlib
  File "/gnu/store/lv22yqqnwaz7zjacmgqi8v18d9manr0y-meson-0.44.0/lib/python3.6/site-packages/mesonbuild/environment.py", line 17, in <module>
    from . import coredata
  File "/gnu/store/lv22yqqnwaz7zjacmgqi8v18d9manr0y-meson-0.44.0/lib/python3.6/site-packages/mesonbuild/coredata.py", line 20, in <module>
    from .mesonlib import MesonException, commonpath
  File "/gnu/store/lv22yqqnwaz7zjacmgqi8v18d9manr0y-meson-0.44.0/lib/python3.6/site-packages/mesonbuild/mesonlib.py", line 60, in <module>
    meson_command = python_command + [detect_meson_py_location()]
  File "/gnu/store/lv22yqqnwaz7zjacmgqi8v18d9manr0y-meson-0.44.0/lib/python3.6/site-packages/mesonbuild/mesonlib.py", line 51, in detect_meson_py_location
    raise RuntimeError('Could not determine how to run Meson. Please file a bug with details.')
RuntimeError: Could not determine how to run Meson. Please file a bug with details.

So we really need to drop the wrapper.