From nobody Thu Dec 5 01:49:26 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 1732311578743351.5391789666944; Fri, 22 Nov 2024 13:39:38 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 0965E13D0; Fri, 22 Nov 2024 16:39:37 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id BCF831705; Fri, 22 Nov 2024 16:34:29 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id D3CE81623; Fri, 22 Nov 2024 16:34:20 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 9E08E15B5 for ; Fri, 22 Nov 2024 16:33:45 -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-346-Nj_CZtKPNdeuU5TpKkDalg-1; Fri, 22 Nov 2024 16:33:44 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 2992A1954AF9 for ; Fri, 22 Nov 2024 21:33:43 +0000 (UTC) Received: from orkuz (unknown [10.45.224.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9751A3003CCA for ; Fri, 22 Nov 2024 21:33:42 +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_H3,RCVD_IN_MSPIKE_WL,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=1732311225; 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=zdAUNDBhwPXMu283MPPL7y7oOZKCht/z1t++bChhnmQ=; b=dyowZTPWTt54jEp6TJSVQ43ZtsAFwa9VD7Hvh1yfEOzjhbSgkKCYwUpBjm9RF9kEKuVKOk BIe3D7kq4a/bMm3LuevzvJGRVVjpDGyKWC7Kf00SYdZCHqTMA8w0/bE2Flk2oTB6M8AHyl MkJPUKYtzgZC+OzOIHLu3cMksCpogto= X-MC-Unique: Nj_CZtKPNdeuU5TpKkDalg-1 X-Mimecast-MFC-AGG-ID: Nj_CZtKPNdeuU5TpKkDalg From: Jiri Denemark To: devel@lists.libvirt.org Subject: [PATCH v2 11/36] sync_qemu_models_i386: Update index.xml Date: Fri, 22 Nov 2024 22:32:51 +0100 Message-ID: <031ed4e84a1c531f337bcea70751d54ce47f6981.1732311125.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: AbFqhy-J0OoDEr9jTvjFcGjrGajcniupoPa58LDo5FA_1732311223 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: RELS6RLIGJ4CLYVTT2TBUZHZWCNBMPSM X-Message-ID-Hash: RELS6RLIGJ4CLYVTT2TBUZHZWCNBMPSM 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: 1732311580625116600 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 Reviewed-by: Daniel P. Berrang=C3=A9 --- Notes: Version 2: - use instead of src/cpu_map/sync_qemu_models_i386.py | 39 ++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/cpu_map/sync_qemu_models_i386.py b/src/cpu_map/sync_qemu_m= odels_i386.py index ce3c39de96..024bc92f07 100755 --- a/src/cpu_map/sync_qemu_models_i386.py +++ b/src/cpu_map/sync_qemu_models_i386.py @@ -533,6 +533,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[@name=3D'{vendo= r} CPU models']") + 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.") @@ -573,6 +602,8 @@ def main(): for model in models_json: models.extend(expand_model(model)) =20 + files =3D dict() + for model in models: name =3D f"x86_{model['name']}.xml" path =3D os.path.join(args.outdir, name) @@ -582,10 +613,18 @@ def main(): # change once released. continue =20 + vendor =3D model['vendor'] + if vendor: + if vendor not in files: + files[vendor] =3D [] + files[vendor].append(name) + extra =3D os.path.join(args.outdir, f"x86_{model['name']}.extra") with open(path, "wt") as f: output_model(f, extra, model) =20 + update_index(args.outdir, files) + features =3D set() for model in models: features.update(model["features"]) --=20 2.47.0