[libvirt PATCHv2 06/15] meson: switch checks to depend on json-c as well as yajl

Ján Tomko posted 15 patches 1 year, 5 months ago
[libvirt PATCHv2 06/15] meson: switch checks to depend on json-c as well as yajl
Posted by Ján Tomko 1 year, 5 months ago
Ensure both are required during this series to make bisecting smooth.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
---
 libvirt.spec.in   |  3 ++-
 meson.build       | 12 ++++++------
 meson_options.txt |  6 +++---
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/libvirt.spec.in b/libvirt.spec.in
index 2bc4aa98d4..63ac63cb45 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -362,6 +362,7 @@ BuildRequires: augeas
 BuildRequires: systemd-devel >= 185
 BuildRequires: libpciaccess-devel >= 0.10.9
 BuildRequires: yajl-devel
+BuildRequires: json-c-devel
     %if %{with_sanlock}
 BuildRequires: sanlock-devel >= 2.4
     %endif
@@ -1369,8 +1370,8 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec)
            -Dapparmor_profiles=disabled \
            -Dsecdriver_apparmor=disabled \
            -Dudev=enabled \
-           -Djson_c=disabled \
            -Dyajl=enabled \
+           -Djson_c=enabled \
            %{?arg_sanlock} \
            -Dlibpcap=enabled \
            %{?arg_nbdkit} \
diff --git a/meson.build b/meson.build
index 855df79e62..e15514ea00 100644
--- a/meson.build
+++ b/meson.build
@@ -1622,10 +1622,10 @@ if not get_option('driver_ch').disabled() and host_machine.system() == 'linux' a
     endif
   endif
 
-  if not yajl_dep.found()
+  if not yajl_dep.found() or not json_c_dep.found()
     use_ch = false
     if get_option('driver_ch').enabled()
-      error('YAJL 2 is required to build Cloud-Hypervisor driver')
+      error('json-c is required to build Cloud-Hypervisor driver')
     endif
   endif
 
@@ -1696,10 +1696,10 @@ endif
 if not get_option('driver_qemu').disabled()
   use_qemu = true
 
-  if not yajl_dep.found()
+  if not yajl_dep.found() or not json_c_dep.found()
     use_qemu = false
     if get_option('driver_qemu').enabled()
-      error('YAJL 2 is required to build QEMU driver')
+      error('json-c is required to build QEMU driver')
     endif
   endif
 
@@ -2029,9 +2029,9 @@ endif
 
 if not get_option('nss').disabled()
   use_nss = true
-  if not yajl_dep.found()
+  if not yajl_dep.found() or not json_c_dep.found()
     if get_option('nss').enabled()
-      error('Can\'t build nss plugin without yajl')
+      error('Can\'t build nss plugin without json-c')
     else
       use_nss = false
     endif
