[PATCH 0/3] Use meson_options.txt in the configure script

Thomas Huth posted 3 patches 2 years, 8 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20210829173210.39562-1-thuth@redhat.com
There is a newer version of this series
configure         | 429 ++++++----------------------------------------
meson_options.txt |   2 +-
2 files changed, 53 insertions(+), 378 deletions(-)
[PATCH 0/3] Use meson_options.txt in the configure script
Posted by Thomas Huth 2 years, 8 months ago
It's cumbersome to maintain the build options twice, one time in the
configure script and one time in meson_options.txt. Thus let's add some
logic to the configure script to look at the meson_options.txt file
instead of handling every option twice.

Thomas Huth (3):
  configure: Add the possibility to read options from meson_options.txt
  configure: Remove options that can be handled via meson_options.txt
    instead
  configure: Get help text from meson_options.txt

 configure         | 429 ++++++----------------------------------------
 meson_options.txt |   2 +-
 2 files changed, 53 insertions(+), 378 deletions(-)

-- 
2.27.0


Re: [PATCH 0/3] Use meson_options.txt in the configure script
Posted by Marc-André Lureau 2 years, 8 months ago
Hi Thomas

On Sun, Aug 29, 2021 at 9:32 PM Thomas Huth <thuth@redhat.com> wrote:

> It's cumbersome to maintain the build options twice, one time in the
> configure script and one time in meson_options.txt. Thus let's add some
> logic to the configure script to look at the meson_options.txt file
> instead of handling every option twice.
>
> Thomas Huth (3):
>   configure: Add the possibility to read options from meson_options.txt
>   configure: Remove options that can be handled via meson_options.txt
>     instead
>   configure: Get help text from meson_options.txt
>
>  configure         | 429 ++++++----------------------------------------
>  meson_options.txt |   2 +-
>  2 files changed, 53 insertions(+), 378 deletions(-)
>
>
It looks similar to:
https://patchew.org/QEMU/20210107140039.467969-1-pbonzini@redhat.com/

Isn't it? (I haven't studied in details neither, I may be out of topic).
Re: [PATCH 0/3] Use meson_options.txt in the configure script
Posted by Thomas Huth 2 years, 8 months ago
On 29/08/2021 23.22, Marc-André Lureau wrote:
> Hi Thomas
> 
> On Sun, Aug 29, 2021 at 9:32 PM Thomas Huth <thuth@redhat.com 
> <mailto:thuth@redhat.com>> wrote:
> 
>     It's cumbersome to maintain the build options twice, one time in the
>     configure script and one time in meson_options.txt. Thus let's add some
>     logic to the configure script to look at the meson_options.txt file
>     instead of handling every option twice.
> 
>     Thomas Huth (3):
>        configure: Add the possibility to read options from meson_options.txt
>        configure: Remove options that can be handled via meson_options.txt
>          instead
>        configure: Get help text from meson_options.txt
> 
>       configure         | 429 ++++++----------------------------------------
>       meson_options.txt |   2 +-
>       2 files changed, 53 insertions(+), 378 deletions(-)
> 
> 
> It looks similar to:
> https://patchew.org/QEMU/20210107140039.467969-1-pbonzini@redhat.com/ 
> 
> Isn't it? (I haven't studied in details neither, I may be out of topic).

Oh, right, thanks for the pointer, I wasn't aware of that series yet. It's 
indeed similar to patch 8/8 from Paolo's series. But while Paolo is using an 
additional Perl-script and a json file for handling the configure options, 
my series just uses some lines of shell code in the configure script.

Paolo, why did your patch get stalled? ... my way of parsing is certainly 
way more fragile, but it's less complicated and seems to work as long as all 
the options are written in the same way in meson_options.txt (e.g. as long 
as nobody tries to use multi-line descriptions of the options there etc.)... 
so maybe if the additional Perl script was too much, this could be a good 
compromise?

  Thomas


Re: [PATCH 0/3] Use meson_options.txt in the configure script
Posted by Philippe Mathieu-Daudé 2 years, 8 months ago
On 8/30/21 7:11 AM, Thomas Huth wrote:
> On 29/08/2021 23.22, Marc-André Lureau wrote:
>> Hi Thomas
>>
>> On Sun, Aug 29, 2021 at 9:32 PM Thomas Huth <thuth@redhat.com
>> <mailto:thuth@redhat.com>> wrote:
>>
>>     It's cumbersome to maintain the build options twice, one time in the
>>     configure script and one time in meson_options.txt. Thus let's add
>> some
>>     logic to the configure script to look at the meson_options.txt file
>>     instead of handling every option twice.
>>
>>     Thomas Huth (3):
>>        configure: Add the possibility to read options from
>> meson_options.txt
>>        configure: Remove options that can be handled via
>> meson_options.txt
>>          instead
>>        configure: Get help text from meson_options.txt
>>
>>       configure         | 429
>> ++++++----------------------------------------
>>       meson_options.txt |   2 +-
>>       2 files changed, 53 insertions(+), 378 deletions(-)
>>
>>
>> It looks similar to:
>> https://patchew.org/QEMU/20210107140039.467969-1-pbonzini@redhat.com/
>> Isn't it? (I haven't studied in details neither, I may be out of topic).
> 
> Oh, right, thanks for the pointer, I wasn't aware of that series yet.
> It's indeed similar to patch 8/8 from Paolo's series. But while Paolo is
> using an additional Perl-script and a json file for handling the
> configure options, my series just uses some lines of shell code in the
> configure script.
> 
> Paolo, why did your patch get stalled? ... my way of parsing is
> certainly way more fragile, but it's less complicated and seems to work
> as long as all the options are written in the same way in
> meson_options.txt (e.g. as long as nobody tries to use multi-line
> descriptions of the options there etc.)... so maybe if the additional
> Perl script was too much, this could be a good compromise?

IIRC while Perl is perfect for parsing, the maintenance cost is too
high. The git-forge / meson switch proved next-gen contributors are
more at ease with Python. The few contributors who are fluent with
Perl are usually very busy maintainers.


Re: [PATCH 0/3] Use meson_options.txt in the configure script
Posted by Peter Maydell 2 years, 8 months ago
On Mon, 30 Aug 2021 at 10:14, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
> IIRC while Perl is perfect for parsing, the maintenance cost is too
> high. The git-forge / meson switch proved next-gen contributors are
> more at ease with Python.

That seems a bit strong to me. But I would say that for code where
most people touching it are non-language-experts who need to just
occasionally dip in to it to fix a problem, rather than spending
most of their time working on that code, Python is easier to
understand than Perl is. Plus we have more Python than Perl; so we
should probably prefer Python in new scripts for the project.

-- PMM

Re: [PATCH 0/3] Use meson_options.txt in the configure script
Posted by Paolo Bonzini 2 years, 7 months ago
Il lun 30 ago 2021, 07:11 Thomas Huth <thuth@redhat.com> ha scritto:

> Paolo, why did your patch get stalled?


It just wasn't worthwhile at the time given how few meson options were
there. I missed 6.1 and was going to send it out again for 6.2.

The reason for using Perl was because there's no guarantee of knowing the
path to the Python interpreter until after --python is parsed, so there
would be a risk of not being able to give a full help. I don't like Perl
very much, but the difference in obscurity between Perl and Eric-level sh
is small. :)

Paolo

... my way of parsing is certainly
> way more fragile, but it's less complicated and seems to work as long as
> all
> the options are written in the same way in meson_options.txt (e.g. as long
> as nobody tries to use multi-line descriptions of the options there
> etc.)...
> so maybe if the additional Perl script was too much, this could be a good
> compromise?
>
>   Thomas
>
>