From nobody Wed Dec 4 18:46:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1732042605025799.8408450767328; Tue, 19 Nov 2024 10:56:45 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id EEBBA163E; Tue, 19 Nov 2024 13:56:43 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 3ACDE150F; Tue, 19 Nov 2024 13:51:17 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id A2A8E1500; Tue, 19 Nov 2024 13:51:12 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 2108C1486 for ; Tue, 19 Nov 2024 13:50:37 -0500 (EST) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-563-6QBxH4tXM-mWyJu4Hw0Oqg-1; Tue, 19 Nov 2024 13:50:34 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 453F11956095 for ; Tue, 19 Nov 2024 18:50:33 +0000 (UTC) Received: from orkuz (unknown [10.45.226.13]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BD3DE19560A3 for ; Tue, 19 Nov 2024 18:50:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732042236; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=B7Bbb1Zs7vjxqm/tXQYAVAzjoxjFehLy9o+kGh5jvC0=; b=KmPunmFxlVT9f6PNpSTeDi5QI4abZD9pf+HEfVkHMXioyNNVVc6nxLxWyfGaFHgSexMPa+ 7eUm8zSJPh1v9FGF+IKMui4jBEygfRMgxyALwn+nWnxNq29uFU01sR3qlZf0iK225dPhMh vyJIgr43RiwywzFjM1mmR7WVk81S0P4= X-MC-Unique: 6QBxH4tXM-mWyJu4Hw0Oqg-1 X-Mimecast-MFC-AGG-ID: 6QBxH4tXM-mWyJu4Hw0Oqg From: Jiri Denemark To: devel@lists.libvirt.org Subject: [PATCH 10/32] sync_qemu_models_i386: Update index.xml Date: Tue, 19 Nov 2024 19:49:46 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: MCtWGZagp9n1WSU0HMKNWMIoOEk2QwJQcLJRT1U1-iM_1732042233 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 4MRZJJ73MEL5T3M4P3UMX6KSHZTLMNPL X-Message-ID-Hash: 4MRZJJ73MEL5T3M4P3UMX6KSHZTLMNPL X-MailFrom: jdenemar@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1732042606385116600 Content-Type: text/plain; charset="utf-8" Add all newly generated CPU models to the appropriate section of index.xml. Signed-off-by: Jiri Denemark --- 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_m= odels_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("\n") =20 =20 +def update_index(outdir, models): + index =3D os.path.join(outdir, "index.xml") + xml =3D lxml.etree.parse(index) + + for vendor, files in models.items(): + groups =3D xml.xpath(f"//arch[@name=3D'x86']/group[@vendor=3D'{ven= dor}']") + if not groups: + continue + + group =3D groups[-1] + last =3D group.getchildren()[-1] + group_indent =3D last.tail + indent =3D f"{group_indent} " + last.tail =3D indent + + for file in files: + include =3D lxml.etree.SubElement(group, "include", filename= =3Dfile) + include.tail =3D indent + + group.getchildren()[-1].tail =3D group_indent + + out =3D lxml.etree.tostring(xml, encoding=3D"UTF-8") + out =3D out.decode("UTF-8").replace('"', "'") + + with open(index, "w") as f: + f.write(out) + f.write("\n") + + def main(): parser =3D argparse.ArgumentParser( description=3D"Synchronize x86 cpu models from QEMU i386 target.") @@ -574,6 +603,8 @@ def main(): for model in models_json: models.extend(expand_model(model)) =20 + files =3D dict() + for model in models: base =3D os.path.join(args.outdir, f"x86_{model['name']}") name =3D f"{base}.xml" @@ -582,9 +613,18 @@ def main(): # Ignore existing models as CPU models in libvirt should never # change once released. continue + + vendor =3D model['vendor'] + if vendor: + if vendor not in files: + files[vendor] =3D [] + files[vendor].append(name) + with open(name, "wt") as f: output_model(f, f"{base}.extra", model) =20 + update_index(args.outdir, files) + features =3D set() for model in models: features.update(model["features"]) --=20 2.47.0