From nobody Tue Feb 10 04:13:26 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1619076772; cv=none; d=zohomail.com; s=zohoarc; b=Ig0/sSMo7K9O1ClKjubjItZzOWXqbZLdvR/Q1YglYKIoEU9Yq5okTOQj8OKFwOBW8UDY/5rdHUF2MqTLb8QAlxcxs1ABuGkYRy+2W6De7X+IC4T0upfx4OotdVt5etEU1dhSi8O4PIWZCelfoIBRT/DcoDCwk595E+AmZaiCF9k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619076772; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=a0nDPzjtCTDcOCZkQK9mye7jMYXmI+dcVRPVjez0lGQ=; b=BK30MkZNQe/9PGXJG8oD1xklVDML1ieGB0eV/jxIMwgUdgVMiv8mzwbLOt1a5PEbhCeDBlY4Jbr6Y/QbSmjDmkDF64STpcBPNY7tuDN+L9KkAys5kjyrehphHYLWSU4acNy5lq0pMxYmnZUqnpqRxNR0a33FIA58BSx8lZ3G8Ow= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 16190767722303.361126954419092; Thu, 22 Apr 2021 00:32:52 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-417-7kzDwHg1O4qDpXlrc53b7Q-1; Thu, 22 Apr 2021 03:32:49 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 59BB9343B8; Thu, 22 Apr 2021 07:32:43 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 37F5E62954; Thu, 22 Apr 2021 07:32:43 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id F224B1806D2F; Thu, 22 Apr 2021 07:32:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13M7WWg2024027 for ; Thu, 22 Apr 2021 03:32:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6B28C20FE6D4; Thu, 22 Apr 2021 07:32:32 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6566D20FE6D1 for ; Thu, 22 Apr 2021 07:32:29 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C016F81DB8A for ; Thu, 22 Apr 2021 07:32:29 +0000 (UTC) Received: from m97136.mail.qiye.163.com (m97136.mail.qiye.163.com [220.181.97.136]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-306-D4OrS88VO8GpU3fYQhMYPg-1; Thu, 22 Apr 2021 03:32:16 -0400 Received: from localhost.localdomain (unknown [58.56.27.130]) by smtp2 (Coremail) with SMTP id iOCowAA3HLYJJYFgMwTJAQ--.5876S5; Thu, 22 Apr 2021 15:26:04 +0800 (CST) X-MC-Unique: 7kzDwHg1O4qDpXlrc53b7Q-1 X-MC-Unique: D4OrS88VO8GpU3fYQhMYPg-1 From: Shi Lei To: libvir-list@redhat.com Subject: [RFCv3 03/25] maint: Call xmlgen automatically when c-head-files change Date: Thu, 22 Apr 2021 15:25:11 +0800 Message-Id: <20210422072533.312211-4-shi_lei@massclouds.com> In-Reply-To: <20210422072533.312211-1-shi_lei@massclouds.com> References: <20210422072533.312211-1-shi_lei@massclouds.com> MIME-Version: 1.0 X-CM-TRANSID: iOCowAA3HLYJJYFgMwTJAQ--.5876S5 X-Coremail-Antispam: 1Uf129KBjvJXoWxWry7KFWfuF4ruF17JrWxtFb_yoW7JrW7pa n0qa15tFyUXr1fArs3JF18tF4rGw1kG3WDKwsxWw13Zw4UXr1I9w43KFyfKr47W3y8ZF4F vrn5G34rKF48JFJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0JbMD7hUUUUU= X-Originating-IP: [58.56.27.130] X-CM-SenderInfo: pvklsz1hl6ztxvvfz0xxgvhudrp/1tbibgx8T1lZu9Z7AQAAsG X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Shi Lei X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Monitor changes of header-files in src/util and src/conf. Whenever that happens, the tool xmlgen will generate parse/format functions based on these files automatically. Signed-off-by: Shi Lei --- scripts/meson.build | 8 ++++++++ src/conf/meson.build | 36 ++++++++++++++++++++++++++++++++++++ src/meson.build | 6 ++++++ src/util/meson.build | 36 ++++++++++++++++++++++++++++++++++++ tests/meson.build | 2 ++ tools/meson.build | 3 +++ 6 files changed, 91 insertions(+) diff --git a/scripts/meson.build b/scripts/meson.build index 421e3d2a..5399868c 100644 --- a/scripts/meson.build +++ b/scripts/meson.build @@ -35,3 +35,11 @@ foreach name : scripts sname =3D name.split('.')[0].underscorify() set_variable('@0@_prog'.format(sname), find_program(name)) endforeach + +xmlgen_self =3D files( + 'xmlgen/main.py', + 'xmlgen/directive.py', + 'xmlgen/utils.py' +) + +set_variable('virxmlgen_prog', find_program('xmlgen/main.py')) diff --git a/src/conf/meson.build b/src/conf/meson.build index bd35d87e..1439c31d 100644 --- a/src/conf/meson.build +++ b/src/conf/meson.build @@ -1,3 +1,38 @@ +conf_xmlgen_input =3D [ +] + +conf_xmlgen_output =3D [] +foreach name : conf_xmlgen_input + conf_xmlgen_output +=3D '@0@.generated.c'.format(name.split('.')[0]) + conf_xmlgen_output +=3D '@0@.generated.h'.format(name.split('.')[0]) +endforeach + +conf_xmlgen_headers =3D [] +if conf_xmlgen_output.length() > 0 + conf_xmlgen_objects =3D custom_target( + 'virxmlgen', + input: xmlgen_self + conf_xmlgen_input, + output: conf_xmlgen_output, + command: [ + meson_python_prog, python3_prog.path(), '-B', virxmlgen_prog.path(), + '-s', meson.source_root() / 'src', '-b', meson.build_root() / 'src', + '-d', 'conf', 'generate', + ], + ) + + index =3D 0 + foreach header : conf_xmlgen_objects.to_list() + if index % 2 =3D=3D 1 + conf_xmlgen_headers +=3D header + endif + index +=3D 1 + endforeach +else + conf_xmlgen_objects =3D [] +endif + +conf_xmlgen_dep =3D declare_dependency(sources: conf_xmlgen_headers) + netdev_conf_sources =3D [ 'netdev_bandwidth_conf.c', 'netdev_vlan_conf.c', @@ -90,6 +125,7 @@ device_conf_sources =3D [ virt_conf_lib =3D static_library( 'virt_conf', [ + conf_xmlgen_objects, chrdev_conf_sources, cpu_conf_sources, device_conf_sources, diff --git a/src/meson.build b/src/meson.build index c7ff9e97..f8ae47b4 100644 --- a/src/meson.build +++ b/src/meson.build @@ -245,6 +245,12 @@ src_dep =3D declare_dependency( ) =20 subdir('conf') + +src_dep =3D declare_dependency( + dependencies: [ src_dep, util_xmlgen_dep, conf_xmlgen_dep ], + include_directories: [ conf_inc_dir ], +) + subdir('rpc') subdir('access') subdir('cpu') diff --git a/src/util/meson.build b/src/util/meson.build index 05934f68..0d41de92 100644 --- a/src/util/meson.build +++ b/src/util/meson.build @@ -1,3 +1,38 @@ +util_xmlgen_input =3D [ +] + +util_xmlgen_output =3D [] +foreach name : util_xmlgen_input + util_xmlgen_output +=3D '@0@.generated.c'.format(name.split('.')[0]) + util_xmlgen_output +=3D '@0@.generated.h'.format(name.split('.')[0]) +endforeach + +util_xmlgen_headers =3D [] +if util_xmlgen_output.length() > 0 + util_xmlgen_objects =3D custom_target( + 'virxmlgen', + input: xmlgen_self + util_xmlgen_input, + output: util_xmlgen_output, + command: [ + meson_python_prog, python3_prog.path(), '-B', virxmlgen_prog.path(), + '-s', meson.source_root() / 'src', '-b', meson.build_root() / 'src', + '-d', 'util', 'generate', + ], + ) + + index =3D 0 + foreach header : util_xmlgen_objects.to_list() + if index % 2 =3D=3D 1 + util_xmlgen_headers +=3D header + endif + index +=3D 1 + endforeach +else + util_xmlgen_objects =3D [] +endif + +util_xmlgen_dep =3D declare_dependency(sources: util_xmlgen_headers) + util_sources =3D [ 'glibcompat.c', 'viralloc.c', @@ -179,6 +214,7 @@ io_helper_sources =3D [ virt_util_lib =3D static_library( 'virt_util', [ + util_xmlgen_objects, util_sources, util_public_sources, keycode_gen_sources, diff --git a/tests/meson.build b/tests/meson.build index 05c3e901..14ace476 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -17,6 +17,8 @@ tests_dep =3D declare_dependency( selinux_dep, xdr_dep, yajl_dep, + util_xmlgen_dep, + conf_xmlgen_dep, ], include_directories: [ conf_inc_dir, diff --git a/tools/meson.build b/tools/meson.build index 2acf7b0a..162db0e8 100644 --- a/tools/meson.build +++ b/tools/meson.build @@ -5,11 +5,14 @@ tools_dep =3D declare_dependency( dependencies: [ libxml_dep, glib_dep, + util_xmlgen_dep, + conf_xmlgen_dep, ], include_directories: [ libvirt_inc, src_inc_dir, util_inc_dir, + conf_inc_dir, top_inc_dir, ], link_args: ( --=20 2.25.1