[PATCH 07/32] sync_qemu_models_i386: Store extra info in a separate file

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

 



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@xxxxxxxxxx>
---
 src/cpu_map/sync_qemu_models_i386.py | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/cpu_map/sync_qemu_models_i386.py b/src/cpu_map/sync_qemu_models_i386.py
index f75d649fe0..b2ed890589 100755
--- a/src/cpu_map/sync_qemu_models_i386.py
+++ b/src/cpu_map/sync_qemu_models_i386.py
@@ -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")
 
     alias = "alias" in model
     decode = "off" if alias else "on"
@@ -574,13 +575,15 @@ def main():
         models.extend(expand_model(model))
 
     for model in models:
-        name = os.path.join(args.outdir, f"x86_{model['name']}.xml")
+        base = os.path.join(args.outdir, f"x86_{model['name']}")
+        name = f"{base}.xml"
+
         if os.path.isfile(name):
             # Ignore existing models as CPU models in libvirt should never
             # change once released.
             continue
         with open(name, "wt") as f:
-            output_model(f, model)
+            output_model(f, f"{base}.extra", model)
 
     features = set()
     for model in models:
-- 
2.47.0




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux