
On Tue, Nov 19, 2024 at 07:49:46PM +0100, Jiri Denemark wrote:
Add all newly generated CPU models to the appropriate section of index.xml.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu_map/sync_qemu_models_i386.py | 40 ++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
diff --git a/src/cpu_map/sync_qemu_models_i386.py b/src/cpu_map/sync_qemu_models_i386.py index 75d86144d0..40d71e66be 100755 --- a/src/cpu_map/sync_qemu_models_i386.py +++ b/src/cpu_map/sync_qemu_models_i386.py @@ -534,6 +534,35 @@ def output_model(f, extra, model): f.write("</cpus>\n")
+def update_index(outdir, models): + index = os.path.join(outdir, "index.xml") + xml = lxml.etree.parse(index) + + for vendor, files in models.items(): + groups = xml.xpath(f"//arch[@name='x86']/group[@vendor='{vendor}']") + if not groups: + continue + + group = groups[-1] + last = group.getchildren()[-1] + group_indent = last.tail + indent = f"{group_indent} " + last.tail = indent + + for file in files: + include = lxml.etree.SubElement(group, "include", filename=file)
I'm presuming this is the bit that it adding fully qualified paths to the index.xml. 'file' needs stripping to its bare name. With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|