forked from jjzhang/booth
-
Notifications
You must be signed in to change notification settings - Fork 26
/
booth.spec.in
280 lines (242 loc) · 7.55 KB
/
booth.spec.in
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
# keep around ready for later user
@ALPHATAG@
@NUMCOMM@
@DIRTY@
%global gitver %{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}}
%global gittarver %{?numcomm:-%{numcomm}}%{?alphatag:-g%{alphatag}}%{?dirty:-%{dirty}}
%@bcond_html_man@ html_man
%@bcond_glue@ glue
%@bcond_python3@ python3
%@bcond_run_build_tests@ run_build_tests
## User and group to use for nonprivileged services (should be in sync with pacemaker)
%global uname @uname@
%global gname @gname@
# Defined on RHEL 8 and Fedora
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?__python3: %global __python3 /usr/bin/python3}
%if 0%{?with_python3}
%global __python_full_path %{__python3}
%else
%global __python_full_path %{__python2}
%endif
%if 0%{?suse_version}
%global booth_docdir %{_defaultdocdir}/%{name}
%else
# newer fedora distros have _pkgdocdir, rely on that when
# available
%{!?_pkgdocdir: %global _pkgdocdir %%{_docdir}/%{name}-%{version}}
# Directory where we install documentation
%global booth_docdir %{_pkgdocdir}
%endif
%global test_path %{_datadir}/booth/tests
%if 0%{?suse_version}
%define _libexecdir %{_libdir}
%define _fwdefdir %{_libexecdir}/firewalld/services
%endif
%define with_extra_warnings 0
%define with_debugging 0
%define without_fatal_warnings 1
%if 0%{?fedora} || 0%{?centos} || 0%{?rhel}
%define pkg_group System Environment/Daemons
%else
%define pkg_group Productivity/Clustering/HA
%endif
%global release 1
Name: booth
Url: https://github.com/ClusterLabs/booth
Summary: Ticket Manager for Multi-site Clusters
License: GPL-2.0-or-later
Group: %{pkg_group}
Version: @version@
Release: %{?numcomm:%{numcomm}.}%{release}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?alphatag:.git}%{?dist}
Source: https://github.com/ClusterLabs/booth/archive/v%{version}%{?gittarver}/%{name}-%{version}%{?gitver}.tar.gz
Source1: %name-rpmlintrc
BuildRequires: @asciidoc@
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: gcc
BuildRequires: pkgconfig
%if 0%{?suse_version}
BuildRequires: glib2-devel
# SuSEFirewall2 replaced by Firewalld (fate#323460)
BuildRequires: firewall-macros
%else
BuildRequires: pkgconfig(glib-2.0)
%endif
BuildRequires: gnutls-devel
%if 0%{?fedora} || 0%{?centos} || 0%{?rhel}
BuildRequires: pacemaker-libs-devel
%else
%if 0%{?suse_version} > 1500
BuildRequires: libpacemaker3-devel
%else
BuildRequires: libpacemaker-devel
%endif
%endif
%if 0%{?with_glue}
%if 0%{?fedora} || 0%{?centos} || 0%{?rhel}
BuildRequires: cluster-glue-libs-devel
%else
BuildRequires: libglue-devel
%endif
%else
# logging provider
BuildRequires: pkgconfig(libqb)
# random2range provider
BuildRequires: pkgconfig(glib-2.0)
# nametag provider
BuildRequires: pkgconfig(libsystemd)
%endif
BuildRequires: libxml2-devel
BuildRequires: zlib-devel
%if 0%{?fedora} || 0%{?centos} || 0%{?rhel}
Requires: pacemaker >= 1.1.8
%if 0%{?with_glue}
Requires: cluster-glue-libs >= 1.0.6
%endif
%else
Requires: pacemaker-ticket-support >= 2.0
%endif
# for check scriptlet
%if 0%{?with_python3}
BuildRequires: python3-devel
%else
BuildRequires: python
%endif
# For Fedora compatibility
Provides: booth-core
Provides: booth-site
Provides: booth-arbitrator
%description
Booth manages tickets which authorize cluster sites located in
geographically dispersed locations to run resources. It
facilitates support of geographically distributed clustering in
Pacemaker.
%prep
%setup -q -n %{name}-%{version}%{?gitver}
%build
./autogen.sh
%configure \
--with-initddir=%{_initrddir} \
--docdir=%{booth_docdir} \
%{?with_html_man:--with-html_man} \
%{!?with_glue:--without-glue} \
PYTHON=%{__python_full_path}
make
%install
make DESTDIR=$RPM_BUILD_ROOT install docdir=%{booth_docdir}
mkdir -p %{buildroot}/%{_mandir}/man8/
gzip < docs/boothd.8 > %{buildroot}/%{_mandir}/man8/booth.8.gz
ln %{buildroot}/%{_mandir}/man8/booth.8.gz %{buildroot}/%{_mandir}/man8/boothd.8.gz
%if %{defined _unitdir}
# systemd
mkdir -p %{buildroot}/%{_unitdir}
cp -a conf/[email protected] %{buildroot}/%{_unitdir}/[email protected]
cp -a conf/booth-arbitrator.service %{buildroot}/%{_unitdir}/booth-arbitrator.service
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcbooth-arbitrator
%else
# sysV init
ln -s ../../%{_initddir}/booth-arbitrator %{buildroot}%{_sbindir}/rcbooth-arbitrator
%endif
#install test-parts
mkdir -p %{buildroot}/%{test_path}/conf
cp -a test %{buildroot}/%{test_path}/
cp -a conf/booth.conf.example %{buildroot}/%{test_path}/conf/
chmod +x %{buildroot}/%{test_path}/test/booth_path
chmod +x %{buildroot}/%{test_path}/test/live_test.sh
mkdir -p %{buildroot}/%{test_path}/src/
ln -s %{_sbindir}/boothd %{buildroot}/%{test_path}/src/
rm -f %{buildroot}/%{test_path}/test/*.pyc
# Generate runtests.py and boothtestenv.py
sed -e 's#PYTHON_SHEBANG#%{__python_full_path} -Es#g' \
-e 's#TEST_SRC_DIR#%{test_path}/test#g' \
-e 's#TEST_BUILD_DIR#%{test_path}/test#g' \
%{buildroot}/%{test_path}/test/runtests.py.in > %{buildroot}/%{test_path}/test/runtests.py
chmod +x %{buildroot}/%{test_path}/test/runtests.py
sed -e 's#PYTHON_SHEBANG#%{__python_full_path} -Es#g' \
-e 's#TEST_SRC_DIR#%{test_path}/test#g' \
-e 's#TEST_BUILD_DIR#%{test_path}/test#g' \
%{buildroot}/%{test_path}/test/boothtestenv.py.in > %{buildroot}/%{test_path}/test/boothtestenv.py
%if 0%{?suse_version}
#Firewalld rule
mkdir -p $RPM_BUILD_ROOT/%{_fwdefdir}
install -m 644 contrib/geo-cluster.firewalld.xml $RPM_BUILD_ROOT/%{_fwdefdir}/booth.xml
#install -m 644 %{S:2} $RPM_BUILD_ROOT/%{_fwdefdir}/booth
%post
%firewalld_reload
%endif
%check
%if 0%{?with_run_build_tests}
echo "%%with_run_build_tests set to %with_run_build_tests; including tests"
make check
%else
echo "%%with_run_build_tests set to %with_run_build_tests; skipping tests"
%endif
%files
%{_sbindir}/booth
%{_sbindir}/boothd
%{_sbindir}/booth-keygen
%{_sbindir}/geostore
%{_mandir}/man8/booth.8.gz
%{_mandir}/man8/boothd.8.gz
%{_mandir}/man8/booth-keygen.8.gz
%{_mandir}/man8/geostore.8.gz
%dir /usr/lib/ocf
%dir /usr/lib/ocf/resource.d
%dir /usr/lib/ocf/resource.d/pacemaker
%dir /usr/lib/ocf/resource.d/booth
%dir /usr/lib/ocf/lib
%dir /usr/lib/ocf/lib/booth
%dir %{_sysconfdir}/booth
%dir %attr (750, %{uname}, %{gname}) %{_var}/lib/booth/
%dir %attr (750, %{uname}, %{gname}) %{_var}/lib/booth/cores
%{_sbindir}/rcbooth-arbitrator
/usr/lib/ocf/resource.d/pacemaker/booth-site
/usr/lib/ocf/lib/booth/geo_attr.sh
/usr/lib/ocf/resource.d/booth/geostore
%config %{_sysconfdir}/booth/booth.conf.example
%if 0%{?suse_version}
%dir %{_libexecdir}/firewalld
%dir %{_fwdefdir}
%{_fwdefdir}/booth.xml
%endif
%if %{defined _unitdir}
%{_unitdir}/[email protected]
%{_unitdir}/booth-arbitrator.service
%exclude %{_initddir}/booth-arbitrator
%else
%{_initddir}/booth-arbitrator
%endif
%dir %{_datadir}/booth
%{_datadir}/booth/service-runnable
%dir %{_datadir}/pkgconfig
%{_datadir}/pkgconfig/booth.pc
%doc AUTHORS README COPYING
%doc README.upgrade-from-v0.1
%if 0%{?with_html_man}
%{booth_docdir}/booth-keygen.8.html
%{booth_docdir}/boothd.8.html
%{booth_docdir}/geostore.8.html
%endif
%package test
Summary: Test scripts for Booth
Group: %{pkg_group}
Requires: booth
Requires: gdb
Requires: %{__python_full_path}
%if 0%{?with_python3}
Requires: python3-pexpect
%else
Requires: python-pexpect
%endif
%description test
This package contains automated tests for Booth,
the Cluster Ticket Manager for Pacemaker.
%files test
%doc %{booth_docdir}/README-testing
%{test_path}
%dir /usr/lib/ocf
%dir /usr/lib/ocf/resource.d
%dir /usr/lib/ocf/resource.d/booth
/usr/lib/ocf/resource.d/booth/sharedrsc
%changelog