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(a)redhat.com>
---
libvirt.spec.in | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index b5892987cf..f7c350db41 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -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}
@@ -358,8 +363,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
@@ -528,13 +534,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 network interface APIs using udev.
%package daemon-driver-secret
Summary: Secret driver plugin for the libvirtd daemon
@@ -1100,6 +1106,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
@@ -1170,7 +1182,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 \
--
2.29.2