rpm: disable netcf for the interface driver in rpm build on new targets

libvirt.spec currently adds a hardcoded -Dnetcf=enabled to the meson
commandline, so just setting the default in the meson.build file won't
have any effect for rpm builds - it will be overridden.

This patch changes the meson commandline in the spec file from
hardcoded -Dnetcf=enabled to %{arg_netcf}, which is itself set
according to the value of %{with_netcf}; and *that* is normally set
according to the distro release of the build target (1 for Fedora >=
34 and RHEL >= 9, 0 otherwise), but can be manually overridden by
adding "-without netcf" to the rpmbuild commandline.

Along with being used to determine what arg to pass to meson,
%{with_netcf} is also checked when deciding on whether or not to add
netcf build time / install time dependencies ("Requires: netcf-libs"
and "BuildRequires: netcf-devel")

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Laine Stump 2021-01-17 14:27:20 -05:00
parent 06169a115d
commit 35d5b26aa4

View File

@ -101,6 +101,7 @@
%define with_sanlock 0
%define with_numad 0
%define with_firewalld_zone 0
%define with_netcf 0
%define with_libssh2 0
%define with_wireshark 0
%define with_libssh 0
@ -145,6 +146,10 @@
%define with_firewalld_zone 0%{!?_without_firewalld_zone:1}
%endif
%if 0%{?fedora} < 34 || 0%{?rhel} < 9
%define with_netcf 0%{!?_without_netcf:1}
%endif
# fuse is used to provide virtualized /proc for LXC
%if %{with_lxc}
@ -357,8 +362,9 @@ BuildRequires: fuse-devel >= 2.8.6
%if %{with_libssh2}
BuildRequires: libssh2-devel >= 1.3.0
%endif
%if %{with_netcf}
BuildRequires: netcf-devel >= 0.2.2
%endif
%if %{with_esx}
BuildRequires: libcurl-devel
%endif
@ -527,13 +533,13 @@ capabilities.
Summary: Interface driver plugin for the libvirtd daemon
Requires: libvirt-daemon = %{version}-%{release}
Requires: libvirt-libs = %{version}-%{release}
%if %{with_netcf}
Requires: netcf-libs >= 0.2.2
%endif
%description daemon-driver-interface
The interface driver plugin for the libvirtd daemon, providing
an implementation of the network interface APIs using the
netcf library
an implementation of the host network interface APIs.
%package daemon-driver-secret
Summary: Secret driver plugin for the libvirtd daemon
@ -1099,6 +1105,12 @@ exit 1
%define arg_firewalld_zone -Dfirewalld_zone=disabled
%endif
%if %{with_netcf}
%define arg_netcf -Dnetcf=enabled
%else
%define arg_netcf -Dnetcf=disabled
%endif
%if %{with_wireshark}
%define arg_wireshark -Dwireshark_dissector=enabled
%else
@ -1169,7 +1181,7 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/%{name}.spec)
%{?arg_numad} \
-Dcapng=enabled \
%{?arg_fuse} \
-Dnetcf=enabled \
%{?arg_netcf} \
-Dselinux=enabled \
%{?arg_selinux_mount} \
-Dapparmor=disabled \