From nobody Wed Dec 4 19:20:19 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 1732042504678116.32190565795679; Tue, 19 Nov 2024 10:55:04 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 9A1F613DD; Tue, 19 Nov 2024 13:55:03 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 78820149D; Tue, 19 Nov 2024 13:50:39 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id A2D7513DC; Tue, 19 Nov 2024 13:50:29 -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 23F27137A for ; Tue, 19 Nov 2024 13:50:29 -0500 (EST) Received: from mx-prod-mc-04.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-630-QzrOu1guMFyKBmRUY3P89g-1; Tue, 19 Nov 2024 13:50:27 -0500 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (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-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DDBD419560B4 for ; Tue, 19 Nov 2024 18:50:26 +0000 (UTC) Received: from orkuz (unknown [10.45.226.13]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 603CA1956054 for ; Tue, 19 Nov 2024 18:50:26 +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=1732042228; 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=KGSHCr+Oiq1wsSqlr/utE91bO7WvN/smrj+j4W6saQQ=; b=i5a3g5SpF1hTUuxCX3aWhiHg3GQNc01iw68B7j2yw9SnobRoR0MNX393bJcbQcHXCQE3ge TMt7JWAyXYf5NY1pH5Bu7C44OEKXdBp/3WM+3UgVqD/BuSV4wgR4eiBnMWZNB0yUK9B4xN G1ywpx4+RnoTckQZxdaUNLevH8709e4= X-MC-Unique: QzrOu1guMFyKBmRUY3P89g-1 X-Mimecast-MFC-AGG-ID: QzrOu1guMFyKBmRUY3P89g From: Jiri Denemark To: devel@lists.libvirt.org Subject: [PATCH 07/32] sync_qemu_models_i386: Store extra info in a separate file Date: Tue, 19 Nov 2024 19:49:43 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: P8zT0R6vPOcV3gHa075Jt2nw4blgRe5q7Ic1cd_pR_Y_1732042227 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 2U5L2DBS427F2LYBP26CPTM4R3EC3SA7 X-Message-ID-Hash: 2U5L2DBS427F2LYBP26CPTM4R3EC3SA7 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: 1732042506074116600 Content-Type: text/plain; charset="utf-8" We don't really need or want the extra info to be included in the CPU model definitions in git, it's mostly useful for verifying the output of the script. Let's store it in a separate file rather than in a comment block of the CPU model definition itself. Signed-off-by: Jiri Denemark --- src/cpu_map/sync_qemu_models_i386.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/cpu_map/sync_qemu_models_i386.py b/src/cpu_map/sync_qemu_m= odels_i386.py index f75d649fe0..b2ed890589 100755 --- a/src/cpu_map/sync_qemu_models_i386.py +++ b/src/cpu_map/sync_qemu_models_i386.py @@ -507,12 +507,13 @@ def expand_model(model): yield result =20 =20 -def output_model(f, model): +def output_model(f, extra, model): if model["extra"]: - f.write("\n") + with open(extra, "wt") as ex: + ex.write("# THIS FILE SHOULD NEVER BE ADDED TO A COMMIT\n") + ex.write("extra info from qemu:\n") + for k, v in model["extra"].items(): + ex.write(f" {k}: {v}\n") =20 alias =3D "alias" in model decode =3D "off" if alias else "on" @@ -574,13 +575,15 @@ def main(): models.extend(expand_model(model)) =20 for model in models: - name =3D os.path.join(args.outdir, f"x86_{model['name']}.xml") + base =3D os.path.join(args.outdir, f"x86_{model['name']}") + name =3D f"{base}.xml" + if os.path.isfile(name): # Ignore existing models as CPU models in libvirt should never # change once released. continue with open(name, "wt") as f: - output_model(f, model) + output_model(f, f"{base}.extra", model) =20 features =3D set() for model in models: --=20 2.47.0