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 if [ "$1" = "0" ]; then
129 %defattr(644,root,root,755)
130 %doc README.md LICENSE
131 %dir %attr(750,root,diamond) %{_sysconfdir}/%{module}
132 %dir %attr(640,root,diamond) %{_sysconfdir}/%{module}/diamond.conf
133 %dir %attr(750,root,diamond) %{_sysconfdir}/%{module}/collectors
134 %dir %attr(750,root,diamond) %{_sysconfdir}/%{module}/handlers
135 %attr(755,root,root) %{_bindir}/diamond
136 %attr(755,root,root) %{_bindir}/diamond-setup
137 %{py_sitescriptdir}/%{module}
138 # %{py_sitescriptdir}/%{module}/collectors
140 %attr(750,diamond,diamond) /var/log/diamond
141 %attr(754,root,root) /etc/rc.d/init.d/diamond
144 %if "%{py_ver}" > "2.4"
145 %{py_sitescriptdir}/%{module}-%{version}-py*.egg-info
149 # %if %{with python3}
150 # %files -n python3-%{module}
151 # %defattr(644,root,root,755)
152 # %doc AUTHORS CHANGES LICENSE
153 # %{py3_sitescriptdir}/%{module}
154 # %{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info
155 # %{_examplesdir}/python3-%{module}-%{version}
160 # %defattr(644,root,root,755)
161 # %doc docs/_build/html/*
164 %files -n %{module}-collector-postgresql
165 %defattr(644,root,root,755)
166 %{_sysconfdir}/%{module}/collectors/PostgresqlCollector.conf