-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnova-billing.spec
132 lines (96 loc) · 2.93 KB
/
nova-billing.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
%global with_doc 0
%if ! (0%{?fedora} > 12 || 0%{?rhel} > 5)
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%endif
Name: nova-billing
Version: 2.1.0
Release: 1
Summary: A common billing server
License: GNU LGPL 2.1
Vendor: Grid Dynamics International, Inc.
URL: http://www.griddynamics.com/openstack
Group: Development/Languages/Python
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: python-devel python-setuptools make
BuildArch: noarch
Requires: python-flask
Requires: python-flask-sqlalchemy
Requires: python-openstackclient-base
Requires: python-webob
Requires: python-kombu
Requires: python-amqplib
Requires: python-eventlet
Requires: python-routes
Requires: start-stop-daemon
%description
The billing server stores state information for miscellaneous resources
(instances, volumes, images, etc.) in a database and generates reports
accessed by REST API.
%if 0%{?with_doc}
%package doc
Summary: Documentation for %{name}
Group: Documentation
Requires: %{name} = %{version}-%{release}
BuildRequires: python-sphinx make
%description doc
Documentation and examples for %{name}.
%endif
%prep
%setup -q -n %{name}-%{version}
%build
%{__python} setup.py build
%install
%__rm -rf %{buildroot}
%{__python} setup.py install -O1 --skip-build --prefix=%{_prefix} --root=%{buildroot}
%if 0%{?with_doc}
export PYTHONPATH=%{buildroot}%{python_sitelib}
make -C doc html
%endif
cd redhat
for script in *.init; do
install -p -D -m 755 "$script" "%{buildroot}%{_initrddir}/${script%.init}"
done
cd ..
mkdir -p %{buildroot}/etc
cp -a etc/nova-billing %{buildroot}/etc
mkdir -p %{buildroot}%{_localstatedir}/{log,lib,run}/nova-billing
%clean
%__rm -rf %{buildroot}
%pre
getent group nova-billing >/dev/null || groupadd -r nova-billing
getent passwd nova-billing >/dev/null || \
useradd -r -g nova-billing -d %{_sharedstatedir}/nova-billing -s /sbin/nologin \
-c "Nova Billing Daemons" nova-billing
exit 0
%preun
if [ $1 -eq 0 ] ; then
/sbin/service %{name} stop >/dev/null 2>&1
/sbin/chkconfig --del %{name}-heart
/sbin/chkconfig --del %{name}-os-amqp
fi
exit 0
%postun
if [ $1 -eq 1 ] ; then
/sbin/service %{name}-heart condrestart
/sbin/service %{name}-os-amqp condrestart
fi
exit 0
%files
%defattr(-,root,root,-)
%doc README.rst
%{_initrddir}/*
%{python_sitelib}/*
%{_usr}/bin/*
%defattr(-,nova-billing,nova-billing,-)
%config(noreplace) /etc/nova-billing/*
%defattr(0775,nova-billing,nova-billing,-)
%dir %{_sharedstatedir}/nova-billing
%dir %{_localstatedir}/log/nova-billing
%dir %{_localstatedir}/run/nova-billing
%if 0%{?with_doc}
%files doc
%defattr(-,root,root,-)
%doc doc/build/html
%endif
%changelog