sync_qemu_models_i386: Store extra info in a separate file

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>
This commit is contained in:
Jiri Denemark 2024-11-12 11:24:23 +01:00
parent db127963d5
commit 19cfe21d4e

View File

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