[PATCH 05/32] sync_qemu_models_i386: Do not require full path to QEMU's cpu.c

Jiri Denemark posted 32 patches 2 weeks ago
There is a newer version of this series
[PATCH 05/32] sync_qemu_models_i386: Do not require full path to QEMU's cpu.c
Posted by Jiri Denemark 2 weeks ago
While the script for synchronizing CPU features expects a path to QEMU
source tree, this CPU model script insisted on getting a full patch to
cpu.c file, even though it could easily deduce it from the path to QEMU
source tree.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/cpu_map/sync_qemu_models_i386.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/cpu_map/sync_qemu_models_i386.py b/src/cpu_map/sync_qemu_models_i386.py
index f7b06a7716..13f62780e6 100755
--- a/src/cpu_map/sync_qemu_models_i386.py
+++ b/src/cpu_map/sync_qemu_models_i386.py
@@ -502,8 +502,8 @@ def main():
     parser = argparse.ArgumentParser(
         description="Synchronize x86 cpu models from QEMU i386 target.")
     parser.add_argument(
-        "cpufile",
-        help="Path to 'target/i386/cpu.c' file in the QEMU repository",
+        "qemu",
+        help="Path to QEMU source code",
         type=os.path.realpath)
     parser.add_argument(
         "outdir",
@@ -512,7 +512,12 @@ def main():
 
     args = parser.parse_args()
 
-    builtin_x86_defs = read_builtin_x86_defs(args.cpufile)
+    cpufile = os.path.join(args.qemu, 'target/i386/cpu.c')
+    if not os.path.isfile(cpufile):
+        parser.print_help()
+        exit("QEMU source directory not found")
+
+    builtin_x86_defs = read_builtin_x86_defs(cpufile)
 
     ast = lark.Lark(r"""
         list: value ( "," value )* ","?
-- 
2.47.0
Re: [PATCH 05/32] sync_qemu_models_i386: Do not require full path to QEMU's cpu.c
Posted by Daniel P. Berrangé 1 week, 6 days ago
On Tue, Nov 19, 2024 at 07:49:41PM +0100, Jiri Denemark wrote:
> While the script for synchronizing CPU features expects a path to QEMU
> source tree, this CPU model script insisted on getting a full patch to
> cpu.c file, even though it could easily deduce it from the path to QEMU
> source tree.
> 
> Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
> ---
>  src/cpu_map/sync_qemu_models_i386.py | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|