Instead of enabling the feature conditionally, always enable
it and then remove the installed file when building on a
platform that doesn't need it.
We already perform the complementary check to decide whether
the file should be included in the package.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
libvirt.spec.in | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index af2ba20c02..70d2d37502 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1283,12 +1283,6 @@ exit 1
%define arg_remote_mode -Dremote_default_mode=legacy
%endif
-%if %{with_userfaultfd_sysctl}
- %define arg_userfaultfd_sysctl -Duserfaultfd_sysctl=enabled
-%else
- %define arg_userfaultfd_sysctl -Duserfaultfd_sysctl=disabled
-%endif
-
%define when %(date +"%%F-%%T")
%define where %(hostname)
%define who %{?packager}%{!?packager:Unknown}
@@ -1369,7 +1363,7 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y'
%{_specdir}/libvirt.spec)
-Dqemu_datadir=%{qemu_datadir} \
-Dtls_priority=%{tls_priority} \
-Dsysctl_config=enabled \
- %{?arg_userfaultfd_sysctl} \
+ -Duserfaultfd_sysctl=enabled \
%{?enable_werror} \
-Dexpensive_tests=enabled \
-Dinit_script=systemd \
@@ -1518,6 +1512,10 @@ rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirtd_libxl.aug
rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirtd_libxl.aug
%endif
+ %if ! %{with_userfaultfd_sysctl}
+rm -f $RPM_BUILD_ROOT%{_prefix}/lib/sysctl.d/60-qemu-postcopy-migration.conf
+ %endif
+
# Copied into libvirt-docs subpackage eventually
mv $RPM_BUILD_ROOT%{_datadir}/doc/libvirt libvirt-docs
--
2.43.0