File diamond.spec of Package diamond

#
# spec file for package python-diamond
#
# Copyright (c) 2016 SUSE LINUX Products 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:           diamond
Version:        4.0.195
Release:        0
License:        MIT
Summary:        Daemon that collects and publishes system metrics
Url:            https://github.com/python-diamond/Diamond
Group:          System/Monitoring
Source:         https://pypi.python.org/packages/source/d/diamond/diamond-%{version}.tar.gz
Source1:        diamond.service
BuildRequires:  systemd-rpm-macros
BuildRequires:  python-devel
BuildRequires:  python-configobj
Requires:       python-configobj
BuildRequires:  python-psutil
Requires:       python-psutil
%{?systemd_requires}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
Diamond is a python daemon that collects system metrics and publishes them to
Graphite (and others). It is capable of collecting cpu, memory, network, i/o,
load and disk metrics. Additionally, it features an API for implementing
custom collectors for gathering metrics from almost any source.

%prep
%setup -q
find src -type f -exec chmod 0644 {} \;

%build
python setup.py build

%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
%__install -D -m 0644 %{S:1} %{buildroot}%{_unitdir}/diamond.service
install -d -m 0755 %{buildroot}%{_sbindir}
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rcdiamond
cp %{buildroot}%{_sysconfdir}/diamond/diamond.conf.example %{buildroot}%{_sysconfdir}/diamond/diamond.conf
rm -f %{buildroot}%{_sysconfdir}/diamond/diamond.conf.example.windows
install -d -m 0755 %{buildroot}%{_sysconfdir}/diamond/collectors
install -d -m 0755 %{buildroot}%{_sysconfdir}/diamond/handlers
rm -f %{buildroot}%{_datadir}/diamond/LICENSE
rm -f %{buildroot}%{_datadir}/diamond/README.md

%pre
%service_add_pre diamond.service

%post
%service_add_post diamond.service

%preun
%service_del_preun diamond.service

%postun
%service_del_postun diamond.service

%files
%defattr(-,root,root,-)
%doc LICENSE README.md
%dir %{_sysconfdir}/diamond
%dir %{_sysconfdir}/diamond/collectors
%dir %{_sysconfdir}/diamond/handlers
%config %{_sysconfdir}/diamond/diamond.conf.example
%config(noreplace) %{_sysconfdir}/diamond/diamond.conf
%{_bindir}/diamond
%{_bindir}/diamond-setup
%{python_sitelib}/*
%dir %{_datadir}/diamond
%{_datadir}/diamond/*
%{_unitdir}/diamond.service
%{_sbindir}/rcdiamond

%changelog
openSUSE Build Service is sponsored by