]> git.pld-linux.org Git - packages/diamond.git/blame - diamond.spec
Added service stuff. Release 1. Works for me.
[packages/diamond.git] / diamond.spec
CommitLineData
30fc16b9
MK
1# Conditional build:
2# %bcond_with doc # don't build doc
3# %bcond_with tests # do not perform "make test"
4%bcond_without python2 # CPython 2.x module
5# %bcond_with python3 # CPython 3.x module
6
7%define module diamond
8Summary: Python daemon that collects system metrics and publishes them to Graphite (and others).
9Summary(pl.UTF-8): Demon napisany w Pythonie, zbierający statystyki i publikujący je do Graphite (i innych)
10# Name must match the python module/package name (as in 'import' statement)
11Name: diamond
12Version: 4.0.195
8fceffdd 13Release: 0.6
30fc16b9
MK
14License: MIT
15Group: Libraries/Python
16# https://github.com/python-diamond/Diamond/archive/v4.0.tar.gz
17# https://pypi.python.org/packages/source/d/diamond/diamond-4.0.195.tar.gz#md5=b49da676079eafab3e784cccedc6bfa1
18Source0: https://pypi.python.org/packages/source/d/diamond/%{name}-%{version}.tar.gz
19# Source0-md5: b49da676079eafab3e784cccedc6bfa1
20#URL: https://pypi.python.org/pypi/MODULE
21Source1: %{name}.conf
22Source3: %{name}.init
23Source10: PostgresqlCollector.conf
24
25URL: https://github.com/python-diamond/Diamond
26BuildRequires: rpm-pythonprov
27# for the py_build, py_install macros
28BuildRequires: rpmbuild(macros) >= 1.710
29%if %{with python2}
30BuildRequires: python-modules
31#BuildRequires: python-setuptools
32%endif
33# %if %{with python3}
34# #BuildRequires: python3-setuptools
35# BuildRequires: python3-modules
36# %endif
37# when using /usr/bin/env or other in-place substitutions
38#BuildRequires: sed >= 4.0
39# replace with other requires if defined in setup.py
40Requires: python-configobj >= 5.0.6
41Requires: python-modules
42Suggests: python-setproctitle
43Provides: group(diamond)
44Provides: user(diamond)
45
46BuildArch: noarch
47BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
48
49%description
50
51%description -l pl.UTF-8
52
53
54%package -n %{module}-collector-postgresql
55Summary: Data collector for PostgreSQL database
56Summary(pl.UTF-8): Zbieracz statystyk dla bazdy danych Postgresql
57Group: Libraries/Python
58Requires: %{name}
59Requires: python-psycopg2
60
61%description -n %{module}-collector-postgresql
62Data collector for PostgreSQL database
63
64%description -n %{module}-collector-postgresql -l pl.UTF-8
65Zbieracz statystyk dla bazdy danych Postgresql
66
67%prep
68%setup -q -n %{module}-%{version}
69
70# fix #!%{_bindir}/env python -> #!%{_bindir}/python:
71#%{__sed} -i -e '1s,^#!.*python,#!%{__python},' %{name}.py
72
73%build
74%if %{with python2}
75%py_build %{?with_tests:test}
76%endif
77
78# %if %{with python3}
79# %%py3_build %{?with_tests:test}
80# %endif
81
82# %if %{with doc}
83# cd docs
84# %{__make} -j1 html
85# rm -rf _build/html/_sources
86# %endif
87
88%install
89rm -rf $RPM_BUILD_ROOT
90
91%if %{with python2}
92%py_install
93%py_postclean
94%endif
95# %if %{with python3}
96# %%py3_install
97# %endif
98install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{module}
99install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{module}/collectors
100install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{module}/handlers
101## install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{module}/configs
102install -p %{SOURCE1} $RPM_BUILD_ROOT/%{_sysconfdir}/%{module}/diamond.conf
103
104install -d $RPM_BUILD_ROOT%{_localstatedir}/log/%{module}
105# install -d $RPM_BUILD_ROOT%{_localstatedir}/run/carbon
106# install -d $RPM_BUILD_ROOT%{_sharedstatedir}/carbon
107
108install -d $RPM_BUILD_ROOT/etc/rc.d/init.d
109install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/diamond
110
111install -p %{SOURCE10} $RPM_BUILD_ROOT%{_sysconfdir}/%{module}/collectors
112
113
114%clean
115rm -rf $RPM_BUILD_ROOT
116
117%pre
118%groupadd -g 327 diamond
119%useradd -u 327 -d /var/log/diamond -g diamond -c "Diamond daemon user" diamond
120
8fceffdd
MK
121%post
122/sbin/chkconfig --add diamond
123## %systemd_post diamond.service
124
125%preun
126if [ "$1" = "0" ]; then
127 %service diamond stop
128 /sbin/chkconfig --del diamond
129fi
130%systemd_preun diamond.service
131
30fc16b9
MK
132%postun
133if [ "$1" = "0" ]; then
134 %userremove diamond
135 %groupremove diamond
136fi
8fceffdd
MK
137%systemd_reload
138
30fc16b9
MK
139
140%if %{with python2}
141%files
142%defattr(644,root,root,755)
143%doc README.md LICENSE
144%dir %attr(750,root,diamond) %{_sysconfdir}/%{module}
145%dir %attr(640,root,diamond) %{_sysconfdir}/%{module}/diamond.conf
146%dir %attr(750,root,diamond) %{_sysconfdir}/%{module}/collectors
147%dir %attr(750,root,diamond) %{_sysconfdir}/%{module}/handlers
148%attr(755,root,root) %{_bindir}/diamond
149%attr(755,root,root) %{_bindir}/diamond-setup
150%{py_sitescriptdir}/%{module}
151# %{py_sitescriptdir}/%{module}/collectors
152%{_datadir}/diamond/
153%attr(750,diamond,diamond) /var/log/diamond
154%attr(754,root,root) /etc/rc.d/init.d/diamond
155
30fc16b9
MK
156%if "%{py_ver}" > "2.4"
157%{py_sitescriptdir}/%{module}-%{version}-py*.egg-info
158%endif
159%endif
160
161# %if %{with python3}
162# %files -n python3-%{module}
163# %defattr(644,root,root,755)
164# %doc AUTHORS CHANGES LICENSE
165# %{py3_sitescriptdir}/%{module}
166# %{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info
167# %{_examplesdir}/python3-%{module}-%{version}
168# %endif
169#
170# %if %{with doc}
171# %files apidocs
172# %defattr(644,root,root,755)
173# %doc docs/_build/html/*
174# %endif
175
176%files -n %{module}-collector-postgresql
177%defattr(644,root,root,755)
178%{_sysconfdir}/%{module}/collectors/PostgresqlCollector.conf
This page took 0.160005 seconds and 4 git commands to generate.