Make polkit support optional

This commit modifies the spec file for libvirt to make the inclusion of
support for PolicyKit optional. It is enabled by default to preserve the
existing behavior, but can be disabled by passing `--without-polkit` to
`rpmbuild`.
This commit is contained in:
2018-01-24 15:58:54 -06:00
parent 21316e7a45
commit b7f2ffc0cc

View File

@@ -85,6 +85,7 @@
%endif
# A few optional bits off by default, we enable later
%define with_polkit 0%{!?_without_polkit:1}
%define with_fuse 0%{!?_without_fuse:0}
%define with_cgconfig 0%{!?_without_cgconfig:0}
%define with_sanlock 0%{!?_without_sanlock:0}
@@ -361,6 +362,7 @@ BuildRequires: radvd
BuildRequires: ebtables
BuildRequires: module-init-tools
BuildRequires: cyrus-sasl-devel
%if %{with_polkit}
%if 0%{?fedora} || 0%{?rhel} >= 7
# F22 polkit-devel doesn't pull in polkit anymore, which we need for pkcheck
BuildRequires: polkit >= 0.112
@@ -368,6 +370,7 @@ BuildRequires: polkit-devel >= 0.112
%else
BuildRequires: polkit-devel >= 0.93
%endif
%endif
# For mount/umount in FS driver
BuildRequires: util-linux
%if %{with_qemu}
@@ -502,11 +505,13 @@ Requires: module-init-tools
# for /sbin/ip & /sbin/tc
Requires: iproute
Requires: avahi-libs
%if %{with_polkit}
%if 0%{?fedora} || 0%{?rhel} >= 7
Requires: polkit >= 0.112
%else
Requires: polkit >= 0.93
%endif
%endif
%if %{with_cgconfig}
Requires: libcgroup
%endif
@@ -1193,6 +1198,12 @@ exit 1
%define arg_libxl --without-libxl
%endif
%if %{with_polkit}
%define arg_polkit --with-polkit
%else
%define arg_polkit --without-polkit
%endif
%if %{with_phyp}
%define arg_phyp --with-phyp
%else
@@ -1336,7 +1347,7 @@ rm -f po/stamp-po
%{?arg_libxl} \
--with-sasl \
--with-avahi \
--with-polkit \
%{?arg_polkit} \
--with-libvirtd \
%{?arg_uml} \
%{?arg_phyp} \
@@ -1858,9 +1869,11 @@ exit 0
%{_datadir}/augeas/lenses/tests/test_libvirt_lockd.aug
%endif
%if %{with_polkit}
%{_datadir}/polkit-1/actions/org.libvirt.unix.policy
%{_datadir}/polkit-1/actions/org.libvirt.api.policy
%{_datadir}/polkit-1/rules.d/50-libvirt.rules
%endif
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/
@@ -1875,7 +1888,9 @@ exit 0
%{_mandir}/man8/virtlockd.8*
%{_mandir}/man7/virkey*.7*
%if %{with_polkit}
%doc examples/polkit/*.rules
%endif
%files daemon-config-network
%dir %{_datadir}/libvirt/networks/