-#
+# TODO
+# - add initscript post scriptlets
+# - --daemonize crashes (works under systemd only): https://github.com/fedora-infra/fedmsg/issues/302
+
# Conditional build:
%bcond_with tests # build with tests
Summary: Tools for Fedora Infrastructure real-time messaging
Name: fedmsg
-Version: 0.11.1
-Release: 0.4
+Version: 0.16.4
+Release: 2
License: LGPL v2+
Group: Applications/Networking
Source0: http://pypi.python.org/packages/source/f/fedmsg/%{name}-%{version}.tar.gz
-# Source0-md5: 3074d89b779929b338ac609081e10340
+# Source0-md5: 43f00d123669f6a0506ee0f37035c5d7
Source1: %{name}-tmpfiles.conf
-Patch0: %{name}-kojitests.patch
+Source2: %{name}-gateway.init
+Source3: %{name}-hub.init
+Source4: %{name}-irc.init
+Source5: %{name}-relay.init
Patch1: config.patch
-URL: http://github.com/ralphbean/fedmsg
+URL: https://github.com/fedora-infra/fedmsg
BuildRequires: python-devel
BuildRequires: python-setuptools
BuildRequires: rpm-pythonprov
-BuildRequires: rpmbuild(macros) >= 1.219
+BuildRequires: rpmbuild(macros) >= 1.710
%if %{with tests}
BuildRequires: python-mock
BuildRequires: python-nose
BuildRequires: python-requests
#BuidlRequires: python-sqlalchemy
%endif
-Requires: python-M2Crypto
+Requires: python-M2Crypto >= 0.22.5
Requires: python-arrow
#Requires: python-daemon
#Requires: python-fabulous
%package hub
Summary: The FedMsg Hub
Group: Applications/Networking
+Requires: rc-scripts >= 0.4.0.20
+Requires(post,preun): /sbin/chkconfig
Requires: %{name} = %{version}-%{release}
%description hub
Summary: The FedMsg Relay
Group: Applications/Networking
Requires: %{name} = %{version}-%{release}
+Requires: rc-scripts >= 0.4.0.20
+Requires(post,preun): /sbin/chkconfig
%description relay
This package contains configuration and init scripts for the FedMsg
Summary: The FedMsg IRC Bot
Group: Applications/Networking
Requires: %{name} = %{version}-%{release}
+Requires: rc-scripts >= 0.4.0.20
+Requires(post,preun): /sbin/chkconfig
%description irc
This package contains configuration and init scripts for the FedMsg
Summary: The FedMsg Gateway daemon
Group: Applications/Networking
Requires: %{name} = %{version}-%{release}
+Requires: rc-scripts >= 0.4.0.20
+Requires(post,preun): /sbin/chkconfig
%description gateway
This package contains configuration and init scripts for the FedMsg
%prep
%setup -q
-%patch0 -p1
%patch1 -p1
# This only got shipped with fedmsg-0.6.3
# so knock it out too.
sed -i "/'sqlalchemy.*$/d" setup.py
+sed -i "/cryptography/d" setup.py
+sed -i "/daemon/d" setup.py
+
# Temporarily disable signature validation while the timestamp precision bug is
# worked out upstream. -- https://github.com/fedora-infra/fedmsg/pull/186
sed -i "s/validate_signatures=True/validate_signatures=False/g" fedmsg.d/ssl.py
cp -rf fedmsg.d fedmsg/tests/
%build
-%{__python} setup.py build
+%py_build
# Create this temporary symlink that's only needed for the test suite.
ln -s fedmsg/tests/test_certs dev_certs
%install
rm -rf $RPM_BUILD_ROOT
-%{__python} setup.py install \
- --skip-build \
- --optimize=2 \
+%py_install \
--install-data=%{_datadir} \
--root $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT{/etc/{logrotate.d,rc.d/init.d},%{_sysconfdir}/fedmsg.d,%{systemdtmpfilesdir},%{systemdunitdir},/var/{run,log}/fedmsg}
cp -p fedmsg.d/*.py $RPM_BUILD_ROOT%{_sysconfdir}/fedmsg.d
-cp -p initsys/sysv/fedmsg-hub.init $RPM_BUILD_ROOT/etc/rc.d/init.d/fedmsg-hub
-cp -p initsys/sysv/fedmsg-relay.init $RPM_BUILD_ROOT/etc/rc.d/init.d/fedmsg-relay
-cp -p initsys/sysv/fedmsg-irc.init $RPM_BUILD_ROOT/etc/rc.d/init.d/fedmsg-irc
-cp -p initsys/sysv/fedmsg-gateway.init $RPM_BUILD_ROOT/etc/rc.d/init.d/fedmsg-gateway
+install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/fedmsg-gateway
+install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/fedmsg-hub
+install -p %{SOURCE4} $RPM_BUILD_ROOT/etc/rc.d/init.d/fedmsg-irc
+install -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/fedmsg-relay
cp -p initsys/systemd/fedmsg-hub.service $RPM_BUILD_ROOT%{systemdunitdir}
cp -p initsys/systemd/fedmsg-relay.service $RPM_BUILD_ROOT%{systemdunitdir}
%groupadd -g 313 -r fedmsg
%useradd -u 313 -r -s /sbin/nologin -d %{_datadir}/%{name} -M -c 'FedMsg' -g fedmsg fedmsg
+%post hub
+/sbin/chkconfig --add fedmsg-hub
+%service fedmsg-hub restart
+
%preun hub
-if [ $1 -eq 0 ]; then
+if [ "$1" = "0" ]; then
%service fedmsg-hub stop
/sbin/chkconfig --del fedmsg-hub
fi
+%post relay
+/sbin/chkconfig --add fedmsg-relay
+%service fedmsg-relay restart
+
%preun relay
-if [ $1 -eq 0 ]; then
+if [ "$1" = "0" ]; then
%service fedmsg-relay stop
/sbin/chkconfig --del fedmsg-relay
fi
+%post irc
+/sbin/chkconfig --add fedmsg-irc
+%service fedmsg-irc restart
+
%preun irc
-if [ $1 -eq 0 ]; then
+if [ "$1" = "0" ]; then
%service fedmsg-irc stop
/sbin/chkconfig --del fedmsg-irc
fi
+%post gateway
+/sbin/chkconfig --add fedmsg-gateway
+%service fedmsg-gateway restart
+
%preun gateway
-if [ $1 -eq 0 ]; then
+if [ "$1" = "0" ]; then
%service fedmsg-gateway stop
/sbin/chkconfig --del fedmsg-gateway
fi