Use --with-tests to conditionalize test dependencies

This commit is contained in:
David King 2014-12-03 15:52:08 +00:00
parent cc5bc1dd69
commit 56e53f32fc

View File

@ -10,6 +10,9 @@
%global dbus_common_config_opts --enable-libaudit --enable-selinux=yes --with-init-scripts=redhat --with-system-pid-file=%{_localstatedir}/run/messagebus.pid --with-dbus-user=dbus --libexecdir=/%{_libexecdir}/dbus-1 --docdir=%{_pkgdocdir} --enable-doxygen-docs --enable-xml-docs %global dbus_common_config_opts --enable-libaudit --enable-selinux=yes --with-init-scripts=redhat --with-system-pid-file=%{_localstatedir}/run/messagebus.pid --with-dbus-user=dbus --libexecdir=/%{_libexecdir}/dbus-1 --docdir=%{_pkgdocdir} --enable-doxygen-docs --enable-xml-docs
# Disabled in June 2014: http://lists.freedesktop.org/archives/dbus/2014-June/016223.html
%bcond_with tests
Name: dbus Name: dbus
Epoch: 1 Epoch: 1
Version: 1.8.12 Version: 1.8.12
@ -48,13 +51,15 @@ Requires: libselinux%{?_isa} >= %{libselinux_version}
Requires: dbus-libs%{?_isa} = %{epoch}:%{version}-%{release} Requires: dbus-libs%{?_isa} = %{epoch}:%{version}-%{release}
Requires(pre): /usr/sbin/useradd Requires(pre): /usr/sbin/useradd
# Note: These is only required for --enable-tests; when bootstrapping, # Note: These is only required for --with-tests; when bootstrapping, you can
# you can remove this and drop the --enable-tests configure argument. # pass --without-tests.
%if %{with tests}
BuildRequires: pkgconfig(gio-2.0) BuildRequires: pkgconfig(gio-2.0)
BuildRequires: pkgconfig(dbus-glib-1) BuildRequires: pkgconfig(dbus-glib-1)
BuildRequires: dbus-python BuildRequires: dbus-python
BuildRequires: pygobject2 BuildRequires: pygobject2
BuildRequires: /usr/bin/Xvfb BuildRequires: /usr/bin/Xvfb
%endif
%description %description
D-BUS is a system for sending messages between applications. It is D-BUS is a system for sending messages between applications. It is
@ -138,6 +143,25 @@ mkdir -p %{buildroot}%{_datadir}/gtk-doc/html
ln -s %{_pkgdocdir} %{buildroot}%{_datadir}/gtk-doc/html/dbus ln -s %{_pkgdocdir} %{buildroot}%{_datadir}/gtk-doc/html/dbus
%if %{with tests}
%check
# TODO: configure in a separate build dir.
%configure %{dbus_common_config_opts} --enable-asserts --enable-verbose-mode --enable-tests
make clean
# TODO: better script for this...
export DISPLAY=42
{ Xvfb :${DISPLAY} -nolisten tcp -auth /dev/null >/dev/null 2>&1 &
trap "kill -15 $! || true" 0 HUP INT QUIT TRAP TERM; };
if ! env DBUS_TEST_SLOW=1 make check; then
echo "Tests failed, finding all Automake logs..." 1>&2;
find . -type f -name '*.trs' | while read trs; do cat ${trs}; cat ${trs%%.trs}.log; done
echo "Exiting abnormally due to make check failure above" 1>&2;
exit 1;
fi
%endif
%pre %pre
# Add the "dbus" user and group # Add the "dbus" user and group
/usr/sbin/groupadd -r -g %{dbus_user_uid} dbus 2>/dev/null || : /usr/sbin/groupadd -r -g %{dbus_user_uid} dbus 2>/dev/null || :
@ -234,6 +258,7 @@ ln -s %{_pkgdocdir} %{buildroot}%{_datadir}/gtk-doc/html/dbus
- Use macroized systemd scriptlets (#850083) - Use macroized systemd scriptlets (#850083)
- Add some more documentation from the upstream tarball - Add some more documentation from the upstream tarball
- Tighten subpackage dependencies by using %%{?_isa} - Tighten subpackage dependencies by using %%{?_isa}
- Use --with-tests to conditionalize test dependencies
* Wed Nov 26 2014 David King <amigadave@amigadave.com> - 1:1.8.12-1 * Wed Nov 26 2014 David King <amigadave@amigadave.com> - 1:1.8.12-1
- Update to 1.8.12 (#1168438) - Update to 1.8.12 (#1168438)