forked from Seagate/cortx-motr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cortx-motr.spec.in
400 lines (349 loc) · 11.1 KB
/
cortx-motr.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
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
# TODO investigate why it's needed on aarch64
%ifarch aarch64
%undefine _missing_build_ids_terminate_build
%endif
# feature flags
%bcond_with ut
%bcond_with debuginfo_sources
%bcond_with cassandra
%bcond_with ivt
#user mode only
%bcond_with usermode
# configure options
%define with_linux %( test -n "$kernel_src" && echo "--with-linux=$kernel_src" )
# kernel version.
%define raw_kernel_ver %(
if test -n "$kernel_src"; then
basename $(readlink -f "$kernel_src")
else
uname -r
fi
)
%if %{with usermode}
%define with_lustre %( echo "--with-lustre=no" )
%define kernel_ver %( echo "" )
%else
%define with_lustre %( test -n "$lustre_src" && echo "--with-lustre=$lustre_src" )
%define kernel_ver _%( echo %{raw_kernel_ver} | tr - _ | sed -e 's/\.debug$//' -e 's/\.%{_arch}$//' -e 's/\.%{?dist:-el7}$//' -e 's/\.el7$//' )
%endif
%define kernel_ver_requires %( echo %{raw_kernel_ver} | sed -e 's/\.debug$//' -e 's/\.%{_arch}$//' )
# build number
%define build_num %( test -n "$build_number" && echo "$build_number" || echo 1 )
%define lustre lustre-client
%define lustre_devel lustre-client-devel
# workaround issue with motr-debuginfo package, which injects incorrect
# dependencies on itself into motr package when internal deps generator is used;
# that prevents a correct installation of any of the built motr packages without
# using '--no-deps' option
%global _use_internal_dependency_generator 0
%define _use_internal_dependency_generator 0
# configure options
%define configure_release_opts --enable-release --with-trace-kbuf-size=256 --with-trace-ubuf-size=16
%define configure_ut_opts --enable-dev-mode --disable-altogether-mode
%if %{with cassandra}
%define configure_cassandra_opts --with-cassandra
%endif
%if %{with usermode}
%define configure_user_opts --with-user-mode-only=yes --with-lustre=no --with-default-transport=LF
%endif
%if %{with ivt} || %{with ut}
%define configure_opts %{configure_ut_opts} %{?configure_user_opts} %{?configure_cassandra_opts} @BUILD_DEPEND_DTM@
%else
%define configure_opts %{configure_release_opts} %{?configure_user_opts} %{?configure_cassandra_opts} @BUILD_DEPEND_DTM@
%endif
Name: @PACKAGE@
Version: @PACKAGE_VERSION@
Release: %{build_num}_@GIT_REV_ID_RPM@%{kernel_ver}%{?dist}
Summary: CORTX Motr
Group: System Environment/Base
License: Seagate
Source: %{name}-%{version}.tar.gz
ExcludeArch: i686
Provides: %{name}-libs = %{version}-%{release}
Provides: %{name}-modules = %{version}-%{release}
# backward compatibility with legacy product name:
Obsoletes: mero
Obsoletes: eos-core
Provides: motr = %{version}-%{release}
Provides: motr(%{_arch}") = %{version}-%{release}
Provides: motr-libs = %{version}-%{release}
Provides: motr-modules = %{version}-%{release}
BuildRequires: automake
BuildRequires: autoconf
BuildRequires: libtool
BuildRequires: make
BuildRequires: gcc
BuildRequires: gcc-c++
%if %{rhel} < 8
%if "%{_arch}" == "aarch64"
# castxml rpm is not available on rhel 7,
# it must be built and installed manually.
# BuildRequires: castxml
%else
BuildRequires: gccxml
%endif
%else
BuildRequires: castxml
%endif
BuildRequires: glibc-headers
BuildRequires: asciidoc
BuildRequires: libyaml-devel
BuildRequires: libaio-devel
BuildRequires: perl
BuildRequires: perl-XML-LibXML
BuildRequires: perl-List-MoreUtils
BuildRequires: perl-File-Find-Rule
BuildRequires: perl-IO-All
BuildRequires: perl-File-Slurp
BuildRequires: perl-YAML-LibYAML
%if !%{with usermode}
BuildRequires: kernel-devel = %{kernel_ver_requires}
BuildRequires: %{lustre_devel}
%endif
BuildRequires: libuuid-devel
BuildRequires: openssl
BuildRequires: openssl-devel
BuildRequires: binutils-devel
%if %{rhel} < 8
BuildRequires: python36-ply
%else
BuildRequires: python3-ply
%endif
BuildRequires: perl-autodie
BuildRequires: systemd-devel
%if %{rhel} < 8
BuildRequires: python-devel
%else
# @todo Deprecate python2
#BuildRequires: python2-devel
BuildRequires: python3-devel
%endif
@BUILD_DEPEND_LIBFAB@
BuildRequires: libedit-devel
BuildRequires: isa-l
%if %{with cassandra}
BuildRequires: libcassandra
BuildRequires: libuv
%endif
%if !%{with usermode}
Requires: kernel = %{kernel_ver_requires}
Requires: %{lustre}
%endif
Requires: libaio
Requires: libyaml
#Supported openssl versions -- CentOS 7 its 1.0.2k, RHEL8 its 1.1.1
Requires: openssl
Requires: genders
%if %{rhel} < 8
Requires: sysvinit-tools
%endif
Requires: attr
Requires: perl
Requires: perl-YAML-LibYAML
Requires: perl-DateTime
Requires: perl-File-Which
Requires: perl-List-MoreUtils
Requires: perl-autodie
Requires: perl-Try-Tiny
Requires: perl-Sereal
Requires: perl-MCE
%if %{rhel} < 8
Requires: python36-ply
%else
Requires: python3-ply
%endif
Requires: libedit
Requires: isa-l
Requires(pre): shadow-utils
Requires(post): findutils
%description
CORTX Motr runtime
%package devel
Summary: CORTX Motr include headers
Group: Development/Kernel
Provides: %{name}-devel = %{version}-%{release}
# backward compatibility with legacy product name:
Obsoletes: mero-devel
Obsoletes: eos-core-devel
Provides: motr-devel = %{version}-%{release}
Requires: binutils-devel
Requires: libyaml-devel
Requires: libaio-devel
Requires: libuuid-devel
Requires: pkgconfig
Requires: systemd-devel
Requires: glibc-headers
%if !%{with usermode}
Requires: kernel-devel = %{kernel_ver_requires}
Requires: %{lustre_devel}
%endif
%description devel
Header files that are required to link with CORTX Motr libraries.
%if %{with ut}
%package tests-ut
Summary: CORTX Motr unit tests
Group: Development/Kernel
Conflicts: %{name}
%description tests-ut
CORTX Motr unit tests (for kernel and user space).
%endif # with ut
%if %{with ivt}
%package ivt
Summary: CORTX Motr IVT
Group: Development/Kernel
%description ivt
CORTX Motr IVT.
%endif # with ivt
%prep
%setup -q
%build
%ifarch x86_64
%configure %{with_linux} %{with_lustre} %{configure_opts}
%endif
%ifarch aarch64
%configure %{with_linux} %{with_lustre} %{configure_opts} enable_castxml=yes
%endif
%if !%{with ivt}
make %{?_smp_mflags}
%endif
%install
rm -rf %{buildroot}
%if %{with ivt}
make DESTDIR=%{buildroot} install-ivt
find %{buildroot} \
-name m0workload \
-o -name create_workload_from_excel \
-o -name sample_workload_excel_test.xls \
-o -name mix_workload.yaml \
-o -name m0crate_workload_batch_1_file1.yaml |
sed -e 's#^%{buildroot}##' >> ivt.files
sort -o ivt.files ivt.files
find %{buildroot} -type f | sed -e 's#^%{buildroot}##' | sort |
comm -13 ivt.files - | sed -e 's#^#%{buildroot}#' > ivt.exclude
%else
%if %{with ut}
make DESTDIR=%{buildroot} install-tests
find %{buildroot} -name m0tr.ko -o -name m0ut.ko -o \
| sed -e 's#^%{buildroot}##' > tests-ut.files
find %{buildroot} \
-name m0ut \
-o -name m0ut-isolated \
-o -name m0ub \
-o -name m0run \
-o -name m0gentestds \
-o -name 'm0kut*' \
-o -name 'libtestlib*.so*' \
-o -name 'libmotr*.so*' |
sed -e 's#^%{buildroot}##' >> tests-ut.files
sort -o tests-ut.files tests-ut.files
find %{buildroot} -type f -o -type l | sed -e 's#^%{buildroot}##' | sort |
comm -13 tests-ut.files - | sed -e 's#^#%{buildroot}#' > tests-ut.exclude
xargs -a tests-ut.exclude rm -rv
%else
make DESTDIR=%{buildroot} install
find %{buildroot} -name 'm0ff2c' -o \
-name 'm0gccxml2xcode*' |
sed -e 's#^%{buildroot}##' -e 's/\.1$/.1.gz/' > devel.files
find %{buildroot} -name 'libmotr-xcode-ff2c*.so*' | sed -e 's#^%{buildroot}##' >> devel.files
find %{buildroot} -name '*.la' | sed -e 's#^%{buildroot}##' >> devel.files
find %{buildroot}%{_includedir} | sed -e 's#^%{buildroot}##' >> devel.files
find %{buildroot}%{_libdir} -name motr.pc | sed -e 's#^%{buildroot}##' >> devel.files
mkdir -p %{buildroot}%{_localstatedir}/motr
%endif # with ut
%endif # with ivt
# Remove depmod output - it is regenerated during %post
if [ -e %{buildroot}/lib/modules/%{raw_kernel_ver}/modules.dep ]; then
rm %{buildroot}/lib/modules/%{raw_kernel_ver}/modules.*
fi
%files
%if !%{with ivt} && !%{with ut}
%doc AUTHORS NEWS ChangeLog COPYING
%{_bindir}/*
%{_sbindir}/*
%{_libdir}/*
%{_libexecdir}/%{name}/*
%{_exec_prefix}/lib/debug/*
%{_exec_prefix}/lib/systemd/*
%{_exec_prefix}/lib/udev/*
%{_datadir}/*
%{_mandir}/*
%attr(0770, motr, motr) %{_localstatedir}/motr
%config %attr(0664, motr, motr) %{_sysconfdir}/sysconfig/*
%config %attr(0755, root, root) %{_sysconfdir}/cron.hourly/m0trace*
%config %attr(0755, root, root) %{_sysconfdir}/cron.hourly/m0addb*
%config %attr(0755, root, root) %{_sysconfdir}/cron.hourly/motr_mini_prov*
%{_sysconfdir}/systemd/system/*
%{_sysconfdir}/security/limits.d/90-motr.conf
/opt/seagate/cortx/motr/*
%if !%{with usermode}
/lib/modules/*/kernel/fs/motr/*
%endif
%exclude %{_bindir}/m0gentestds
%exclude %{_bindir}/m0gccxml2xcode
%exclude %{_bindir}/m0kut*
%exclude %{_bindir}/m0ut*
%exclude %{_bindir}/m0ub
%exclude %{_bindir}/m0ff2c
%exclude %{_sbindir}/m0run
%exclude %{_libdir}/*.la
%exclude %{_libdir}/libmotr-ut*
%exclude %{_libdir}/libtestlib*
%exclude %{_libdir}/libmotr-xcode-ff2c*
%exclude %{_libdir}/pkgconfig/
%exclude %{_mandir}/**/m0gccxml2xcode*
%if !%{with usermode}
%exclude /lib/modules/*/kernel/fs/motr/m0lnet*
%exclude /lib/modules/*/kernel/fs/motr/m0net*
%exclude /lib/modules/*/kernel/fs/motr/m0rpc*
%exclude /lib/modules/*/kernel/fs/motr/m0ut*
%endif
%exclude /usr/bin/workload*
%endif
%if %{with ivt}
%files ivt -f ivt.files
%else
%if %{with ut}
%files tests-ut -f tests-ut.files
%else
%files devel -f devel.files
%endif # with ut
%endif # with ivt
# See 'post' section comment about '-e' argument.
%pre -e
# Guidelings for user/group creation in Fedora:
# https://fedoraproject.org/wiki/Packaging:UsersAndGroups?rd=Packaging/UsersAndGroups
getent group motr >/dev/null || groupadd --system motr
getent passwd motr >/dev/null || useradd --system --shell /sbin/nologin \
--no-user-group --gid motr --home-dir / --comment 'Motr daemon' motr
# The '-e' argument enables runtime macro expansion for this particular script.
# Also note that macros have to be escaped using %% and not %, otherwise it
# would be expanded at build-time.
# See http://rpm.org/user_doc/scriptlet_expansion.html for more info.
%post -e
/sbin/depmod -a
systemctl daemon-reload
if [ x%%{?no_trace_logs} != x ] ; then
/bin/sed -i -r -e "s/(MOTR_TRACED_KMOD=)yes/\1no/" /etc/sysconfig/motr
/bin/sed -i -r -e "s/(MOTR_TRACED_M0D=)yes/\1no/" /etc/sysconfig/motr
fi
# when doing an upgrade
if [ $1 -eq 2 ] ; then
echo "Upgrading %{_localstatedir}/motr group and permissions"
find %{_localstatedir}/motr ! -group motr -exec chown :motr '{}' \; -exec chmod g+w,o-rwx '{}' \;
fi
%postun
/sbin/depmod -a
systemctl daemon-reload
%if %{with ivt}
%post ivt
/sbin/depmod -a
%postun ivt
/sbin/depmod -a
%else
%if %{with ut}
%post tests-ut
/sbin/depmod -a
%postun tests-ut
/sbin/depmod -a
%endif # with ut
%endif # with ivt