]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
sync_qemu_models_i386: Store extra info in a separate file
authorJiri Denemark <jdenemar@redhat.com>
Tue, 12 Nov 2024 10:24:23 +0000 (11:24 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 26 Nov 2024 12:04:34 +0000 (13:04 +0100)
We don't really need or want the extra info to be included in the CPU
model definitions in git, it's mostly useful for verifying the output of
the script. Let's store it in a separate file rather than in a comment
block of the CPU model definition itself.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/cpu_map/sync_qemu_models_i386.py

index 5169d50b08603b1b1bcc435fed5416c9c11d3d80..58600bffe5e5166959b9a7e41108402bc3e01f6e 100755 (executable)
@@ -507,12 +507,13 @@ def expand_model(model):
             yield result
 
 
-def output_model(f, model):
+def output_model(f, extra, model):
     if model["extra"]:
-        f.write("<!-- extra info from qemu:\n")
-        for k, v in model["extra"].items():
-            f.write(f"  '{k}': '{v}'\n")
-        f.write("-->\n")
+        with open(extra, "wt") as ex:
+            ex.write("# THIS FILE SHOULD NEVER BE ADDED TO A COMMIT\n")
+            ex.write("extra info from qemu:\n")
+            for k, v in model["extra"].items():
+                ex.write(f"  {k}: {v}\n")
 
     decode = "off" if "base" in model else "on"
 
@@ -573,13 +574,17 @@ def main():
         models.extend(expand_model(model))
 
     for model in models:
-        name = os.path.join(args.outdir, f"x86_{model['name']}.xml")
-        if os.path.isfile(name):
+        name = f"x86_{model['name']}.xml"
+        path = os.path.join(args.outdir, name)
+
+        if os.path.isfile(path):
             # Ignore existing models as CPU models in libvirt should never
             # change once released.
             continue
-        with open(name, "wt") as f:
-            output_model(f, model)
+
+        extra = os.path.join(args.outdir, f"x86_{model['name']}.extra")
+        with open(path, "wt") as f:
+            output_model(f, extra, model)
 
     features = set()
     for model in models: