File mariadb.spec of Package mariadb
850
1
#
2
# spec file for package mariadb
3
#
4
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
5
#
6
# All modifications and additions to the file contributed by third parties
7
# remain the property of their copyright owners, unless otherwise agreed
8
# upon. The license for this file, and modifications and additions to the
9
# file, is the same license as for the pristine package itself (unless the
10
# license for the pristine package is not an Open Source License, in which
11
# case the license is the MIT License). An "Open Source License" is a
12
# license that conforms to the Open Source Definition (Version 1.9)
13
# published by the Open Source Initiative.
14
15
# Please submit bugfixes or comments via http://bugs.opensuse.org/
16
#
17
18
19
# libmysqld soname
20
%define soname 19
21
# Used in Provides/Obsoletes for mariadb, test, tools, bench and
22
# errormessages subpackages to ensure a smooth transition from SLE12
23
# to SLE15 [fate#323756]
24
%define extra_provides mariadb-102
25
# Set this to 1 to run regression test suite (it takes a long time)
26
%define run_testsuite 1
27
# Set this to 1 for testing purposes (run all regression tests but ignore
28
# failures). Set this to 0 for production usage (skip tests in the
29
# unstable-tests list (contains also suse_skipped_tests.list) and don't
30
# ignore failures
31
%define ignore_testsuite_result 0
32
# OQGRAPH engine cannot be built for SLE (missing Judy dependency)
33
%if 0%{?is_opensuse} > 0
34
%define with_oqgraph 1
35
%else
36
%define with_oqgraph 0
37
%endif
38
# TokuDB engine is available only for x86_64 architecture
39
# see https://mariadb.com/kb/en/mariadb/tokudb/
40
# Temporarily stop to build it as jemalloc 5 is not backwards compatible
41
# and a build without jemalloc is not supported upstream (MDEV-15034)
42
%define with_tokudb 0
43
# Mroonga currently only supports the x86_64 architecture
44
# see https://mariadb.com/kb/en/mariadb/about-mroonga/
45
%ifarch x86_64
46
%define with_mroonga 1
47
%else
48
%define with_mroonga 0
49
%endif
50
Name: mariadb
51
Version: 10.2.15
52
Release: 0
53
Summary: Server part of MariaDB
54
License: SUSE-GPL-2.0-with-FLOSS-exception
55
Group: Productivity/Databases/Servers
56
Url: https://www.mariadb.org
57
Source: https://downloads.mariadb.org/f/mariadb-%{version}/source/mariadb-%{version}.tar.gz
58
Source1: %{name}-%{version}.tar.gz.sig
59
Source2: %{name}.keyring
60
Source4: README.debug
61
Source5: suse-test-run
62
Source6: mysql.SuSEfirewall2
63
Source7: README.install
64
Source14: my.ini
65
Source15: mariadb.service
66
Source16: mariadb.target
67
Source17: mysql-systemd-helper
68
Source18: mariadb@.service
69
Source50: suse_skipped_tests.list
70
Patch0: mysql-community-server-5.1.45-multi-configuration.patch
71
Patch1: mariadb-10.2.4-logrotate.patch
72
Patch2: mariadb-5.5.28-install_db-quiet.patch
73
Patch3: mariadb-10.1.1-mysqld_multi-features.patch
74
Patch4: mariadb-5.2.3-cnf.patch
75
Patch6: mariadb-10.1.12-deharcode-libdir.patch
76
Patch7: mariadb-10.0.15-logrotate-su.patch
77
Patch8: mariadb-10.2.4-fortify-and-O.patch
78
Patch11: mariadb-10.2.9-galera_cnf.patch
79
BuildRequires: bison
80
BuildRequires: cmake
81
BuildRequires: dos2unix
82
BuildRequires: fdupes
83
BuildRequires: gcc-c++
84
BuildRequires: krb5-devel
85
BuildRequires: libaio-devel
86
BuildRequires: libarchive-devel
87
BuildRequires: libbz2-devel
88
BuildRequires: libevent-devel
89
BuildRequires: libtool
90
BuildRequires: libxml2-devel
91
BuildRequires: ncurses-devel
92
BuildRequires: openssl-devel
93
BuildRequires: pam-devel
94
# MariaDB requires a specific version of pcre. Provide MariaDB with
95
# "BuildRequires: pcre-devel" and it automatically decides if the version is
96
# ok or not. If not, it uses bundled pcre.
97
BuildRequires: pcre-devel
98
BuildRequires: pkgconfig
99
BuildRequires: procps
100
BuildRequires: pwdutils
101
BuildRequires: sqlite
102
BuildRequires: tcpd-devel
103
# Tests requires time and ps and some perl modules
104
# Keep in sync with Requires of mysql-testsuite
105
BuildRequires: time
106
BuildRequires: unixODBC-devel
107
BuildRequires: zlib-devel
108
BuildRequires: perl(Data::Dumper)
109
BuildRequires: perl(Env)
110
BuildRequires: perl(Exporter)
111
BuildRequires: perl(Fcntl)
112
BuildRequires: perl(File::Temp)
113
BuildRequires: perl(Getopt::Long)
114
BuildRequires: perl(IPC::Open3)
115
BuildRequires: perl(Socket)
116
BuildRequires: perl(Sys::Hostname)
117
BuildRequires: perl(Test::More)
118
BuildRequires: perl(Time::HiRes)
119
# Do not ever switch away from BuildRequires: pkgconfig(libsystemd); BuildRequires systemd/systemd-devel causes build cycles
120
BuildRequires: pkgconfig(libsystemd)
121
# Required by rcmysql
122
Requires: %{name}-client
123
Requires: %{name}-errormessages = %{version}
124
# Requires /bin/hostname because otherwise we have a conflict on Leap (bsc#1009905).
125
# It can be switched back to plain "hostname" when this bug is resolved
126
Requires: /bin/hostname
127
Requires: perl-base
128
Requires(pre): pwdutils
129
Recommends: logrotate
130
Conflicts: otherproviders(mariadb-server)
131
Conflicts: otherproviders(mysql)
132
Conflicts: otherproviders(mysql-debug)
133
Conflicts: otherproviders(mysql-server)
134
# Compatibility with Fedora/CentOS
135
Provides: mariadb-server = %{version}
136
Provides: mysql-server = %{version}
137
# Compatibility with old version
138
Provides: %{name}-debug-version = %{version}
139
Obsoletes: %{name}-debug-version < %{version}
140
Provides: %{name}-debug = %{version}
141
Obsoletes: %{name}-debug < %{version}
142
Provides: mysql = %{version}
143
Obsoletes: mysql < %{version}
144
Provides: mysql-debug = %{version}
145
Obsoletes: mysql-debug < %{version}
146
Provides: %{extra_provides} = %{version}
147
Obsoletes: %{extra_provides} < %{version}
148
Provides: %{extra_provides}-debug-version = %{version}
149
Obsoletes: %{extra_provides}-debug-version < %{version}
150
%{?systemd_requires}
151
# Do not BuildRequires lzo for i586 and arm
152
# https://lists.launchpad.net/maria-discuss/msg04639.html
153
%ifnarch i586 %{arm}
154
BuildRequires: lzo-devel
155
%endif
156
# We want readline5 for openSUSE and libedit for SLE12
157
%if ( 0%{?suse_version} == 1315 ) && ( ! 0%{?is_opensuse} )
158
BuildRequires: libedit-devel
159
%else
160
BuildRequires: readline5-devel
161
%endif
162
%if 0%{with_oqgraph} > 0
163
BuildRequires: judy-devel
164
%if 0%{?suse_version} > 1315
165
BuildRequires: libboost_headers-devel
166
%else
167
BuildRequires: boost-devel
168
%endif
169
%endif
170
%if 0%{with_tokudb} > 0
171
BuildRequires: jemalloc-devel
172
%endif
173
174
%description
175
MariaDB is an open-source, multi-threaded, relational database management
176
system. It's a backward compatible, drop-in replacement branch of the
177
MySQL Community Server.
178
179
This package only contains the server-side programs.
180
181
%package -n libmysqld%{soname}
182
Summary: MariaDB embedded server library
183
Group: System/Libraries
184
Requires: %{name}-errormessages >= %{version}
185
186
%description -n libmysqld%{soname}
187
This package contains MariaDB library that allows to run an embedded
188
MariaDB server inside a client application.
189
190
%package -n libmysqld-devel
191
Summary: MariaDB embedded server development files
192
Group: Development/Libraries/C and C++
193
Requires: libaio-devel
194
# The headers files are the shared
195
Requires: libmariadb-devel >= 3.0
196
Requires: libmysqld%{soname} = %{version}
197
Requires: tcpd-devel
198
199
%description -n libmysqld-devel
200
This package contains the development header files and libraries
201
for developing applications that embed the MariaDB.
202
203
%package client
204
Summary: Client for MariaDB
205
Group: Productivity/Databases/Clients
206
Requires: %{name}-errormessages = %{version}
207
# Explicit requires to pull in charsets for errormessages
208
Requires: libmariadb3 >= 3.0
209
Requires(pre): pwdutils
210
Conflicts: otherproviders(mysql-client)
211
Provides: mysql-client = %{version}
212
Obsoletes: mysql-client < %{version}
213
Provides: %{extra_provides}-client = %{version}
214
Obsoletes: %{extra_provides}-client < %{version}
215
216
%description client
217
This package contains the standard clients for MariaDB.
218
219
%package galera
220
Summary: The configuration files and scripts for galera replication
221
Group: Productivity/Databases/Tools
222
Requires: %{name} = %{version}
223
# galera-3 is not in openSUSE:Factory now
224
#Requires: galera-3 >= 25.3.18
225
Requires: iproute2
226
Requires: lsof
227
Requires: rsync
228
Requires: socat
229
Requires: which
230
Requires: xtrabackup
231
# We need Conflicts here as galera_new_cluster (and use_galera_new_cluster.conf)
232
# and galera_recovery scripts were in mariadb package but now they are in galera
233
# subpackage
234
Conflicts: mariadb <= 10.1.25
235
# wsrep_* scripts were in mariadb-tools subpackage but now they are in galera subpackage
236
Conflicts: mariadb-tools <= 10.1.25
237
238
%description galera
239
This package contains configuration files and scripts that are
240
needed for running MariaDB Galera Cluster.
241
242
%package errormessages
243
Summary: The error messages files required by server, client and libmysqld
244
Group: System/Localization
245
BuildArch: noarch
246
Provides: %{extra_provides}-errormessages = %{version}
247
Obsoletes: %{extra_provides}-errormessages < %{version}
248
249
%description errormessages
250
This package provides translated error messages for the standalone
251
server daemon, embedded server and client.
252
253
%package bench
254
Summary: Benchmarks for MariaDB
255
Group: Productivity/Databases/Tools
256
Requires: %{name}-client
257
Requires: perl-DBD-mysql
258
Conflicts: otherproviders(mysql-bench)
259
Provides: mysql-bench = %{version}
260
Obsoletes: mysql-bench < %{version}
261
Provides: %{extra_provides}-bench = %{version}
262
Obsoletes: %{extra_provides}-bench < %{version}
263
264
%description bench
265
This package contains benchmark scripts and data for MariaDB.
266
267
To run these database benchmarks, start the script "run-all-tests" in
268
the directory %{_datadir}/sql-bench after starting MariaDB.
269
270
%package test
271
Summary: Testsuite for MariaDB
272
Group: Productivity/Databases/Servers
273
Requires: %{name} = %{version}
274
Requires: %{name}-bench = %{version}
275
Requires: %{name}-client = %{version}
276
Requires: %{name}-tools = %{version}
277
Requires: perl-DBD-mysql
278
Requires: procps
279
Requires: time
280
# Tests requires time and ps and some perl modules
281
Requires: perl(Data::Dumper)
282
Requires: perl(Env)
283
Requires: perl(Exporter)
284
Requires: perl(Fcntl)
285
Requires: perl(File::Temp)
286
Requires: perl(Getopt::Long)
287
Requires: perl(IPC::Open3)
288
Requires: perl(Socket)
289
Requires: perl(Sys::Hostname)
290
Requires: perl(Test::More)
291
Requires: perl(Time::HiRes)
292
Conflicts: otherproviders(mysql-test)
293
Provides: mysql-test = %{version}
294
Obsoletes: mysql-test < %{version}
295
Provides: %{extra_provides}-test = %{version}
296
Obsoletes: %{extra_provides}-test < %{version}
297
298
%description test
299
This package contains the test scripts and data for MariaDB.
300
301
To run the testsuite, run %{_datadir}/mysql-test/suse-test-run.
302
303
%package tools
304
Summary: MariaDB tools
305
Group: Productivity/Databases/Servers
306
Requires: perl-DBD-mysql
307
Conflicts: otherproviders(mysql-tools)
308
# make sure this package is installed when updating from 10.2 and older
309
Provides: mysql-client:%{_bindir}/perror
310
Provides: mysql-tools = %{version}
311
Provides: mysql:%{_bindir}/mysqlhotcopy
312
Obsoletes: mysql-tools < %{version}
313
Provides: %{extra_provides}-tools = %{version}
314
Obsoletes: %{extra_provides}-tools < %{version}
315
316
%description tools
317
A set of scripts for administering a MariaDB or developing
318
applications with MariaDB.
319
320
%prep
321
%setup -q
322
# Remove JAR files from the tarball (used for testing from the source)
323
find . -name "*.jar" -type f -exec rm --verbose -f {} \;
324
%patch0 -p0
325
%patch1 -p0
326
%patch2 -p0
327
%patch3 -p0
328
%patch4 -p0
329
%patch6 -p0
330
%patch7 -p0
331
%patch8 -p0
332
%patch11 -p1
333
334
cp %{_sourcedir}/suse-test-run .
335
336
# Remove unneeded manpages ('make install' basically installs everything under
337
# man/*)
338
rm -f man/mysqlman.1 # dummy fallback manpage
339
[ \! -f man/CMakeLists.txt ] || sed -i 's|mysqlman.1||' man/CMakeLists.txt
340
rm -f man/mysql.server.1 # init script, not installed in our rpm
341
[ \! -f man/CMakeLists.txt ] || sed -i 's|mysql.server.1||' man/CMakeLists.txt
342
rm -f man/make_win_*.1 # windows build scripts
343
rm -f man/comp_err.1 # built-time utility
344
345
# Breaks VPATH builds when in sourcedir, is generated in the builddirs
346
rm -f sql/sql_builtin.cc
347
348
sed -i 's|@localstatedir@|%{_localstatedir}/log|' support-files/mysql-log-rotate.sh
349
350
# Broken test that needs sources
351
rm -f mysql-test/t/file_contents.test mysql-test/r/file_contents.result
352
353
# Specify perl path on shebangs
354
for i in `grep -Rl '^#!@PERL@$' .`; do
355
sed -i 's|@PERL@|%{_bindir}/perl|' $i
356
done
357
358
# Add our list of tests that fail (correctly or temporarily) to the list of such
359
# tests created by upstream
360
cat %{SOURCE50} | tee -a mysql-test/unstable-tests
361
362
# Remove python scripts remains from tokudb upstream (those files are not used anyway)
363
rm -r storage/tokudb/mysql-test/tokudb/t/*.py
364
365
%build
366
EXTRA_FLAGS="-Wno-unused-but-set-variable -fno-strict-aliasing -Wno-unused-parameter"
367
# Mariadb devs seems to fall in love with -Werror option
368
EXTRA_FLAGS="${EXTRA_FLAGS} -Wno-error"
369
export CFLAGS="%{optflags} -DOPENSSL_LOAD_CONF -DPIC -fPIC -DFORCE_INIT_OF_VARS $EXTRA_FLAGS"
370
export CXXFLAGS="$CFLAGS -felide-constructors"
371
%cmake -DWITH_SSL=system \
372
-DWITH_LIBWRAP=ON \
373
-DENABLED_PROFILING=ON \
374
-DENABLE_DEBUG_SYNC=OFF \
375
-DWITH_PIC=ON \
376
-DWITH_ZLIB=system \
377
-DWITH_LIBEVENT=system \
378
-DWITH_JEMALLOC=no \
379
-DWITH_READLINE=0 \
380
-DWITH_LIBEDIT=0 \
381
-DWITH_EDITLINE=system \
382
-DINSTALL_LAYOUT=RPM \
383
-DWITH_LZ4=system \
384
-DMYSQL_UNIX_ADDR="%{_localstatedir}/run/mysql/mysql.sock" \
385
-DINSTALL_UNIX_ADDRDIR="%{_localstatedir}/run/mysql/mysql.sock" \
386
-DINSTALL_MYSQLSHAREDIR=share/%{name} \
387
-DWITH_COMMENT="openSUSE mariadb rpm" \
388
-DWITH_EXTRA_CHARSET=all \
389
-DDEFAULT_CHARSET=utf8mb4 \
390
-DDEFAULT_COLLATION=utf8mb4_general_ci \
391
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
392
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
393
%if 0%{with_oqgraph} < 1
394
-DWITHOUT_OQGRAPH=ON \
395
%endif
396
%if 0%{with_tokudb} < 1
397
-DWITHOUT_TOKUDB=ON \
398
%endif
399
%if 0%{with_mroonga} < 1
400
-DWITHOUT_MROONGA=ON \
401
%endif
402
-DWITH_XTRADB_STORAGE_ENGINE=1 \
403
-DWITH_CSV_STORAGE_ENGINE=1 \
404
-DWITH_HANDLERSOCKET_STORAGE_ENGINE=1 \
405
-DWITH_INNODB_MEMCACHED=ON \
406
-DWITH_EMBEDDED_SERVER=true \
407
-DWITH_WSREP=ON \
408
-DWITH_INNODB_DISALLOW_WRITES=1 \
409
-DWITH_LIBARCHIVE=ON \
410
-DWITH_MARIABACKUP=ON \
411
-DCOMPILATION_COMMENT="openSUSE package" \
412
-DDENABLE_DOWNLOADS=false \
413
-DINSTALL_PLUGINDIR_RPM="%{_lib}/mysql/plugin" \
414
-DINSTALL_LIBDIR_RPM="%{_lib}" \
415
-DINSTALL_SYSCONF2DIR="%{_sysconfdir}/my.cnf.d" \
416
-DCMAKE_C_FLAGS_RELWITHDEBINFO="$CFLAGS" \
417
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$CXXFLAGS" \
418
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
419
-DINSTALL_SQLBENCHDIR=share \
420
-DCMAKE_C_FLAGS="$CFLAGS" \
421
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
422
-DCMAKE_EXE_LINKER_FLAGS="-Wl,--as-needed -pie -Wl,-z,relro,-z,now" \
423
-DCMAKE_MODULE_LINKER_FLAGS="-Wl,--as-needed -pie -Wl,-z,relro,-z,now" \
424
-DCMAKE_SHARED_LINKER_FLAGS="-Wl,--as-needed -pie -Wl,-z,relro,-z,now" \
425
-DCMAKE_SKIP_RPATH=OFF \
426
-DCMAKE_SKIP_INSTALL_RPATH=ON \
427
-Wno-dev "$@" ..
428
make %{?_smp_mflags}
429
nm --numeric-sort sql/mysqld > sql/mysqld.sym
430
431
%install
432
# Helper function to generate filelist for binaries and their manpages
433
filelist()
434
{
435
echo '%%defattr(-, root, root)'
436
pushd %{buildroot} >/dev/null
437
for i; do
438
if test -e usr/sbin/"$i"; then
439
echo %{_sbindir}/"$i"
440
fi
441
if test -e usr/bin/"$i"; then
442
echo %{_bindir}/"$i"
443
fi
444
if test -d usr/share/*/"$i"; then
445
echo "/`echo usr/share/*/"$i"`"
446
fi
447
if test -n "`ls -1 %{buildroot}$i 2> /dev/null`"; then
448
echo "$i"
449
fi
450
if ls usr/share/man/*/"$i".[1-9]* >/dev/null 2>&1; then
451
echo "%{_mandir}/*/$i.[1-9]*"
452
fi
453
done
454
popd >/dev/null
455
}
456
457
# Install the package itself
458
%cmake_install benchdir_root=%{_datadir}/
459
460
# Logrotate file should be named as the package
461
if [ ! -e %{buildroot}%{_sysconfdir}/logrotate.d/mysql ]; then
462
# some versions do not install it automatically
463
install -D -m 644 build/support-files/mysql-log-rotate %{buildroot}%{_sysconfdir}/logrotate.d/mysql
464
fi
465
mv %{buildroot}%{_sysconfdir}/logrotate.d/mysql %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
466
467
# Create log directory with the expected perms of mysql
468
install -d -m 700 %{buildroot}%{_localstatedir}/log/mysql/
469
470
# Symbols from build to go into libdir
471
install -m 644 build/sql/mysqld.sym %{buildroot}%{_libdir}/mysql/mysqld.sym
472
473
# INFO_SRC binary
474
install -p -m 644 build/Docs/INFO_SRC %{buildroot}%{_libdir}/mysql/
475
476
# Remove most static libs (FIXME: don't build them at all...)
477
[ \! -f "%{buildroot}%{_libdir}/"libmysqld.a ] || mv "%{buildroot}%{_libdir}/"libmysqld.a "%{buildroot}%{_libdir}/"libmysqld.static
478
rm -f %{buildroot}%{_libdir}/*.a
479
[ \! -f "%{buildroot}%{_libdir}/"libmysqld.static ] || mv "%{buildroot}%{_libdir}/"libmysqld.static "%{buildroot}%{_libdir}/"libmysqld.a
480
481
# Remove unused stuff
482
rm -f %{buildroot}%{_datadir}/mysql/{errmsg-utf8.txt,mysql-log-rotate}
483
rm -f %{buildroot}%{_libdir}/mysql/plugin/daemon_example.ini
484
# binary-configure creates the MySQL system tables and starts the server (not used)
485
rm -f %{buildroot}%{_datadir}/mysql/binary-configure
486
# FS files first-bytes recoginiton (not updated by upstream since nobody realy use that)
487
rm -f %{buildroot}%{_datadir}/mysql/magic
488
# Upstream ships them because of MDEV-10797 (we don't need them as we use our own systemd scripts)
489
rm -f %{buildroot}%{_datadir}/mysql/mysql.server
490
rm -f %{buildroot}%{_datadir}/mysql/mysqld_multi.server
491
# The old fork of mytop utility (we ship it as a separate package)
492
rm -f %{buildroot}%{_bindir}/mytop
493
494
# Remove unused upstream services
495
rm -f %{buildroot}'%{_unitdir}/mariadb.service'
496
rm -f %{buildroot}'%{_unitdir}/mariadb@.service'
497
rm -f %{buildroot}'%{_unitdir}/mariadb@bootstrap.service.d/use_galera_new_cluster.conf'
498
499
# Remove systemd-sysusers conf file for creating of mysql user (we do it in the specfile)
500
rm -f %{buildroot}%{_sysusersdir}/sysusers.conf
501
502
# Remove debug management for keys Mariadb 101+
503
rm -f %{buildroot}%{_libdir}/mysql/plugin/debug_key_management.so
504
505
# Remove client libraries that are now provided in mariadb-connector-c
506
# Client library and links
507
rm %{buildroot}%{_libdir}/libmariadb*.so.*
508
unlink %{buildroot}%{_libdir}/libmysqlclient.so
509
unlink %{buildroot}%{_libdir}/libmysqlclient_r.so
510
unlink %{buildroot}%{_libdir}/libmariadb.so
511
# Client plugins
512
rm %{buildroot}%{_libdir}/mysql/plugin/{auth_gssapi_client.so,dialog.so,mysql_clear_password.so,sha256_password.so}
513
# Devel files
514
rm %{buildroot}%{_bindir}/mysql_config
515
rm %{buildroot}%{_bindir}/mariadb_config
516
rm %{buildroot}%{_datadir}/pkgconfig/mariadb.pc
517
rm %{buildroot}%{_datadir}/aclocal/mysql.m4
518
rm %{buildroot}%{_mandir}/man1/mysql_config*.1*
519
rm -r %{buildroot}%{_includedir}/mysql
520
521
# mysql-test includes my_safe_process executable that should be moved to /usr/bin
522
mv %{buildroot}%{_datadir}/mysql-test/lib/My/SafeProcess/my_safe_process %{buildroot}%{_bindir}
523
ln -s ../../../../../bin/my_safe_process %{buildroot}%{_datadir}/mysql-test/lib/My/SafeProcess/my_safe_process
524
525
# Rename the wsrep README so it corresponds with the other README names
526
cp Docs/README-wsrep Docs/README.wsrep
527
528
# Generate various filelists (binaries and manpages)
529
# mariadb.files
530
filelist mariabackup mbstream innochecksum mariadb-service-convert my_print_defaults myisam_ftdump myisamchk myisamlog myisampack mysql_fix_extensions mysql_install_db mysql_secure_installation mysql_upgrade mysqld mysqld_multi mysqld_safe mysqlbinlog mysqldumpslow resolve_stack_dump resolveip {m,}aria_chk {m,}aria_dump_log {m,}aria_ftdump {m,}aria_pack {m,}aria_read_log tokuft_logprint tokuft_logdump tokuftdump mysql_ldb sst_dump myrocks_hotbackup >mariadb.files
531
532
# mariadb-client.files
533
filelist mysql mysqladmin mysqlcheck mysqldump mysqlimport mysqlshow mysql_config_editor mysqld_safe_helper >mariadb-client.files
534
535
# Mysql has configuration file in _bindir
536
if [ -f scripts/mysqlaccess.conf ] ; then
537
install -m 640 scripts/mysqlaccess.conf %{buildroot}%{_sysconfdir}/mysqlaccess.conf
538
rm -f %{buildroot}%{_bindir}/mysqlaccess.conf
539
echo '%config(noreplace) %attr(0640, root, mysql) %{_sysconfdir}/mysqlaccess.conf' >> mariadb-client.files
540
fi
541
542
# mariadb-galera.files
543
filelist galera_new_cluster galera_recovery wsrep_sst_common wsrep_sst_mariabackup wsrep_sst_mysqldump wsrep_sst_rsync wsrep_sst_xtrabackup-v2 wsrep_sst_xtrabackup >mariadb-galera.files
544
545
# mariadb-bench.files
546
filelist mysqlslap >mariadb-bench.files
547
548
# mariadb-test.files
549
filelist mysql_client_test mysql_client_test_embedded mysql_waitpid mysqltest mysqltest_embedded >mariadb-test.files
550
551
# mariadb-tools.files
552
filelist msql2mysql mysql_plugin mysql_convert_table_format mysql_find_rows mysql_setpermission mysql_tzinfo_to_sql mysqlaccess mysqlhotcopy perror replace mysql_embedded >mariadb-tools.files
553
554
# All configuration files
555
echo '%{_datadir}/mysql/*.cnf' >> mariadb.files
556
557
# Special errormessages approach
558
echo '%%defattr(-, root, root)' > %{_builddir}/errormessages.files
559
pushd %{buildroot} >/dev/null
560
for f in usr/share/%{name}/*; do
561
if test -e $f/errmsg.sys; then
562
echo "%%dir /$f" >> %{_builddir}/errormessages.files
563
fi
564
done
565
echo %{_datadir}/%{name}/errmsg-utf8.txt >> %{_builddir}/errormessages.files
566
popd >/dev/null
567
mv %{_builddir}/errormessages.files mariadb-errormessages.files
568
569
# Files not installed by make install
570
# Some of the documentation we need to have installed
571
DOCS=(COPYING README.md EXCEPTIONS-CLIENT %{_sourcedir}/README.debug plugin/daemon_example/daemon_example.ini)
572
DOCDIR=%{buildroot}%{_defaultdocdir}/%{name}
573
install -d -m 755 ${DOCDIR}
574
for i in "${DOCS[@]}"; do
575
install -m 644 "${i}" "${DOCDIR}" || true
576
done
577
578
# Install default configuration file
579
install -m 664 %{SOURCE14} %{buildroot}%{_sysconfdir}/my.cnf
580
581
# Systemd/initscript
582
install -D -m 755 %{_sourcedir}/mysql-systemd-helper '%{buildroot}'%{_libexecdir}/mysql/mysql-systemd-helper
583
sed -i 's|@MYSQLVER@|%{version}|' '%{buildroot}'%{_libexecdir}/mysql/mysql-systemd-helper
584
ln -sf service '%{buildroot}'%{_sbindir}/rcmysql
585
rm -rf '%{buildroot}'%{_sysconfdir}/init.d
586
install -D -m 644 %{_sourcedir}/mariadb.service '%{buildroot}'%{_unitdir}/mariadb.service
587
install -D -m 644 %{_sourcedir}/mariadb@.service '%{buildroot}'%{_unitdir}/mariadb@.service
588
install -D -m 644 %{_sourcedir}/mariadb.target '%{buildroot}'%{_unitdir}/mariadb.target
589
# Aliases for the backward compatibility. Create symlinks from the alias to the existing one
590
# We can't use 'Alias=' option only because it's effective only when the unit is enabled
591
ln -sf %{_unitdir}/mariadb.service %{buildroot}%{_unitdir}/mysql.service
592
ln -sf %{_unitdir}/mariadb@.service %{buildroot}%{_unitdir}/mysql@.service
593
594
# Rename systemd-tmpfiles conf file because each systemd-tmpfiles file shall be named in the style of package.conf or package-part.conf
595
mv %{buildroot}%{_tmpfilesdir}/tmpfiles.conf %{buildroot}%{_tmpfilesdir}/mariadb.conf
596
597
# Tmpfiles file to exclude mysql tempfiles that are auto-cleaned up
598
# bnc#852451
599
mkdir -p %{buildroot}%{_tmpfilesdir}
600
cat >> %{buildroot}%{_tmpfilesdir}/mariadb.conf <<EOF
601
x %{_localstatedir}/tmp/mysql.*
602
EOF
603
604
# SuSEfirewall service description
605
install -D -m 644 %{_sourcedir}/mysql.SuSEfirewall2 %{buildroot}%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/mysql
606
607
# Testsuite
608
install -d -m 755 '%{buildroot}'%{_datadir}/mysql-test/
609
install -m 755 suse-test-run '%{buildroot}'%{_datadir}/mysql-test/
610
mkdir '%{buildroot}'%{_datadir}/mysql-test%{_localstatedir}
611
612
# Install the list of skipped tests to be available for user runs
613
install -p -m 0644 mysql-test/unstable-tests %{buildroot}%{_datadir}/mysql-test
614
ln -s unstable-tests %{buildroot}%{_datadir}/mysql-test/suse_skipped_tests.list
615
616
# Final fixes
617
find '%{buildroot}'%{_datadir}/mysql-test -name '*.orig' -delete
618
%fdupes -s '%{buildroot}'%{_datadir}/mysql-test
619
fdupes -q -n -r '%{buildroot}'%{_datadir}/mysql-test
620
for i in `grep -Rl '\r' '%{buildroot}'%{_datadir}/sql-bench`; do
621
dos2unix "$i"
622
done
623
624
# Compat with old scripts
625
ln -s mysqlcheck '%{buildroot}'%{_bindir}/mysqlrepair
626
ln -s mysqlcheck '%{buildroot}'%{_bindir}/mysqlanalyze
627
ln -s mysqlcheck '%{buildroot}'%{_bindir}/mysqloptimize
628
629
# Use our configuration stuff instead of upstream one
630
rm -rf '%{buildroot}'%{_sysconfdir}/my.cnf.d
631
install -d -m 755 '%{buildroot}'%{_sysconfdir}/my.cnf.d
632
633
# Install galera config file and script
634
install -p -m 644 build/support-files/wsrep.cnf %{buildroot}%{_sysconfdir}/my.cnf.d/50-galera.cnf
635
install -p -m 755 build/scripts/galera_new_cluster %{buildroot}%{_bindir}/galera_new_cluster
636
637
# Documentation that was copied to wrong folder
638
rm -f '%{buildroot}'%{_datadir}/doc/* 2> /dev/null || true
639
640
# Unwanted packaged stuff
641
rm -rf '%{buildroot}'%{_datadir}/mysql/{solaris,SELinux}
642
643
# Create the directory specified in 'secure-file-priv' option
644
mkdir -p '%{buildroot}'%{_localstatedir}/lib/mysql-files
645
646
%check
647
cd build
648
649
# Run an extensive mysql test suite
650
# If 0%{ignore_testsuite_result} == 1 then run all tests but ignore failures
651
# If 0%{ignore_testsuite_result} == 0 then skip tests listed in unstable-tests
652
# (contains suse_skipped_tests.list) and don't ignore failures
653
654
%if 0%{run_testsuite} > 0
655
cd mysql-test
656
./mysql-test-run.pl \
657
--parallel=%{?jobs:%{jobs}} \
658
--force \
659
--retry=0 \
660
--ssl \
661
--suite-timeout=720 \
662
--testcase-timeout=30 \
663
--mysqld=--binlog-format=mixed \
664
--force-restart \
665
--shutdown-timeout=60 \
666
--max-test-fail=0 \
667
%if 0%{ignore_testsuite_result} > 0
668
|| :
669
%else
670
--skip-test-list=unstable-tests
671
%endif
672
%endif
673
674
# client does not require server and needs the user too
675
%pre client
676
getent group mysql >/dev/null || groupadd -r mysql
677
getent passwd mysql >/dev/null || useradd -r -o -g mysql -u 60 -c "MySQL database admin" \
678
-s /bin/false -d %{_localstatedir}/lib/mysql mysql
679
# if mysql user is not in mysql group or if mysql user doesn't have '/bin/false' shell set, do so
680
id -Gn mysql | grep '\bmysql\b' &>/dev/null || usermod -g mysql mysql
681
getent passwd mysql | cut -d: -f7 | grep '\b/bin/false\b' &>/dev/null || usermod -s /bin/false mysql
682
exit 0
683
684
%pre
685
getent group mysql >/dev/null || groupadd -r mysql
686
getent passwd mysql >/dev/null || useradd -r -o -g mysql -u 60 -c "MySQL database admin" \
687
-s /bin/false -d %{_localstatedir}/lib/mysql mysql
688
# if mysql user is not in mysql group or if mysql user doesn't have '/bin/false' shell set, do so
689
id -Gn mysql | grep '\bmysql\b' &>/dev/null || usermod -g mysql mysql
690
getent passwd mysql | cut -d: -f7 | grep '\b/bin/false\b' &>/dev/null || usermod -s /bin/false mysql
691
692
%service_add_pre mariadb.service
693
694
%post
695
%service_add_post mariadb.service
696
%tmpfiles_create %{_tmpfilesdir}/mariadb.conf
697
698
# SLE11 Migration support
699
for i in protected tmp; do
700
rmdir "$datadir"/.$i 2>/dev/null || :
701
done
702
703
# During package rename (migration maria->mysql-community-server),
704
# there might be config file move and we get rpmsave that we should keep
705
if [ -f %{_sysconfdir}/my.cnf.rpmsave ]; then
706
mv %{_sysconfdir}/my.cnf{,.rpmnew}
707
mv %{_sysconfdir}/my.cnf{.rpmsave,}
708
cat >> %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release}-something << EOF
709
710
WARNING: %{_sysconfdir}/my.cnf.rpmsave file detected!
711
712
This probably means that you are migrating from different variant of MySQL.
713
Your configuration was left intact and you can see the new configuration in
714
%{_sysconfdir}/my.cnf.rpmnew
715
716
EOF
717
fi
718
719
# Warn on first run
720
datadir="`%{_bindir}/my_print_defaults mysqld mysql_server | sed -n 's|--datadir=||p'`"
721
[ -n "$datadir" ] || datadir="%{_localstatedir}/lib/mysql"
722
if [ -d "$datadir/mysql" ]; then
723
touch "$datadir/.run-mysql_upgrade"
724
fi
725
if [ \! -f "$datadir/mysql_upgrade_info" ]; then
726
if [ $1 -eq 1 ]; then
727
cat >> %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release}-something << EOF
728
729
%(cat %{_sourcedir}/README.install)
730
731
EOF
732
fi
733
else
734
MYSQLVER="`echo %{version} | sed 's|\.[0-9]\+$||'`"
735
if [ -f "$datadir/mysql_upgrade_info" ] && \
736
[ -z "`grep "^$MYSQLVER" "$datadir/mysql_upgrade_info" 2> /dev/null`" ]; then
737
cat >> %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release}-something << EOF
738
739
WARNING: You are upgrading from different stable version of MySQL!
740
741
Your database will be migrated automatically during next restart of MySQL.
742
Before you do that make sure you have up to date backup of your data. It
743
should be mainly in $datadir directory.
744
745
EOF
746
fi
747
fi
748
exit 0
749
750
%preun
751
%service_del_preun mariadb.service
752
753
%postun
754
%service_del_postun mariadb.service
755
756
%post -n libmysqld%{soname} -p /sbin/ldconfig
757
%postun -n libmysqld%{soname} -p /sbin/ldconfig
758
759
%files -f mariadb.files
760
%config(noreplace) %attr(0644, root, mysql) %{_sysconfdir}/my.cnf
761
%dir %attr(0755, root, mysql) %{_sysconfdir}/my.cnf.d
762
%config(noreplace) %attr(0644, root, mysql) %{_sysconfdir}/my.cnf.d/*
763
%exclude %{_sysconfdir}/my.cnf.d/50-galera.cnf
764
%config %{_sysconfdir}/logrotate.d/%{name}
765
%doc %{_defaultdocdir}/%{name}
766
%dir %{_libexecdir}/mysql
767
%dir %attr(0700, mysql, mysql) %{_localstatedir}/log/mysql
768
%{_libexecdir}/mysql/mysql-systemd-helper
769
%{_unitdir}/mariadb.service
770
%{_unitdir}/mariadb@.service
771
%{_unitdir}/mariadb.target
772
%{_unitdir}/mysql.service
773
%{_unitdir}/mysql@.service
774
%{_tmpfilesdir}/mariadb.conf
775
%{_sbindir}/rcmysql
776
%dir %{_datadir}/%{name}
777
%dir %{_datadir}/mysql
778
%{_datadir}/%{name}/charsets/
779
%{_datadir}/%{name}/*.sql
780
%dir %{_libdir}/mysql
781
%{_libdir}/mysql/mysqld.sym
782
%{_libdir}/mysql/INFO_SRC
783
%config %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/mysql
784
%dir %{_libdir}/mysql/plugin
785
%{_libdir}/mysql/plugin/*.so
786
%exclude %{_libdir}/mysql/plugin/dialog*.so
787
%ghost %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release}-something
788
%dir %attr(0750, mysql, mysql) %{_localstatedir}/lib/mysql-files
789
%if 0%{with_mroonga} > 0
790
%{_datadir}/mariadb/mroonga/
791
%dir %{_datadir}/groonga/
792
%{_datadir}/groonga/COPYING
793
%{_datadir}/groonga/README.md
794
%dir %{_datadir}/groonga-normalizer-mysql
795
%{_datadir}/groonga-normalizer-mysql/README.md
796
%{_datadir}/groonga-normalizer-mysql/lgpl-2.0.txt
797
%endif
798
%dir %{_datadir}/mysql/policy
799
%dir %{_datadir}/mysql/policy/apparmor
800
%{_datadir}/mysql/policy/apparmor/README
801
%{_datadir}/mysql/policy/apparmor/usr.sbin.mysqld*
802
%dir %{_datadir}/mysql/policy/selinux
803
%{_datadir}/mysql/policy/selinux/README
804
%{_datadir}/mysql/policy/selinux/mariadb-server.*
805
%{_datadir}/mysql/policy/selinux/mariadb.te
806
%dir %{_datadir}/mysql/systemd
807
%{_datadir}/mysql/systemd/mariadb.service
808
%{_datadir}/mysql/systemd/mariadb@.service
809
810
%files -n libmysqld%{soname}
811
%{_libdir}/libmysqld.so.*
812
813
%files -n libmysqld-devel
814
%{_libdir}/libmysqld.a
815
%{_libdir}/libmysqld.so
816
817
%files client -f mariadb-client.files
818
%dir %{_libdir}/mysql
819
%dir %{_libdir}/mysql/plugin
820
%{_libdir}/mysql/plugin/dialog_examples.so
821
822
%files galera -f mariadb-galera.files
823
%doc Docs/README.wsrep
824
%config(noreplace) %{_sysconfdir}/my.cnf.d/50-galera.cnf
825
%{_datadir}/mysql/systemd/use_galera_new_cluster.conf
826
%{_datadir}/mysql/wsrep_notify
827
828
%files errormessages -f mariadb-errormessages.files
829
%{_datadir}/%{name}/*/errmsg.sys
830
831
%files bench -f mariadb-bench.files
832
%{_datadir}/sql-bench
833
834
%files test -f mariadb-test.files
835
%{_bindir}/my_safe_process
836
%{_mandir}/man1/my_safe_process.1*
837
%{_mandir}/man1/mysql-test-run.pl.1*
838
%{_mandir}/man1/mysql-stress-test.pl.1*
839
%{_datadir}/mysql-test/valgrind.supp
840
%dir %attr(755, mysql, mysql)%{_datadir}/mysql-test
841
%{_datadir}/mysql-test/[^v]*
842
%dir %attr(755, mysql, mysql) %{_datadir}/mysql-test%{_localstatedir}
843
844
%files tools -f mariadb-tools.files
845
%{_bindir}/mysqlrepair
846
%{_bindir}/mysqlanalyze
847
%{_bindir}/mysqloptimize
848
849
%changelog
850