File python-Beaver.spec of Package python-Beaver

#
# spec file for package python-Beaver
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           python-Beaver
Version:        8.0+git.1502900605.3e0068a
Release:        0
Summary:        daemon for munging log files
License:        MIT
Group:          Development/Languages/Python
Url:            https://nourlavailable.com/
Source0:        python-beaver-%{version}.tar
# systemd service files
Source10:       Beaver.service
BuildRequires:  python-setuptools
BuildRequires:  systemd-rpm-macros
Requires:       python-conf_d >= 0.0.4
Requires:       python-dogpile.cache
Requires:       python-glob2 >= 0.3
Requires:       python-keystoneclient
Requires:       python-msgpack-python
Requires:       python-requests
# FIXME: maybe optional
# Requires:       python-python-daemon >= 1.5.2
# Requires:       python-boto >= 2.18.0
# Requires:       python-kafka-python == 0.9.5
# Requires:       python-msgpack-pure >= 0.1.3
# Requires:       python-pika >= 0.9.14
# Requires:       python-redis >= 2.7.5
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
python daemon that munches on logs and sends their contents to logstash

%prep
%setup -q -n python-beaver-%{version}

%build
python setup.py build

%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
### Install systemd unit services
mkdir -p %{buildroot}%{_sbindir} %{buildroot}%{_unitdir}
install -p -D -m 444 %{SOURCE10} %{buildroot}%{_unitdir}/Beaver.service
install -d -m 750 %{buildroot}%{_localstatedir}/log/beaver
install -m 0750 -d %{buildroot}%{_sysconfdir}/beaver/conf.d/

%pre
%service_add_pre Beaver.service
getent group beaver >/dev/null || groupadd -r beaver
getent passwd beaver >/dev/null || useradd -r -g beaver -d /var/lib/empty -s /bin/false -c "Beaver Home" beaver

%post
%service_add_post Beaver.service

%preun
%service_del_preun Beaver.service

%postun
%restart_on_update Beaver.service
%service_del_postun Beaver.service

%files
%defattr(-,root,root,-)
%doc LICENSE.txt README.rst
%{_bindir}/beaver
%{python_sitelib}/*
%{_unitdir}/Beaver.service
%dir %{_sysconfdir}/beaver
%dir %attr(0750, beaver, beaver) %{_localstatedir}/log/beaver
%config %dir %{_sysconfdir}/beaver/conf.d

%changelog
openSUSE Build Service is sponsored by