This repository has been archived by the owner on Jun 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
openstack-barbican.spec
303 lines (249 loc) · 8.95 KB
/
openstack-barbican.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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
%global release_name kilo
%global release_number 2
# We optionally support both release_number and milestone
# as definiable build paramters. This is useful for non-stable
# building.
# release_number: used for primary milestone release candidates
# If populated will auto populate the milestone macro and
# milestone: Used for primary milestone release candidates and
# for incremental development builds.
%{?release_number: %define milestone 0b%{release_number}}
%{?milestone: %define version_milestone .%{milestone}}
# Using the above we generate the macro for the Source URL
%{?release_number: %define release_version %{release_name}-%{release_number}}
%{?release_version: %define release_version %{release_name}}
Name: openstack-barbican
Version: 2015.1
Release: 1%{?version_milestone}%{?dist}
Summary: OpenStack Barbican Key Manager
Group: Applications/System
License: ASL 2.0
Url: http://github.com/cloudkeep/barbican
Source0: https://launchpad.net/barbican/%{release_name}/%{release_version}/+download/barbican-%{version}%{?version_milestone}.tar.gz
# TODO: Submit PR to add these to upstream
Source1: openstack-barbican-api.service
Source2: openstack-barbican-worker.service
Source3: openstack-barbican-keystone-listener.service
# TODO: Submit PR to add these to upstream
# patches_base=2014.2
#
Patch0001: 0001-Remove-runtime-dependency-on-pbr.patch
Patch0002: 0002-Removed-pyenv-references-in-barbican.sh.patch
BuildArch: noarch
BuildRequires: python2-devel
BuildRequires: python-setuptools
Requires(pre): shadow-utils
Requires: python-barbican
%if 0%{?el6}
Requires(post): chkconfig
Requires(preun): chkconfig
Requires(preun): initscripts
%else
Requires(post): systemd
Requires(preun): systemd
Requires(preun): systemd
BuildRequires: systemd
%endif
%description -n openstack-barbican
Openstack Barbican provides a ReST API for securely storing,
provisioning and managing secrets. It is aimed at being
useful for all environments, including large ephemeral Clouds.
Clients can generate various types of secrets like symmetric
and asymmetric keys, passphrases and binary data.
%package -n python-barbican
Summary: All python modules of Barbican.
Requires: python-alembic
Requires: python-babel
Requires: python-crypto
Requires: python-cryptography
Requires: python-eventlet
Requires: python-iso8601
Requires: python-jsonschema
Requires: python-kombu
Requires: python-netaddr
Requires: python-oslo-config
Requires: python-oslo-messaging
Requires: python-paste
Requires: python-paste-deploy
Requires: python-pbr
Requires: python-pecan
Requires: python-six
Requires: python-sqlalchemy
Requires: python-stevedore
Requires: python-webob
%description -n python-barbican
This package contains the barbican python library.
It is required by both the API(openstack-barbican) and
worker(openstack-barbican-worker) packages.
%package -n openstack-barbican-worker
Summary: Barbican Key Manager worker daemon
Requires: python-barbican
%description -n openstack-barbican-worker
This package contains scripts to start a barbican worker
on a worker node. It currently conflicts with the main package.
%package -n openstack-barbican-keystone-listener
Summary: Barbican Keystone Listener daemon
Requires: python-barbican
%description -n openstack-barbican-keystone-listener
This package contains scripts to start a barbican keystone
listener daemon.
%prep
%setup -q -n barbican-%{version}%{?version_milestone}
%patch0001 -p1
%patch0002 -p1
rm -rf barbican.egg-info
echo %{version} > barbican/versioninfo
sed -i '/setuptools_git/d; /setup_requires/d; /install_requires/d; /dependency_links/d' setup.py
sed -i s/REDHATBARBICANVERSION/%{version}/ barbican/version.py
sed -i s/REDHATBARBICANRELEASE/%{release}/ barbican/version.py
# make doc build compatible with python-oslo-sphinx RPM
sed -i 's/oslosphinx/oslo.sphinx/' doc/source/conf.py
# Remove the requirements file so that pbr hooks don't add it
# to distutils requiers_dist config
rm -rf {test-,}requirements.txt tools/{pip,test}-requires
%build
%{__python} setup.py build
%install
PBR_VERSION=%{version}%{?version_milestone} %{__python} setup.py install -O1 --root %{buildroot}
mkdir -p %{buildroot}%{_sysconfdir}/barbican
mkdir -p %{buildroot}%{_localstatedir}/l{ib,og}/barbican
mkdir -p %{buildroot}%{_bindir}
install -m 644 etc/barbican/policy.json %{buildroot}%{_sysconfdir}/barbican/
install -m 644 etc/barbican/barbican* %{buildroot}%{_sysconfdir}/barbican/
install -m 755 bin/barbican-worker.py %{buildroot}%{_bindir}
install -m 755 bin/barbican-keystone-listener.py %{buildroot}%{_bindir}
install -m 755 bin/barbican-db-manage.py %{buildroot}%{_bindir}
# Remove the bash script since its more dev focused
rm -f %{buildroot}%{_bindir}/barbican.sh
%if 0%{?el6}
# upstart services
mkdir -p %{buildroot}%{_sysconfdir}/init
install -m 644 etc/init/barbican-api.conf %{buildroot}%{_sysconfdir}/init
install -m 644 etc/init/barbican-worker.conf %{buildroot}%{_sysconfdir}/init
install -m 644 etc/init/barbican-keystone-listener.conf %{buildroot}%{_sysconfdir}/init
%else
# systemd services
install -p -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/openstack-barbican-api.service
install -p -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/openstack-barbican-worker.service
install -p -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/openstack-barbican-keystone-listener.service
%endif
# install log rotation
mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d
install -m644 etc/logrotate.d/barbican-api %{buildroot}%{_sysconfdir}/logrotate.d/barbican-api
%pre
# Add the 'barbican' user
getent group barbican >/dev/null || groupadd -r barbican
getent passwd barbican >/dev/null || \
useradd -r -g barbican -d %{_localstatedir}/lib/barbican -s /sbin/nologin \
-c "Barbican Key Manager user account." barbican
exit 0
%clean
rm -rf %{buildroot}
%files -n openstack-barbican
%defattr(-,root,root)
%doc LICENSE
%dir %{_sysconfdir}/barbican
%dir %{_localstatedir}/log/barbican
%{_sysconfdir}/logrotate.d/barbican-api
%attr(0755,root,root) %{_bindir}/barbican-db-manage.py
%config(noreplace) %{_sysconfdir}/barbican/*
%if 0%{?el6}
%config(noreplace) %{_sysconfdir}/init/barbican-api.conf
%else
%{_unitdir}/openstack-barbican-api.service
%endif
%files -n python-barbican
%doc LICENSE
%defattr(-,barbican,barbican)
%{python_sitelib}/*
%dir %{_localstatedir}/lib/barbican
%files -n openstack-barbican-worker
%doc LICENSE
%defattr(-,root,root)
%dir %{_sysconfdir}/barbican
%dir %{_localstatedir}/log/barbican
%attr(0755,root,root) %{_bindir}/barbican-worker.py
%config(noreplace) %{_sysconfdir}/barbican/barbican-api.conf
%if 0%{?el6}
%config(noreplace) %{_sysconfdir}/init/barbican-worker.conf
%else
%{_unitdir}/openstack-barbican-worker.service
%endif
%files -n openstack-barbican-keystone-listener
%doc LICENSE
%attr(0755,root,root) %{_bindir}/barbican-keystone-listener.py
%if 0%{?el6}
%config(noreplace) %{_sysconfdir}/init/barbican-keystone-listener.conf
%else
%{_unitdir}/openstack-barbican-keystone-listener.service
%endif
%post -n openstack-barbican
# ensure that init system recognizes the service
%if 0%{?el6}
/sbin/initctl reload-configuration
%else
%systemd_post openstack-barbican-api.service
/bin/systemctl daemon-reload
%endif
%post -n openstack-barbican-worker
# ensure that init system recognizes the service
%if 0%{?el6}
/sbin/initctl reload-configuration
%else
%systemd_post openstack-barbican-worker.service
/bin/systemctl daemon-reload
%endif
%post -n openstack-barbican-keystone-listener
# ensure that init system recognizes the service
%if 0%{?el6}
/sbin/initctl reload-configuration
%else
%systemd_post openstack-barbican-keystone-listener.service
/bin/systemctl daemon-reload
%endif
%preun -n openstack-barbican
%if 0%{?el6}
if [ $1 -eq 0 ] ; then
# This is package removal, not upgrade
/sbin/stop barbican-api >/dev/null 2>&1 || :
fi
%else
%systemd_preun openstack-barbican-api.service
%endif
%preun -n openstack-barbican-worker
%if 0%{?el6}
if [ $1 -eq 0 ] ; then
# This is package removal, not upgrade
/sbin/stop barbican-worker >/dev/null 2>&1 || :
fi
%else
%systemd_preun openstack-barbican-worker.service
%endif
%preun -n openstack-barbican-keystone-listener
%if 0%{?el6}
if [ $1 -eq 0 ] ; then
# This is package removal, not upgrade
/sbin/stop barbican-keystone-listener >/dev/null 2>&1 || :
fi
%else
%systemd_preun openstack-barbican-keystone-listener.service
%endif
%postun -n openstack-barbican
%if 0%{?rhel} != 6
# Restarting on EL6 is left as a task to the admin
%systemd_postun_with_restart openstack-barbican-api.service
%endif
%postun -n openstack-barbican-worker
%if 0%{?rhel} != 6
# Restarting on EL6 is left as a task to the admin
%systemd_postun_with_restart openstack-barbican-worker.service
%endif
%postun -n openstack-barbican-keystone-listener
%if 0%{?rhel} != 6
# Restarting on EL6 is left as a task to the admin
%systemd_postun_with_restart openstack-barbican-keystone-listender.service
%endif
%changelog
* Thu Nov 13 2014 Abhishek Koneru <[email protected]>
- Initial spec file for building openstack-barbican packages -
openstack-barbican, python-barbican, openstack-barbican-worker.