From 31f446cf37477267d450729558c764d730e357de Mon Sep 17 00:00:00 2001 From: Alexandre Derumier Date: Sat, 20 May 2023 08:37:01 +0200 Subject: [PATCH] cpu_map : sync_qemu_models : fix versionned models Currently, a new versionned model is only generated when an alias exist in the version. This is wrong, because not all versions have an alias, so some models are not generated, and last version is override the main model. (with newer flags not present in the original model) This patch create an "-v.xml" for each versionned model, and keep the extra ".xml" --- src/cpu_map/sync_qemu_models_i386.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/cpu_map/sync_qemu_models_i386.py b/src/cpu_map/sync_qemu_models_i386.py index 37bbe6d09e..79b1df98ef 100755 --- a/src/cpu_map/sync_qemu_models_i386.py +++ b/src/cpu_map/sync_qemu_models_i386.py @@ -304,9 +304,10 @@ def expand_model(model): """Expand a qemu cpu model description that has its feature split up into different fields and may have differing versions into several libvirt- friendly cpu models.""" + name = model.pop(".name") result = { - "name": model.pop(".name"), + "name": name, "vendor": translate_vendor(model.pop(".vendor")), "features": set(), "extra": dict()} @@ -329,7 +330,8 @@ def expand_model(model): for version in versions: result = copy.deepcopy(result) - result["name"] = version.pop(".alias", result["name"]) + version_num = version.pop(".version", '1') + result["name"] = name + "-v" + version_num props = version.pop(".props", dict()) for k, v in props: @@ -350,6 +352,11 @@ def expand_model(model): yield result + alias = version.pop(".alias", None) + if alias: + result = copy.deepcopy(result) + result["name"] = alias + yield result def output_model(f, model): if model["extra"]: