]> git.pld-linux.org Git - packages/diamond.git/blob - diamond.spec
Initial version 4.0.195.
[packages/diamond.git] / diamond.spec
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
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)
11 Name:           diamond
12 Version:        4.0.195
13 Release:        0.5
14 License:        MIT
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
21 Source1:        %{name}.conf
22 Source3:        %{name}.init
23 Source10:       PostgresqlCollector.conf
24
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
29 %if %{with python2}
30 BuildRequires:  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
40 Requires:       python-configobj >= 5.0.6
41 Requires:       python-modules
42 Suggests:       python-setproctitle
43 Provides:       group(diamond)
44 Provides:       user(diamond)
45
46 BuildArch:      noarch
47 BuildRoot:      %{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
55 Summary:        Data collector for PostgreSQL database
56 Summary(pl.UTF-8):      Zbieracz statystyk dla bazdy danych Postgresql
57 Group:          Libraries/Python
58 Requires:       %{name}
59 Requires:       python-psycopg2
60
61 %description -n %{module}-collector-postgresql
62 Data collector for PostgreSQL database
63
64 %description -n %{module}-collector-postgresql -l pl.UTF-8
65 Zbieracz 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
89 rm -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
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
103
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
107
108 install -d $RPM_BUILD_ROOT/etc/rc.d/init.d
109 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/diamond
110
111 install -p %{SOURCE10} $RPM_BUILD_ROOT%{_sysconfdir}/%{module}/collectors
112
113
114 %clean
115 rm -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
121 %postun
122 if [ "$1" = "0" ]; then
123         %userremove diamond
124         %groupremove diamond
125 fi
126
127 %if %{with python2}
128 %files
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
139 %{_datadir}/diamond/
140 %attr(750,diamond,diamond) /var/log/diamond
141 %attr(754,root,root) /etc/rc.d/init.d/diamond
142
143
144 %if "%{py_ver}" > "2.4"
145 %{py_sitescriptdir}/%{module}-%{version}-py*.egg-info
146 %endif
147 %endif
148
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}
156 # %endif
157 #
158 # %if %{with doc}
159 # %files apidocs
160 # %defattr(644,root,root,755)
161 # %doc docs/_build/html/*
162 # %endif
163
164 %files -n %{module}-collector-postgresql
165 %defattr(644,root,root,755)
166 %{_sysconfdir}/%{module}/collectors/PostgresqlCollector.conf
This page took 0.076546 seconds and 3 git commands to generate.