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
8 Summary: Python daemon that collects system metrics and publishes them to Graphite (and others).
9 Summary(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)
15 Group: 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
18 Source0: https://pypi.python.org/packages/source/d/diamond/%{name}-%{version}.tar.gz
19 # Source0-md5: b49da676079eafab3e784cccedc6bfa1
20 #URL: https://pypi.python.org/pypi/MODULE
23 Source10: PostgresqlCollector.conf
25 URL: https://github.com/python-diamond/Diamond
26 BuildRequires: rpm-pythonprov
27 # for the py_build, py_install macros
28 BuildRequires: rpmbuild(macros) >= 1.710
30 BuildRequires: python-modules
31 #BuildRequires: python-setuptools
34 # #BuildRequires: python3-setuptools
35 # BuildRequires: python3-modules
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
40 Requires: python-configobj >= 5.0.6
41 Requires: python-modules
42 Suggests: python-setproctitle
43 Provides: group(diamond)
44 Provides: user(diamond)
47 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
51 %description -l pl.UTF-8
54 %package -n %{module}-collector-postgresql
55 Summary: Data collector for PostgreSQL database
56 Summary(pl.UTF-8): Zbieracz statystyk dla bazdy danych Postgresql
57 Group: Libraries/Python
59 Requires: python-psycopg2
61 %description -n %{module}-collector-postgresql
62 Data collector for PostgreSQL database
64 %description -n %{module}-collector-postgresql -l pl.UTF-8
65 Zbieracz statystyk dla bazdy danych Postgresql
68 %setup -q -n %{module}-%{version}
70 # fix #!%{_bindir}/env python -> #!%{_bindir}/python:
71 #%{__sed} -i -e '1s,^#!.*python,#!%{__python},' %{name}.py
75 %py_build %{?with_tests:test}
79 # %%py3_build %{?with_tests:test}
85 # rm -rf _build/html/_sources
89 rm -rf $RPM_BUILD_ROOT
98 install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{module}
99 install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{module}/collectors
100 install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{module}/handlers
101 ## install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{module}/configs
102 install -p %{SOURCE1} $RPM_BUILD_ROOT/%{_sysconfdir}/%{module}/diamond.conf
104 install -d $RPM_BUILD_ROOT%{_localstatedir}/log/%{module}
105 # install -d $RPM_BUILD_ROOT%{_localstatedir}/run/carbon
106 # install -d $RPM_BUILD_ROOT%{_sharedstatedir}/carbon
108 install -d $RPM_BUILD_ROOT/etc/rc.d/init.d
109 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/diamond
111 install -p %{SOURCE10} $RPM_BUILD_ROOT%{_sysconfdir}/%{module}/collectors
115 rm -rf $RPM_BUILD_ROOT
118 %groupadd -g 327 diamond
119 %useradd -u 327 -d /var/log/diamond -g diamond -c "Diamond daemon user" diamond
122 /sbin/chkconfig --add diamond
123 ## %systemd_post diamond.service
126 if [ "$1" = "0" ]; then
127 %service diamond stop
128 /sbin/chkconfig --del diamond
130 %systemd_preun diamond.service
133 if [ "$1" = "0" ]; then
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
153 %attr(750,diamond,diamond) /var/log/diamond
154 %attr(754,root,root) /etc/rc.d/init.d/diamond
156 %if "%{py_ver}" > "2.4"
157 %{py_sitescriptdir}/%{module}-%{version}-py*.egg-info
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}
172 # %defattr(644,root,root,755)
173 # %doc docs/_build/html/*
176 %files -n %{module}-collector-postgresql
177 %defattr(644,root,root,755)
178 %{_sysconfdir}/%{module}/collectors/PostgresqlCollector.conf