qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 24/24] configure: automatically parse command line for mes


From: Paolo Bonzini
Subject: Re: [PATCH v2 24/24] configure: automatically parse command line for meson -D options
Date: Wed, 13 Oct 2021 13:11:14 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0

On 13/10/21 09:43, Paolo Bonzini wrote:
On 12/10/21 20:15, Thomas Huth wrote:

Old output with --help:

  --enable-trace-backend=B Set trace backend
                            Available backends: nop, dtrace, ftrace, simple, stderr, ust

New output:

   --enable-trace-backends=CHOICE
                            Set available tracing backends [log]

Why does it fail to list the choices here? ... it works for the other
options like "--enable-malloc"?

Oh, that's a pity: array options don't include the choices in their introspection data.  I'll fix it up ad hoc and submit a patch to Meson.

---------------- 8< ----------------
From: Paolo Bonzini <pbonzini@redhat.com>
Subject: [PATCH] meson-buildoptions: restore list of tracing backends

Manually patch the introspection data to include the tracing backends.

This works around a deficiency in Meson that will be fixed by
https://github.com/mesonbuild/meson/pull/9395.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 scripts/meson-buildoptions.py | 18 +++++++++++++++++-
 scripts/meson-buildoptions.sh |  3 ++-
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/scripts/meson-buildoptions.py b/scripts/meson-buildoptions.py
index 54b591d8a4..256523c09d 100755
--- a/scripts/meson-buildoptions.py
+++ b/scripts/meson-buildoptions.py
@@ -66,7 +66,7 @@ def sh_print(line=""):
def help_line(left, opt, indent, long):
-    right = f"{opt['description']}"
+    right = f'{opt["description"]}'
     if long:
         value = value_to_help(opt["value"])
         if value != "auto":
@@ -150,7 +150,23 @@ def print_parse(options):
     print("}")
+def fixup_options(options):
+    # Meson <= 0.60 does not include the choices in array options, fix that up
+    for opt in options:
+        if opt["name"] == "trace_backends":
+            opt["choices"] = [
+                "dtrace",
+                "ftrace",
+                "log",
+                "nop",
+                "simple",
+                "syslog",
+                "ust",
+            ]
+
+
 options = load_options(json.load(sys.stdin))
+fixup_options(options)
 print("# This file is generated by meson-buildoptions.py, do not edit!")
 print_help(options)
 print_parse(options)
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index 12188c2530..c795a13020 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -16,7 +16,8 @@ meson_options_help() {
   printf "%s\n" '  --enable-tcg-interpreter TCG with bytecode interpreter 
(experimental and'
   printf "%s\n" '                           slow)'
   printf "%s\n" '  --enable-trace-backends=CHOICE'
-  printf "%s\n" '                           Set available tracing backends 
[log]'
+  printf "%s\n" '                           Set available tracing backends 
[log] (choices:'
+  printf "%s\n" '                           
dtrace/ftrace/log/nop/simple/syslog/ust)'
   printf "%s\n" ''
   printf "%s\n" 'Optional features, enabled with --enable-FEATURE and'
   printf "%s\n" 'disabled with --disable-FEATURE, default is enabled if 
available'
--
2.31.1






reply via email to

[Prev in Thread] Current Thread [Next in Thread]