]>
Commit | Line | Data |
---|---|---|
95761a51 JB |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without python2 # CPython 2.x module | |
4 | %bcond_without python3 # CPython 3.x module | |
5 | ||
a2f4ba26 JB |
6 | Summary: Shared storage lock manager |
7 | Summary(pl.UTF-8): Zarządca blokad dla współdzielonego składowania danych | |
8 | Name: sanlock | |
cd1291c6 | 9 | Version: 3.8.4 |
7ba55725 | 10 | Release: 3 |
a2f4ba26 JB |
11 | License: LGPL v2+ (libsanlock_client, libwdmd), GPL v2 (libsanlock, utilities) |
12 | Group: Networking | |
f0345fc4 | 13 | Source0: https://releases.pagure.org/sanlock/%{name}-%{version}.tar.gz |
cd1291c6 | 14 | # Source0-md5: c064756c07a86e83119cfdd7695cf449 |
f0345fc4 | 15 | Patch0: %{name}-init-pld.patch |
e6d834ca | 16 | URL: https://pagure.io/sanlock |
a2f4ba26 JB |
17 | BuildRequires: gcc >= 5:3.4 |
18 | BuildRequires: libaio-devel | |
19 | BuildRequires: libblkid-devel | |
20 | BuildRequires: libuuid-devel | |
95761a51 JB |
21 | %{?with_python2:BuildRequires: python-devel >= 1:2.5} |
22 | %{?with_python3:BuildRequires: python3-devel >= 1:3.2} | |
c4ff6f07 | 23 | BuildRequires: rpmbuild(macros) >= 1.228 |
51fef094 JB |
24 | BuildRequires: tar >= 1:1.22 |
25 | BuildRequires: xz | |
c4ff6f07 | 26 | Requires(post,preun): /sbin/chkconfig |
95ab4ed0 JB |
27 | Requires(postun): /usr/sbin/groupdel |
28 | Requires(postun): /usr/sbin/userdel | |
29 | Requires(pre): /bin/id | |
30 | Requires(pre): /usr/bin/getgid | |
31 | Requires(pre): /usr/sbin/groupadd | |
32 | Requires(pre): /usr/sbin/useradd | |
a2f4ba26 | 33 | Requires: %{name}-libs = %{version}-%{release} |
c4ff6f07 JB |
34 | Provides: group(sanlock) |
35 | Provides: user(sanlock) | |
a2f4ba26 JB |
36 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
37 | ||
38 | %description | |
39 | Shared storage lock manager. | |
40 | ||
41 | %description -l pl.UTF-8 | |
42 | Zarządca blokad dla współdzielonego składowania danych. | |
43 | ||
51fef094 JB |
44 | %package reset |
45 | Summary: Host reset daemon and client using sanlock | |
46 | Summary(pl.UTF-8): Demon resetujący hosta oraz klient wykorzystujący sanlocka | |
47 | Group: Daemons | |
48 | Requires(post,preun): /sbin/chkconfig | |
49 | Requires: %{name} = %{version}-%{release} | |
50 | ||
51 | %description reset | |
52 | This package contains the reset daemon and client. A cooperating host | |
53 | running the daemon can be reset by a host running the client, so long | |
54 | as both maintain access to a common sanlock lockspace. | |
55 | ||
56 | %description reset -l pl.UTF-8 | |
57 | Ten pakiet zawiera demona oraz klienta resetującego. Współpracujący | |
58 | host z działającym demonem może być zresetowany przez host z | |
59 | działającym klientem tak długo, jak oba mają dostęp do wspólnej | |
60 | przestrzeni blokad sanlock. | |
61 | ||
62 | %package -n fence-sanlock | |
63 | Summary: Fence agent using sanlock and wdmd | |
64 | Summary(pl.UTF-8): Agent barier wykorzystujący sanlocka oraz wdmd | |
65 | Group: Daemons | |
66 | Requires(post,preun): /sbin/chkconfig | |
67 | Requires: %{name} = %{version}-%{release} | |
68 | ||
69 | %description -n fence-sanlock | |
70 | This package contains the fence agent and daemon for using sanlock and | |
71 | wdmd as a cluster fence agent. | |
72 | ||
73 | %description -n fence-sanlock -l pl.UTF-8 | |
74 | Ten pakiet zawiera agenta oraz demona barier do użytku z sanlockiem | |
75 | oraz wdmd jako agent barier w klastrze. | |
76 | ||
a2f4ba26 JB |
77 | %package libs |
78 | Summary: Sanlock libraries | |
79 | Summary(pl.UTF-8): Biblioteki sanlock | |
80 | Group: Libraries | |
81 | ||
82 | %description libs | |
83 | Sanlock libraries. | |
84 | ||
85 | %description libs -l pl.UTF-8 | |
86 | Biblioteki sanlock. | |
87 | ||
88 | %package devel | |
89 | Summary: Header files for sanlock libraries | |
90 | Summary(pl.UTF-8): Pliki nagłówkowe bibliotek sanlock | |
91 | Group: Development/Libraries | |
92 | Requires: %{name}-libs = %{version}-%{release} | |
601aa86e JB |
93 | # for libsanlock |
94 | Requires: libaio-devel | |
95 | Requires: libblkid-devel | |
96 | Requires: libuuid-devel | |
a2f4ba26 JB |
97 | |
98 | %description devel | |
99 | Header files for sanlock libraries. | |
100 | ||
101 | %description devel -l pl.UTF-8 | |
102 | Pliki nagłówkowe bibliotek sanlock. | |
103 | ||
104 | %package -n python-sanlock | |
95761a51 JB |
105 | Summary: Python 2 binding for sanlock library |
106 | Summary(pl.UTF-8): Wiązanie Pythona 2 do biblioteki sanlock | |
a2f4ba26 JB |
107 | Group: Libraries/Python |
108 | Requires: %{name}-libs = %{version}-%{release} | |
109 | ||
110 | %description -n python-sanlock | |
95761a51 | 111 | Python 2 binding for sanlock library. |
a2f4ba26 JB |
112 | |
113 | %description -n python-sanlock -l pl.UTF-8 | |
95761a51 JB |
114 | Wiązanie Pythona 2 do biblioteki sanlock. |
115 | ||
116 | %package -n python3-sanlock | |
117 | Summary: Python 3 binding for sanlock library | |
118 | Summary(pl.UTF-8): Wiązanie Pythona 3 do biblioteki sanlock | |
119 | Group: Libraries/Python | |
120 | Requires: %{name}-libs = %{version}-%{release} | |
121 | ||
122 | %description -n python3-sanlock | |
123 | Python 3 binding for sanlock library. | |
124 | ||
125 | %description -n python3-sanlock -l pl.UTF-8 | |
126 | Wiązanie Pythona 3 do biblioteki sanlock. | |
a2f4ba26 JB |
127 | |
128 | %prep | |
129 | %setup -q | |
c195fee2 | 130 | %patch0 -p1 |
a2f4ba26 JB |
131 | |
132 | %build | |
133 | export CFLAGS="%{rpmcflags}" | |
134 | ||
135 | CMD_LDFLAGS="%{rpmldflags}" \ | |
136 | LIB_LDFLAGS="%{rpmldflags}" \ | |
137 | %{__make} -C wdmd \ | |
138 | CC="%{__cc}" | |
139 | ||
140 | CMD_LDFLAGS="%{rpmldflags}" \ | |
141 | LIB_CLIENT_LDFLAGS="%{rpmldflags}" \ | |
142 | LIB_ENTIRE_LDFLAGS="%{rpmldflags}" \ | |
143 | %{__make} -C src \ | |
144 | CC="%{__cc}" | |
145 | ||
51fef094 JB |
146 | CFLAGS= \ |
147 | %{__make} -C fence_sanlock \ | |
148 | CC="%{__cc}" \ | |
149 | OPTIMIZE_FLAG="%{rpmcflags}" | |
150 | ||
151 | CFLAGS= \ | |
152 | %{__make} -C reset \ | |
153 | CC="%{__cc}" \ | |
154 | LDFLAGS="%{rpmldflags}" \ | |
155 | OPTIMIZE_FLAG="%{rpmcflags}" | |
156 | ||
74dea56f | 157 | cd python |
95761a51 | 158 | %if %{with python2} |
74dea56f | 159 | %py_build |
95761a51 JB |
160 | %endif |
161 | ||
162 | %if %{with python3} | |
163 | %py3_build | |
164 | %endif | |
74dea56f | 165 | cd .. |
a2f4ba26 JB |
166 | |
167 | %install | |
168 | rm -rf $RPM_BUILD_ROOT | |
169 | ||
170 | %{__make} -C wdmd install \ | |
171 | DESTDIR=$RPM_BUILD_ROOT \ | |
172 | LIBDIR=%{_libdir} | |
173 | ||
174 | %{__make} -C src install \ | |
175 | DESTDIR=$RPM_BUILD_ROOT \ | |
176 | LIBDIR=%{_libdir} | |
177 | ||
51fef094 JB |
178 | %{__make} -C fence_sanlock install \ |
179 | DESTDIR=$RPM_BUILD_ROOT \ | |
180 | LIBDIR=%{_libdir} | |
181 | ||
182 | %{__make} -C reset install \ | |
183 | DESTDIR=$RPM_BUILD_ROOT | |
184 | ||
74dea56f | 185 | cd python |
95761a51 | 186 | %if %{with python2} |
74dea56f | 187 | %py_install |
95761a51 JB |
188 | %endif |
189 | ||
190 | %if %{with python3} | |
191 | %py3_install | |
192 | %endif | |
74dea56f | 193 | cd .. |
a2f4ba26 JB |
194 | |
195 | /sbin/ldconfig -n $RPM_BUILD_ROOT%{_libdir} | |
196 | ||
51fef094 JB |
197 | install -d $RPM_BUILD_ROOT{%{systemdunitdir},/etc/rc.d/init.d} |
198 | install init.d/fence_sanlockd $RPM_BUILD_ROOT/etc/rc.d/init.d | |
a2f4ba26 JB |
199 | install init.d/sanlock $RPM_BUILD_ROOT/etc/rc.d/init.d |
200 | install init.d/wdmd $RPM_BUILD_ROOT/etc/rc.d/init.d | |
51fef094 JB |
201 | for serv in sanlock wdmd fence_sanlockd ; do |
202 | sed -e "s,/lib/systemd/systemd-${serv},/etc/rc.d/init.d/${serv}," init.d/${serv}.service >$RPM_BUILD_ROOT%{systemdunitdir}/${serv}.service | |
203 | done | |
204 | cp -p init.d/sanlk-resetd.service $RPM_BUILD_ROOT%{systemdunitdir} | |
205 | ||
206 | install -d $RPM_BUILD_ROOT/var/run/{sanlock,wdmd,fence_sanlock,fence_sanlockd} | |
207 | install -d $RPM_BUILD_ROOT%{systemdtmpfilesdir} | |
208 | cat >$RPM_BUILD_ROOT%{systemdtmpfilesdir}/sanlock.conf <<EOF | |
a9d7d0e7 | 209 | d /var/run/sanlock 0775 sanlock sanlock - |
51fef094 JB |
210 | d /var/run/wdmd 0775 root sanlock - |
211 | EOF | |
212 | cat >$RPM_BUILD_ROOT%{systemdtmpfilesdir}/fence_sanlock.conf <<EOF | |
213 | d /var/run/fence_sanlock 0755 root root - | |
214 | d /var/run/fence_sanlockd 0755 root root - | |
c195fee2 JB |
215 | EOF |
216 | ||
d9e2e3b0 JB |
217 | # fix hardcoded libdir=${prefix}/lib64 |
218 | %{__sed} -i -e 's,^libdir=.*,libdir=%{_libdir},' $RPM_BUILD_ROOT%{_pkgconfigdir}/*.pc | |
219 | ||
a2f4ba26 JB |
220 | %clean |
221 | rm -rf $RPM_BUILD_ROOT | |
222 | ||
95ab4ed0 JB |
223 | %pre |
224 | %groupadd -g 279 sanlock | |
225 | %useradd -u 279 -g 279 -d /usr/share/empty -s /bin/false -c 'SANlock user' sanlock | |
226 | ||
c4ff6f07 JB |
227 | %post |
228 | /sbin/chkconfig --add sanlock | |
229 | /sbin/chkconfig --add wdmd | |
230 | %service sanlock restart | |
231 | %service wdmd restart | |
232 | ||
233 | %preun | |
234 | if [ "$1" = "0" ]; then | |
235 | %service -q sanlock stop | |
236 | %service -q wdmd stop | |
237 | /sbin/chkconfig --del sanlock | |
238 | /sbin/chkconfig --del wdmd | |
239 | fi | |
240 | ||
95ab4ed0 JB |
241 | %postun |
242 | if [ "$1" = "0" ]; then | |
243 | %userremove sanlock | |
244 | %groupremove sanlock | |
245 | fi | |
246 | ||
51fef094 JB |
247 | %post -n fence-sanlock |
248 | /sbin/chkconfig --add fence_sanlock | |
249 | %service fence_sanlock restart | |
250 | if [ "$1" = "1" ]; then | |
251 | ccs_update_schema >/dev/null 2>&1 || : | |
252 | fi | |
253 | ||
254 | %preun -n fence-sanlock | |
255 | if [ "$1" = "0" ]; then | |
256 | %service -q fence_sanlock stop | |
257 | /sbin/chkconfig --del fence_sanlock | |
258 | fi | |
259 | ||
a2f4ba26 JB |
260 | %post libs -p /sbin/ldconfig |
261 | %postun libs -p /sbin/ldconfig | |
262 | ||
263 | %files | |
264 | %defattr(644,root,root,755) | |
265 | %doc README.license | |
266 | %attr(755,root,root) %{_sbindir}/sanlock | |
267 | %attr(755,root,root) %{_sbindir}/wdmd | |
268 | %attr(754,root,root) /etc/rc.d/init.d/sanlock | |
269 | %attr(754,root,root) /etc/rc.d/init.d/wdmd | |
51fef094 JB |
270 | %{systemdunitdir}/sanlock.service |
271 | %{systemdunitdir}/wdmd.service | |
272 | %{systemdtmpfilesdir}/sanlock.conf | |
95ab4ed0 | 273 | %attr(775,sanlock,sanlock) %dir /var/run/sanlock |
51fef094 | 274 | %attr(775,root,sanlock) %dir /var/run/wdmd |
a2f4ba26 JB |
275 | %{_mandir}/man8/sanlock.8* |
276 | %{_mandir}/man8/wdmd.8* | |
277 | ||
51fef094 JB |
278 | %files reset |
279 | %defattr(644,root,root,755) | |
280 | %attr(755,root,root) %{_sbindir}/sanlk-reset | |
281 | %attr(755,root,root) %{_sbindir}/sanlk-resetd | |
282 | %{systemdunitdir}/sanlk-resetd.service | |
283 | %{_mandir}/man8/sanlk-reset.8* | |
284 | %{_mandir}/man8/sanlk-resetd.8* | |
285 | ||
286 | %files -n fence-sanlock | |
287 | %defattr(644,root,root,755) | |
288 | %attr(755,root,root) %{_sbindir}/fence_sanlock | |
289 | %attr(755,root,root) %{_sbindir}/fence_sanlockd | |
290 | %attr(754,root,root) /etc/rc.d/init.d/fence_sanlockd | |
291 | %{systemdunitdir}/fence_sanlockd.service | |
292 | %{systemdtmpfilesdir}/fence_sanlock.conf | |
293 | %dir /var/run/fence_sanlock | |
294 | %dir /var/run/fence_sanlockd | |
295 | %{_mandir}/man8/fence_sanlock.8* | |
296 | %{_mandir}/man8/fence_sanlockd.8* | |
297 | ||
a2f4ba26 JB |
298 | %files libs |
299 | %defattr(644,root,root,755) | |
300 | %attr(755,root,root) %{_libdir}/libsanlock.so.*.* | |
301 | %attr(755,root,root) %ghost %{_libdir}/libsanlock.so.1 | |
302 | %attr(755,root,root) %{_libdir}/libsanlock_client.so.*.* | |
303 | %attr(755,root,root) %ghost %{_libdir}/libsanlock_client.so.1 | |
304 | %attr(755,root,root) %{_libdir}/libwdmd.so.*.* | |
305 | %attr(755,root,root) %ghost %{_libdir}/libwdmd.so.1 | |
306 | ||
307 | %files devel | |
308 | %defattr(644,root,root,755) | |
309 | %attr(755,root,root) %{_libdir}/libsanlock.so | |
310 | %attr(755,root,root) %{_libdir}/libsanlock_client.so | |
311 | %attr(755,root,root) %{_libdir}/libwdmd.so | |
312 | %{_includedir}/sanlock*.h | |
313 | %{_includedir}/wdmd.h | |
51fef094 JB |
314 | %{_pkgconfigdir}/libsanlock.pc |
315 | %{_pkgconfigdir}/libsanlock_client.pc | |
a2f4ba26 | 316 | |
95761a51 | 317 | %if %{with python2} |
a2f4ba26 JB |
318 | %files -n python-sanlock |
319 | %defattr(644,root,root,755) | |
320 | %attr(755,root,root) %{py_sitedir}/sanlock.so | |
51fef094 | 321 | %{py_sitedir}/sanlock_python-%{version}_-py*.egg-info |
95761a51 JB |
322 | %endif |
323 | ||
324 | %if %{with python3} | |
325 | %files -n python3-sanlock | |
326 | %defattr(644,root,root,755) | |
327 | %attr(755,root,root) %{py3_sitedir}/sanlock.cpython-*.so | |
328 | %{py3_sitedir}/sanlock_python-%{version}_-py*.egg-info | |
329 | %endif |