[PATCH 3/3] spec: make systemd_daemon usage configurable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fedora 20, I added this to my '~/.rpmmacros':

%_without_udev 1
%_without_storage_mpath 1
%_without_storage_disk 1

and uninstalled systemd-devel (which also removed device-mapper-devel).
Then I ran 'make rpm', and inspected the results:

$ ldd ~/rpmbuild/BUILD/libvirt-1.2.2/daemon/.libs/libvirtd | grep syst
$

Then I reinstalled systemd-devel, where I now see:

$ ldd ~/rpmbuild/BUILD/libvirt-1.2.2/daemon/.libs/libvirtd | grep syst
  libsystemd-daemon.so.0 => /lib64/libsystemd-daemon.so.0 (0x00007ffb858ba000)
$

Oops - the build is non-deterministic, where the final binary
depends on my build environment.  The fix is to require
systemd-devel in all situations where the code base uses it.
Now ~/.rpmmacros can contain "%define _without_systemd_daemon 1"
to explicitly disable use of the library, but the library is now
a strict build requirement for normal builds; if systemd-devel
is not installed, the user now gets an up-front warning:

$ rpmbuild -ta libvirt-1.2.2.tar.gz
error: Failed build dependencies:
       systemd-devel is needed by libvirt-1.2.2-1.fc20.x86_64

* libvirt.spec.in (with_systemd_daemon): New variable.
(BuildRequires): Require systemd-devel for more than just udev.
(%configure): Make choice of systemd_daemon explicit.

Signed-off-by: Eric Blake <eblake@xxxxxxxxxx>
---
 libvirt.spec.in | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/libvirt.spec.in b/libvirt.spec.in
index dd3906d..5fc8c57 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -131,6 +131,7 @@
 %define with_firewalld     0%{!?_without_firewalld:0}
 %define with_libssh2       0%{!?_without_libssh2:0}
 %define with_wireshark     0%{!?_without_wireshark:0}
+%define with_systemd_daemon 0%{!?_without_systemd_daemon:0}

 # Non-server/HV driver defaults which are always enabled
 %define with_sasl          0%{!?_without_sasl:1}
@@ -173,6 +174,7 @@
 # Fedora has systemd, libvirt still used sysvinit there.
 %if 0%{?fedora} >= 17 || 0%{?rhel} >= 7
     %define with_systemd 1
+    %define with_systemd_daemon 1
 %endif

 # Fedora 18 / RHEL-7 are first where firewalld support is enabled
@@ -445,6 +447,9 @@ BuildRequires: python
 %if %{with_systemd}
 BuildRequires: systemd-units
 %endif
+%if %{with_systemd_daemon}
+BuildRequires: systemd-devel
+%endif
 %if %{with_xen} || %{with_libxl}
 BuildRequires: xen-devel
 %endif
@@ -1374,6 +1379,10 @@ driver
     %define _without_wireshark --without-wireshark-dissector
 %endif

+%if ! %{with_systemd_daemon}
+    %define _without_systemd_daemon --without-systemd-daemon
+%endif
+
 %define when  %(date +"%%F-%%T")
 %define where %(hostname)
 %define who   %{?packager}%{!?packager:Unknown}
@@ -1448,6 +1457,7 @@ driver
            %{?_without_driver_modules} \
            %{?_with_firewalld} \
            %{?_without_wireshark} \
+           %{?_without_systemd_daemon} \
            %{with_packager} \
            %{with_packager_version} \
            --with-qemu-user=%{qemu_user} \
-- 
1.8.5.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]