From: Jiri Denemark Date: Thu, 6 Nov 2025 09:55:10 +0000 (+0100) Subject: sync_qemu_models_i386: Support adding models to an empty group X-Git-Tag: CVE-2025-12748~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=21c61bee365ec3e9e7de602777ec0ef7e1bbd3ec;p=thirdparty%2Flibvirt.git sync_qemu_models_i386: Support adding models to an empty group When adding a new CPU vendor, we create a new empty group in src/cpu_map/index.xml and want to use the sync_qemu_models_i386.py script to add models there. Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- diff --git a/src/cpu_map/sync_qemu_models_i386.py b/src/cpu_map/sync_qemu_models_i386.py index 7ae329cb99..0f43d9e14a 100755 --- a/src/cpu_map/sync_qemu_models_i386.py +++ b/src/cpu_map/sync_qemu_models_i386.py @@ -592,10 +592,16 @@ def update_index(outdir, models): continue group = groups[-1] - last = group.getchildren()[-1] - group_indent = last.tail - indent = f"{group_indent} " - last.tail = indent + children = group.getchildren() + if children: + last = children()[-1] + group_indent = last.tail + indent = f"{group_indent} " + last.tail = indent + else: + group_indent = f"{group.tail} " + indent = f"{group_indent} " + group.text = f"{group_indent} " for file in files: include = lxml.etree.SubElement(group, "include", filename=file)