]>
Commit | Line | Data |
---|---|---|
94b9e5fa ER |
1 | Summary: Back-end data caching and persistence daemon for Graphite |
2 | Name: carbon | |
3 | Version: 0.9.10 | |
4 | Release: 0.1 | |
5 | License: Apache v2.0 | |
6 | Group: Daemons | |
7 | Source0: https://github.com/downloads/graphite-project/carbon/%{name}-%{version}.tar.gz | |
8 | # Source0-md5: 053b2df1c928250f59518e9bb9f35ad5 | |
9 | Source1: %{name}-cache.init | |
10 | Source2: %{name}-relay.init | |
11 | Source3: %{name}-aggregator.init | |
12 | Source4: %{name}.sysconfig | |
13 | Patch0: FHS.patch | |
14 | URL: https://launchpad.net/graphite/ | |
15 | BuildRequires: python-devel | |
16 | BuildRequires: python-setuptools | |
17 | BuildRequires: rpm-pythonprov | |
18 | BuildRequires: rpmbuild(macros) >= 1.658 | |
19 | Provides: group(carbon) | |
20 | Provides: user(carbon) | |
21 | Requires(postun): /usr/sbin/groupdel | |
22 | Requires(postun): /usr/sbin/userdel | |
23 | Requires(pre): /bin/id | |
24 | Requires(pre): /usr/bin/getgid | |
25 | Requires(pre): /usr/sbin/groupadd | |
26 | Requires(pre): /usr/sbin/useradd | |
27 | Requires: python-TwistedCore >= 8.0 | |
28 | Requires: python-whisper | |
29 | BuildArch: noarch | |
30 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
31 | ||
32 | %define no_install_post_check_tmpfiles 1 | |
33 | ||
34 | %description | |
35 | Twisted daemon that listens for time-series data and writes this data | |
36 | out to whisper databases, relays the data or aggregates the data. | |
37 | Carbon is a data collection and storage agent. | |
38 | ||
39 | %prep | |
40 | %setup -q | |
41 | %patch0 -p1 | |
42 | ||
43 | %build | |
44 | %{__python} setup.py build | |
45 | ||
46 | %install | |
47 | rm -rf $RPM_BUILD_ROOT | |
48 | %{__python} setup.py install \ | |
49 | --skip-build \ | |
50 | --optimize=2 \ | |
51 | --root=$RPM_BUILD_ROOT | |
52 | ||
53 | %py_postclean -x amqp_publisher.py,amqp_listener.py | |
54 | ||
55 | install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{name} | |
56 | install -d $RPM_BUILD_ROOT%{_localstatedir}/log/carbon | |
57 | install -d $RPM_BUILD_ROOT%{_localstatedir}/run/carbon | |
58 | install -d $RPM_BUILD_ROOT%{_sharedstatedir}/carbon | |
59 | ||
60 | # Install system configuration and init scripts | |
61 | install -Dp %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/carbon-cache | |
62 | install -Dp %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/carbon-relay | |
63 | install -Dp %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/carbon-aggregator | |
64 | install -Dp %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/carbon | |
65 | ||
66 | # Install default configuration files | |
67 | install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{name} | |
68 | install -Dp conf/carbon.conf.example $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/carbon.conf | |
69 | install -Dp conf/storage-schemas.conf.example $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/storage-schemas.conf | |
70 | ||
71 | # Temp mv to non .py locations | |
72 | cd $RPM_BUILD_ROOT%{_bindir} | |
73 | %{__mv} carbon-aggregator.py carbon-aggregator | |
74 | %{__mv} carbon-cache.py carbon-cache | |
75 | %{__mv} carbon-client.py carbon-client | |
76 | %{__mv} carbon-relay.py carbon-relay | |
77 | %{__mv} validate-storage-schemas.py validate-storage-schemas | |
78 | ||
79 | %clean | |
80 | rm -rf $RPM_BUILD_ROOT | |
81 | ||
82 | %pre | |
83 | %groupadd -g 290 -r carbon | |
84 | %useradd -u 290 -r -g carbon -d %{_sharedstatedir}/carbon -s /sbin/nologin -c "Carbon cache daemon" carbon | |
85 | ||
86 | %post | |
87 | /sbin/chkconfig --add carbon-aggregator | |
88 | /sbin/chkconfig --add carbon-cache | |
89 | /sbin/chkconfig --add carbon-relay | |
90 | %service carbon-aggregator restart | |
91 | %service carbon-cache restart | |
92 | %service carbon-relay restart | |
93 | ||
94 | %preun | |
95 | if [ $1 -eq 0 ]; then | |
96 | /sbin/chkconfig --del carbon-aggregator | |
97 | /sbin/chkconfig --del carbon-cache | |
98 | /sbin/chkconfig --del carbon-relay | |
99 | %service carbon-aggregator stop | |
100 | %service carbon-cache stop | |
101 | %service carbon-relay stop | |
102 | fi | |
103 | ||
104 | %postun | |
105 | if [ $1 = 0 ]; then | |
106 | %userremove carbon | |
107 | %groupremove carbon | |
108 | fi | |
109 | ||
110 | %files | |
111 | %defattr(644,root,root,755) | |
112 | %doc conf/* | |
113 | %dir %{_sysconfdir}/%{name} | |
114 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/carbon.conf | |
115 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/storage-schemas.conf | |
116 | %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/carbon | |
117 | %attr(754,root,root) /etc/rc.d/init.d/carbon-aggregator | |
118 | %attr(754,root,root) /etc/rc.d/init.d/carbon-cache | |
119 | %attr(754,root,root) /etc/rc.d/init.d/carbon-relay | |
120 | %attr(755,root,root) %{_bindir}/carbon-aggregator | |
121 | %attr(755,root,root) %{_bindir}/carbon-cache | |
122 | %attr(755,root,root) %{_bindir}/carbon-client | |
123 | %attr(755,root,root) %{_bindir}/carbon-relay | |
124 | %attr(755,root,root) %{_bindir}/validate-storage-schemas | |
125 | ||
126 | %dir %{py_sitescriptdir}/%{name} | |
127 | %attr(755,root,root) %{py_sitescriptdir}/%{name}/amqp_publisher.py | |
128 | %attr(755,root,root) %{py_sitescriptdir}/%{name}/amqp_listener.py | |
129 | %{py_sitescriptdir}/%{name}/*.py[co] | |
130 | %{py_sitescriptdir}/%{name}/amqp0-8.xml | |
131 | %dir %{py_sitescriptdir}/%{name}/aggregator | |
132 | %{py_sitescriptdir}/%{name}/aggregator/*.py[co] | |
133 | %{py_sitescriptdir}/%{name}-%{version}-py*.egg-info | |
134 | ||
135 | # FIXME/CHECKME: twisted itself packages /usr/lib64/python2.7/site-packages/twisted/plugins dir | |
136 | %dir %{py_sitescriptdir}/twisted | |
137 | %dir %{py_sitescriptdir}/twisted/plugins | |
138 | %{py_sitescriptdir}/twisted/plugins/carbon_*.py[co] | |
139 | ||
140 | %dir %{_localstatedir}/run/%{name} | |
141 | %dir %attr(775,root,carbon) %{_localstatedir}/log/%{name} | |
142 | %dir %attr(775,root,carbon) %{_sharedstatedir}/%{name} |