forked from legionus/billing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbc.spec
228 lines (161 loc) · 4.1 KB
/
bc.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# bc.spec
#
# Copyright (c) 2012-2013 by Alexey Gladkov
# Copyright (c) 2012-2013 by Nikolay Ivanov
#
# This file is covered by the GNU General Public License,
# which should be included with billing as the file COPYING.
#
%define python_sitearch %(%{__python} -c 'from distutils import sysconfig; print sysconfig.get_python_lib(1)')
%define bc_user _bc
%define bc_group _bc
Summary: BC Platform package
Name: bc
Version: 2.0.0
Release: 1%{?dist}
Epoch: %(date +%s)
License: GPLv3
Group: Applications/System
BuildRequires: python
BuildRequires: python-setuptools
Requires: python
Requires: python-psycopg2
Requires: python-msgpack
Requires: bc-common
BuildRoot: %_tmppath/%name-%version-root
BuildArch: noarch
Source0: bc.tar.gz
%description
BC Platform package.
%package calc-server
Summary: BC Platform - Calc server
Group: Applications/System
Requires: python
Requires: bc-common
%description calc-server
Billing calculator.
%package data-server
Summary: BC Platform - Data manage server
Group: Applications/System
Requires: python
Requires: bc-common
Requires: bc-client
%description data-server
Storage data contoller.
%package wapi
Summary: BC Platform - API Controller
Group: Applications/System
Requires: python
Requires: httpd
Requires: mod_wsgi
Requires: bc-common
Requires: bc-jsonrpc
%description wapi
HTTP API interface for contoller.
%package admin
Summary: BC admin utilities
Group: Applications/System
Requires: bc-common
Requires: bc-client
%description admin
BC admin utilities.
%package jsonrpc
Summary: JSONRPC implementation for python
Group: Applications/System
Requires: python
%description jsonrpc
JSONRPC implementation.
%package common
Summary: BC server library
Group: Applications/System
Requires: python
Requires: python-psycopg2
Requires: python-msgpack
%description common
BC common files, directories and libraries.
%package client
Summary: BC client library
Group: Applications/System
Requires: python
Requires: bc-jsonrpc
Requires: python-connectionpool
# TODO: Remove
Requires: bc-common
%description client
BC client library.
%prep
%setup -q
%install
[ %buildroot = "/" ] || rm -rf %buildroot
%__python setup.py install \
--root="%buildroot" \
--prefix="%_prefix" \
--install-lib="%python_sitearch"
mkdir -p -- %buildroot/%_localstatedir/run/bc
find %buildroot/ -name '*.egg-info' -exec rm -rf -- '{}' '+'
# Remove for now
rm -rfv -- %buildroot/etc/cron.d %buildroot/usr/share/c2
%clean
[ %buildroot = "/" ] || rm -rf %buildroot
%pre calc-server
groupadd -r -f %bc_group
getent passwd %bc_user >/dev/null ||
useradd -r -M -g %bc_group -d /dev/null -s /dev/null -n %bc_user
%post calc-server
if [ "$1" = "0" ]; then
chkconfig --add bc-calc
else
service bc-calc condrestart
fi
%preun calc-server
if [ "$1" = "0" ]; then
service bc-calc stop ||:
chkconfig --del bc-calc ||:
fi
%pre data-server
groupadd -r -f %bc_group
getent passwd %bc_user >/dev/null ||
useradd -r -M -g %bc_group -d /dev/null -s /dev/null -n %bc_user
%post data-server
if [ "$1" = "0" ]; then
chkconfig --add bc-data
else
service bc-data condrestart
fi
%preun data-server
if [ "$1" = "0" ]; then
service bc-data stop ||:
chkconfig --del bc-data ||:
fi
%post wapi
service httpd condrestart ||:
%postun wapi
[ "$1" != "0" ] || service httpd condrestart ||:
%pre common
groupadd -r -f %bc_group
%files calc-server
%_bindir/bc-calc-*
%_sysconfdir/rc.d/init.d/bc-calc
%attr(770,root,%bc_group) %_localstatedir/run/bc
%files data-server
%_sysconfdir/rc.d/init.d/bc-data
%_bindir/bc-data-*
%attr(770,root,%bc_group) %_localstatedir/run/bc
%files admin
%_bindir/billing-*
%_bindir/task_creator
%attr(600,root,root) %config(noreplace) %_sysconfdir/wapi-acl.conf
%files common
%attr(644,root,%bc_group) %config(noreplace) %_sysconfdir/billing.conf
%python_sitearch/bc
%files jsonrpc
%python_sitearch/bc_jsonrpc
%files client
%python_sitearch/bc_client
%files wapi
%_libexecdir/bc
%python_sitearch/bc_wapi
%config(noreplace) %_sysconfdir/httpd/conf.d/*.conf
%changelog
* Wed Oct 10 2012 Alexey Gladkov <[email protected]> 1349878993:2.0.0-1.el6
- First standalone build.