diff --git a/meson_options.txt b/meson_options.txt
index 9b1610fcfe..122cda0350 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -68,14 +68,14 @@ option('driver_libvirtd', type: 'feature', value: 'auto', description: 'libvirtd
 option('driver_libxl', type: 'feature', value: 'auto', description: 'libxenlight driver')
 # dep:driver_remote dep:driver_libvirtd
 option('driver_lxc', type: 'feature', value: 'auto', description: 'Linux Container driver')
-# dep:curl dep:yajl dep:driver_remote dep:driver_libvirtd
+# dep:curl dep:json_c dep:driver_remote dep:driver_libvirtd
 option('driver_ch', type: 'feature', value: 'auto', description: 'Cloud-Hypervisor driver')
 option('ch_user', type: 'string', value: '', description: 'username to run Cloud-Hypervisor system instance as')
 option('ch_group', type: 'string', value: '', description: 'groupname to run Cloud-Hypervisor system instance as')
 # dep:driver_remote dep:driver_libvirtd
 option('driver_network', type: 'feature', value: 'auto', description: 'virtual network driver')
 option('driver_openvz', type: 'feature', value: 'auto', description: 'OpenVZ driver')
-# dep:yajl dep:driver_remote dep:driver_libvirtd
+# dep:json_c dep:driver_remote dep:driver_libvirtd
 option('driver_qemu', type: 'feature', value: 'auto', description: 'QEMU/KVM driver')
 option('qemu_user', type: 'string', value: '', description: 'username to run QEMU system instance as')
 option('qemu_group', type: 'string', value: '', description: 'groupname to run QEMU system instance as')
@@ -123,7 +123,7 @@ option('host_validate', type: 'feature', value: 'auto', description: 'build virt
 option('init_script', type: 'combo', choices: ['systemd', 'openrc', 'check', 'none'], value: 'check', description: 'Style of init script to install')
 option('loader_nvram', type: 'string', value: '', description: 'Pass list of pairs of <loader>:<nvram> paths. Both pairs and list items are separated by a colon.')
 option('login_shell', type: 'feature', value: 'auto', description: 'build virt-login-shell')
-# dep:yajl dep:driver_network dep:libvirtd
+# dep:json_c dep:driver_network dep:libvirtd
 option('nss', type: 'feature', value: 'auto', description: 'enable Name Service Switch plugin for resolving guest IP addresses')
 # dep:numactl
 option('numad', type: 'feature', value: 'auto', description: 'use numad to manage CPU placement dynamically')
-- 
2.46.0
Re: [libvirt PATCHv2 06/15] meson: switch checks to depend on json-c as well as yajl
Posted by Peter Krempa 1 year, 5 months ago
On Thu, Sep 05, 2024 at 15:49:33 +0200, Ján Tomko wrote:
> Ensure both are required during this series to make bisecting smooth.
> 
> Signed-off-by: Ján Tomko <jtomko@redhat.com>
> ---
>  libvirt.spec.in   |  3 ++-
>  meson.build       | 12 ++++++------
>  meson_options.txt |  6 +++---
>  3 files changed, 11 insertions(+), 10 deletions(-)
> 
> diff --git a/libvirt.spec.in b/libvirt.spec.in
> index 2bc4aa98d4..63ac63cb45 100644
> --- a/libvirt.spec.in
> +++ b/libvirt.spec.in
> @@ -362,6 +362,7 @@ BuildRequires: augeas
>  BuildRequires: systemd-devel >= 185
>  BuildRequires: libpciaccess-devel >= 0.10.9
>  BuildRequires: yajl-devel
> +BuildRequires: json-c-devel
>      %if %{with_sanlock}
>  BuildRequires: sanlock-devel >= 2.4
>      %endif
> @@ -1369,8 +1370,8 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec)
>             -Dapparmor_profiles=disabled \
>             -Dsecdriver_apparmor=disabled \
>             -Dudev=enabled \
> -           -Djson_c=disabled \
>             -Dyajl=enabled \
> +           -Djson_c=enabled \
>             %{?arg_sanlock} \
>             -Dlibpcap=enabled \
>             %{?arg_nbdkit} \
> diff --git a/meson.build b/meson.build
> index 855df79e62..e15514ea00 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1622,10 +1622,10 @@ if not get_option('driver_ch').disabled() and host_machine.system() == 'linux' a
>      endif
>    endif
>  
> -  if not yajl_dep.found()
> +  if not yajl_dep.found() or not json_c_dep.found()
>      use_ch = false
>      if get_option('driver_ch').enabled()
> -      error('YAJL 2 is required to build Cloud-Hypervisor driver')
> +      error('json-c is required to build Cloud-Hypervisor driver')
>      endif
>    endif
>  
> @@ -1696,10 +1696,10 @@ endif
>  if not get_option('driver_qemu').disabled()
>    use_qemu = true
>  
> -  if not yajl_dep.found()
> +  if not yajl_dep.found() or not json_c_dep.found()
>      use_qemu = false
>      if get_option('driver_qemu').enabled()
> -      error('YAJL 2 is required to build QEMU driver')
> +      error('json-c is required to build QEMU driver')
>      endif
>    endif
>  
> @@ -2029,9 +2029,9 @@ endif
>  
>  if not get_option('nss').disabled()
>    use_nss = true
> -  if not yajl_dep.found()
> +  if not yajl_dep.found() or not json_c_dep.found()
>      if get_option('nss').enabled()
> -      error('Can\'t build nss plugin without yajl')
> +      error('Can\'t build nss plugin without json-c')
>      else
>        use_nss = false
>      endif

I'd prefer if the error messages spell out both libraries in the interim
with wording saying that you need both.

It could trip up somebody in the future bisecting into the past without
having yajl installed.

Since you'll be fixing the checks later on I thing the overhead of
changing the comments should be okay.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>