-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmariadb.spec
1827 lines (1542 loc) · 63.3 KB
/
mariadb.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
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
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# SCL stuff
%{?scl:%scl_package mariadb}
%{!?scl:%global pkg_name %{name}}
# Prefix that is used for patches
%global pkgnamepatch mariadb
# Regression tests may take a long time (many cores recommended), skip them by
# passing --nocheck to rpmbuild or by setting runselftest to 0 if defining
# --nocheck is not possible (e.g. in koji build)
%{!?runselftest:%global runselftest 1}
# Set this to 1 to see which tests fail
%global check_testsuite 0
# In f20+ use unversioned docdirs, otherwise the old versioned one
%global _pkgdocdirname %{pkg_name}%{!?_pkgdocdir:-%{version}}
%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{pkg_name}-%{version}}
# Use Full RELRO for all binaries (RHBZ#1092548)
%global _hardened_build 1
# By default, patch(1) creates backup files when chunks apply with offsets.
# Turn that off to ensure such files don't get included in RPMs (cf bz#884755).
%global _default_patch_flags --no-backup-if-mismatch
# TokuDB engine is now part of MariaDB, but it is available only for x86_64;
# variable tokudb allows to build with TokuDB storage engine
# Temporarily disabled in F21+ for https://mariadb.atlassian.net/browse/MDEV-6446
%if 0%{?scl:1}
%bcond_with tokudb
%else
%ifarch x86_64
%bcond_without tokudb
%else
%bcond_with tokudb
%endif
%endif
# Mroonga engine is now part of MariaDB, but it only builds for x86_64;
# variable mroonga allows to build with Mroonga storage engine
%if 0%{?scl:1}
%bcond_with mroonga
%else
%ifarch x86_64 i686
%bcond_without mroonga
%else
%bcond_with mroonga
%endif
%endif
# The Open Query GRAPH engine (OQGRAPH) is a computation engine allowing
# hierarchies and more complex graph structures to be handled in a relational
# fashion; enabled by default
%bcond_without oqgraph
# For some use cases we do not need some parts of the package
%bcond_without devel
%bcond_without client
%bcond_without common
%bcond_without errmsg
%bcond_without bench
%bcond_without test
%if 0%{?scl:1}
%bcond_with embedded
%bcond_with clibrary
%bcond_with connect
%else
%bcond_without clibrary
%bcond_without embedded
%bcond_without connect
%endif
# When there is already another package that ships /etc/my.cnf,
# rather include it than ship the file again, since conflicts between
# those files may create issues
%bcond_without config
# For deep debugging we need to build binaries with extra debug info
%bcond_with debug
# Include files for SysV init or systemd
%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
%bcond_without init_systemd
%bcond_with init_sysv
%global daemon_name %{?scl_prefix}%{pkg_name}
%global daemon_no_prefix %{pkg_name}
%if ! 0%{?scl:1}
%global mysqld_pid_dir mysqld
%endif
%else
%bcond_with init_systemd
%bcond_without init_sysv
%global daemon_name %{?scl:%{?scl_prefix}%{pkg_name}}%{!?scl:mysqld}
%global daemon_no_prefix %{?scl:%{pkg_name}}%{!?scl:mysqld}
%endif
# MariaDB 10.0 and later requires pcre >= 8.35, otherwise we need to use
# the bundled library, since the package cannot be build with older version
%if 0%{?fedora} >= 21
%bcond_without pcre
%else
%bcond_with pcre
%endif
# Define where to get propper SELinux context
# and define names and locations specific for the whole collection
%if 0%{?rhel} >= 7 || 0%{?fedora} >= 15
%{?scl:%global se_daemon_source %{_unitdir}/mariadb}
%{?scl:%global se_log_source %{?_root_localstatedir}/log/mariadb}
%global daemondir %{_unitdir}
%else
%{?scl:%global se_daemon_source %{?scl:%_root_sysconfdir}%{!?scl:%_sysconfdir}/rc.d/init.d/mysqld}
%{?scl:%global se_log_source %{?_root_localstatedir}/log/mysql}
%global daemondir %{?scl:%_root_sysconfdir}%{!?scl:%_sysconfdir}/rc.d/init.d
%endif
%if ! 0%{?scl:1} || 0%{?nfsmountable:1}
%global logfiledir %{_localstatedir}/log/mariadb
%global dbdatadir %{_localstatedir}/lib/mysql
%else
%global logfiledir %{?_root_localstatedir}/log/%{?scl_prefix}mariadb
%global dbdatadir %{?_scl_root}/var/lib/mysql
%endif
# Directory for storing pid file
%global pidfiledir %{?scl:%{_root_localstatedir}}%{!?scl:%{_localstatedir}}/run/%{daemon_name}
# We define some system's well known locations here so we can use them easily
# later when building to another location (like SCL)
%global logrotateddir %{?scl:%_root_sysconfdir}%{!?scl:%_sysconfdir}/logrotate.d
%global logfile %{logfiledir}/%{daemon_no_prefix}.log
# Home directory of mysql user should be same for all packages that create it
%global mysqluserhome /var/lib/mysql
# The evr of mysql we want to obsolete
%if ! 0%{?scl:1}
%global obsoleted_mysql_evr 5.6-0
%global obsoleted_mysql_case_evr 5.5.30-5
%endif
# Provide mysql names for compatibility
%if 0%{?scl:1}
%bcond_with mysql_names
%bcond_with conflicts
%else
%bcond_without mysql_names
%bcond_without conflicts
%endif
# Make long macros shorter
%global sameevr %{epoch}:%{version}-%{release}
%global compatver 10.0
%global bugfixver 19
%if 0%{?scl:1}
%global scl_upper %{lua:print(string.upper(string.gsub(rpm.expand("%{scl}"), "-", "_")))}
%endif
Name: %{?scl_prefix}mariadb
Version: %{compatver}.%{bugfixver}
Release: 1%{?with_debug:.debug}%{?dist}
Epoch: 1
Summary: A community developed branch of MySQL
Group: Applications/Databases
URL: http://mariadb.org
# Exceptions allow client libraries to be linked with most open source SW,
# not only GPL code. See README.mysql-license
License: GPLv2 with exceptions and LGPLv2 and BSD
Source0: http://mirrors.syringanetworks.net/mariadb/mariadb-%{version}/source/mariadb-%{version}.tar.gz
Source2: mysql_config_multilib.sh
Source3: my.cnf.in
Source4: my_config.h
Source5: README.mysql-cnf
Source6: README.mysql-docs
Source7: README.mysql-license
Source9: mysql-embedded-check.c
Source10: mysql.tmpfiles.d.in
Source11: mysql.service.in
Source12: mysql-prepare-db-dir.sh
Source13: mysql-wait-ready.sh
Source14: mysql-check-socket.sh
Source15: mysql-scripts-common.sh
Source16: mysql-check-upgrade.sh
Source17: mysql-wait-stop.sh
Source19: mysql.init.in
Source40: daemon-scl-helper.sh
Source50: rh-skipped-tests-base.list
Source51: rh-skipped-tests-arm.list
Source52: rh-skipped-tests-ppc-s390.list
# Comments for these patches are in the patch files
# Patches common for more mysql-like packages
Patch1: %{pkgnamepatch}-strmov.patch
Patch2: %{pkgnamepatch}-install-test.patch
Patch3: %{pkgnamepatch}-s390-tsc.patch
Patch4: %{pkgnamepatch}-logrotate.patch
Patch5: %{pkgnamepatch}-file-contents.patch
Patch7: %{pkgnamepatch}-scripts.patch
Patch8: %{pkgnamepatch}-install-db-sharedir.patch
Patch9: %{pkgnamepatch}-ownsetup.patch
Patch10: %{pkgnamepatch}-noclientlib.patch
Patch12: %{pkgnamepatch}-admincrash.patch
# Patches specific for this mysql package
Patch30: %{pkgnamepatch}-errno.patch
Patch31: %{pkgnamepatch}-string-overflow.patch
Patch32: %{pkgnamepatch}-basedir.patch
Patch33: %{pkgnamepatch}-covscan-signexpr.patch
Patch34: %{pkgnamepatch}-covscan-stroverflow.patch
Patch37: %{pkgnamepatch}-notestdb.patch
# Patches specific for scl
Patch90: %{pkgnamepatch}-scl-env-check.patch
BuildRequires: cmake
BuildRequires: libaio-devel
BuildRequires: openssl-devel
BuildRequires: ncurses-devel
BuildRequires: perl
BuildRequires: systemtap-sdt-devel
BuildRequires: zlib-devel
# auth_pam.so plugin will be build if pam-devel is installed
BuildRequires: pam-devel
%{?with_pcre:BuildRequires: pcre-devel >= 8.35}
# Tests requires time and ps and some perl modules
BuildRequires: procps
BuildRequires: time
BuildRequires: perl(Env)
BuildRequires: perl(Exporter)
BuildRequires: perl(Fcntl)
BuildRequires: perl(File::Temp)
BuildRequires: perl(Data::Dumper)
BuildRequires: perl(Getopt::Long)
BuildRequires: perl(IPC::Open3)
BuildRequires: perl(Socket)
BuildRequires: perl(Sys::Hostname)
BuildRequires: perl(Test::More)
BuildRequires: perl(Time::HiRes)
# for running some openssl tests rhbz#1189180
BuildRequires: openssl
%{?with_init_systemd:BuildRequires: systemd}
Requires: bash
Requires: fileutils
Requires: grep
Requires: %{name}-common%{?_isa} = %{sameevr}
%{?scl:Requires:%scl_runtime}
%if %{with mysql_names}
Provides: mysql = %{sameevr}
Provides: mysql%{?_isa} = %{sameevr}
Provides: mysql-compat-client = %{sameevr}
Provides: mysql-compat-client%{?_isa} = %{sameevr}
%endif
# MySQL (with caps) is upstream's spelling of their own RPMs for mysql
%{?obsoleted_mysql_case_evr:Obsoletes: MySQL < %{obsoleted_mysql_case_evr}}
%{?obsoleted_mysql_evr:Obsoletes: mysql < %{obsoleted_mysql_evr}}
%{?with_conflicts:Conflicts: community-mysql}
# Filtering: https://fedoraproject.org/wiki/Packaging:AutoProvidesAndRequiresFiltering
%if 0%{?fedora} > 14 || 0%{?rhel} > 6
%global __requires_exclude ^perl\\((hostnames|lib::mtr|lib::v1|mtr_|My::)
%global __provides_exclude_from ^(%{_datadir}/(mysql|mysql-test)/.*|%{_libdir}/mysql/plugin/.*\\.so)$
%else
%filter_from_requires /perl(\(hostnames\|lib::mtr\|lib::v1\|mtr_\|My::\)/d
%filter_provides_in -P (%{_datadir}/(mysql|mysql-test)/.*|%{_libdir}/mysql/plugin/.*\.so)
%filter_setup
%endif
%description
MariaDB is a community developed branch of MySQL.
MariaDB is a multi-user, multi-threaded SQL database server.
It is a client/server implementation consisting of a server daemon (mysqld)
and many different client programs and libraries. The base package
contains the standard MariaDB/MySQL client programs and generic MySQL files.
%if %{with clibrary}
%package libs
Summary: The shared libraries required for MariaDB/MySQL clients
Group: Applications/Databases
Requires: %{name}-common%{?_isa} = %{sameevr}
%{?scl:Requires:%scl_runtime}
%if %{with mysql_names}
Provides: mysql-libs = %{sameevr}
Provides: mysql-libs%{?_isa} = %{sameevr}
%endif
%{?obsoleted_mysql_case_evr:Obsoletes: MySQL-libs < %{obsoleted_mysql_case_evr}}
%{?obsoleted_mysql_evr:Obsoletes: mysql-libs < %{obsoleted_mysql_evr}}
%description libs
The mariadb-libs package provides the essential shared libraries for any
MariaDB/MySQL client program or interface. You will need to install this
package to use any other MariaDB package or any clients that need to connect
to a MariaDB/MySQL server. MariaDB is a community developed branch of MySQL.
%endif
%if %{with config}
%package config
Summary: The config files required by server and client
Group: Applications/Databases
%{?scl:Requires:%scl_runtime}
%description config
The package provides the config file my.cnf and my.cnf.d directory used by any
MariaDB or MySQL program. You will need to install this package to use any
other MariaDB or MySQL package if the config files are not provided in the
package itself.
%endif
%if %{with common}
%package common
Summary: The shared files required by server and client
Group: Applications/Databases
Requires: %{_sysconfdir}/my.cnf
%{?scl:Requires:%scl_runtime}
%description common
The package provides the essential shared files for any MariaDB program.
You will need to install this package to use any other MariaDB package.
%endif
%if %{with errmsg}
%package errmsg
Summary: The error messages files required by server and embedded
Group: Applications/Databases
Requires: %{name}-common%{?_isa} = %{sameevr}
%{?scl:Requires:%scl_runtime}
%description errmsg
The package provides error messages files for the MariaDB daemon and the
embedded server. You will need to install this package to use any of those
MariaDB packages.
%endif
%package server
Summary: The MariaDB server and related files
Group: Applications/Databases
# note: no version here = %%{version}-%%{release}
%if %{with mysql_names}
Requires: mysql-compat-client%{?_isa}
Requires: mysql%{?_isa}
%else
Requires: %{name}%{?_isa}
%endif
Requires: %{name}-common%{?_isa} = %{sameevr}
Requires: %{_sysconfdir}/my.cnf
Requires: %{_sysconfdir}/my.cnf.d
Requires: %{name}-errmsg%{?_isa} = %{sameevr}
Requires: sh-utils
Requires(pre): /usr/sbin/useradd
%if %{with init_systemd}
# We require this to be present for %%{_tmpfilesdir}
Requires: systemd
# Make sure it's there when scriptlets run, too
Requires(pre): systemd
Requires(posttrans): systemd
%{?systemd_requires: %systemd_requires}
%endif
# mysqlhotcopy needs DBI/DBD support
Requires: perl(DBI)
Requires: perl(DBD::mysql)
%{?scl:Requires:%scl_runtime}
%{?scl:Requires:%{_root_bindir}/scl_source}
%{?scl:Requires(post): policycoreutils-python libselinux-utils}
%if %{with mysql_names}
Provides: mysql-server = %{sameevr}
Provides: mysql-server%{?_isa} = %{sameevr}
Provides: mysql-compat-server = %{sameevr}
Provides: mysql-compat-server%{?_isa} = %{sameevr}
%endif
%{?obsoleted_mysql_case_evr:Obsoletes: MySQL-server < %{obsoleted_mysql_case_evr}}
%{?with_conflicts:Conflicts: community-mysql-server}
%{?with_conflicts:Conflicts: mariadb-galera-server}
%{?obsoleted_mysql_evr:Obsoletes: mysql-server < %{obsoleted_mysql_evr}}
%description server
MariaDB is a multi-user, multi-threaded SQL database server. It is a
client/server implementation consisting of a server daemon (mysqld)
and many different client programs and libraries. This package contains
the MariaDB server and some accompanying files and directories.
MariaDB is a community developed branch of MySQL.
%if %{with oqgraph}
%package oqgraph-engine
Summary: The Open Query GRAPH engine for MariaDB
Group: Applications/Databases
Requires: %{name}-server%{?_isa} = %{sameevr}
%{?scl:Requires:%scl_runtime}
# boost and Judy required for oograph
%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
BuildRequires: boost-devel
%else
BuildRequires: %{?scl_prefix}boost-devel
%endif
BuildRequires: %{?scl_prefix}Judy-devel
%description oqgraph-engine
The package provides Open Query GRAPH engine (OQGRAPH) as plugin for MariaDB
database server. OQGRAPH is a computation engine allowing hierarchies and more
complex graph structures to be handled in a relational fashion. In a nutshell,
tree structures and friend-of-a-friend style searches can now be done using
standard SQL syntax, and results joined onto other tables.
%endif
%if %{with connect}
%package connect-engine
Summary: The CONNECT storage engine for MariaDB
Group: Applications/Databases
Requires: %{name}-server%{?_isa} = %{sameevr}
%{?scl:Requires:%scl_runtime}
%description connect-engine
The CONNECT storage engine enables MariaDB to access external local or
remote data (MED). This is done by defining tables based on different data
types, in particular files in various formats, data extracted from other DBMS
or products (such as Excel), or data retrieved from the environment
(for example DIR, WMI, and MAC tables).
%endif
%if %{with devel}
%package devel
Summary: Files for development of MariaDB/MySQL applications
Group: Applications/Databases
%{?with_clibrary:Requires: %{name}-libs%{?_isa} = %{sameevr}}
Requires: openssl-devel%{?_isa}
%{?scl:Requires:%scl_runtime}
%if %{with mysql_names}
Provides: mysql-devel = %{sameevr}
Provides: mysql-devel%{?_isa} = %{sameevr}
%endif
%{?obsoleted_mysql_case_evr:Obsoletes: MySQL-devel < %{obsoleted_mysql_case_evr}}
%{?obsoleted_mysql_evr:Obsoletes: mysql-devel < %{obsoleted_mysql_evr}}
%{?with_conflicts:Conflicts: community-mysql-devel}
%description devel
MariaDB is a multi-user, multi-threaded SQL database server. This
package contains the libraries and header files that are needed for
developing MariaDB/MySQL client applications.
MariaDB is a community developed branch of MySQL.
%endif
%if %{with embedded}
%package embedded
Summary: MariaDB as an embeddable library
Group: Applications/Databases
Requires: %{name}-common%{?_isa} = %{sameevr}
Requires: %{name}-errmsg%{?_isa} = %{sameevr}
%{?scl:Requires:%scl_runtime}
%if %{with mysql_names}
Provides: mysql-embedded = %{sameevr}
Provides: mysql-embedded%{?_isa} = %{sameevr}
%endif
%{?obsoleted_mysql_case_evr:Obsoletes: MySQL-embedded < %{obsoleted_mysql_case_evr}}
%{?obsoleted_mysql_evr:Obsoletes: mysql-embedded < %{obsoleted_mysql_evr}}
%description embedded
MariaDB is a multi-user, multi-threaded SQL database server. This
package contains a version of the MariaDB server that can be embedded
into a client application instead of running as a separate process.
MariaDB is a community developed branch of MySQL.
%package embedded-devel
Summary: Development files for MariaDB as an embeddable library
Group: Applications/Databases
Requires: %{name}-embedded%{?_isa} = %{sameevr}
Requires: %{name}-devel%{?_isa} = %{sameevr}
%{?scl:Requires:%scl_runtime}
%if %{with mysql_names}
Provides: mysql-embedded-devel = %{sameevr}
Provides: mysql-embedded-devel%{?_isa} = %{sameevr}
%endif
%{?with_conflicts:Conflicts: community-mysql-embedded-devel}
%{?obsoleted_mysql_case_evr:Obsoletes: MySQL-embedded-devel < %{obsoleted_mysql_case_evr}}
%{?obsoleted_mysql_evr:Obsoletes: mysql-embedded-devel < %{obsoleted_mysql_evr}}
%description embedded-devel
MariaDB is a multi-user, multi-threaded SQL database server. This
package contains files needed for developing and testing with
the embedded version of the MariaDB server.
MariaDB is a community developed branch of MySQL.
%endif
%if %{with bench}
%package bench
Summary: MariaDB benchmark scripts and data
Group: Applications/Databases
Requires: %{name}%{?_isa} = %{sameevr}
%{?scl:Requires:%scl_runtime}
%if %{with mysql_names}
Provides: mysql-bench = %{sameevr}
Provides: mysql-bench%{?_isa} = %{sameevr}
%endif
%{?with_conflicts:Conflicts: community-mysql-bench}
%{?obsoleted_mysql_case_evr:Obsoletes: MySQL-bench < %{obsoleted_mysql_case_evr}}
%{?obsoleted_mysql_evr:Obsoletes: mysql-bench < %{obsoleted_mysql_evr}}
%description bench
MariaDB is a multi-user, multi-threaded SQL database server. This
package contains benchmark scripts and data for use when benchmarking
MariaDB.
MariaDB is a community developed branch of MySQL.
%endif
%if %{with test}
%package test
Summary: The test suite distributed with MariaD
Group: Applications/Databases
Requires: %{name}%{?_isa} = %{sameevr}
Requires: %{name}-common%{?_isa} = %{sameevr}
Requires: %{name}-server%{?_isa} = %{sameevr}
Requires: perl(Env)
Requires: perl(Exporter)
Requires: perl(Fcntl)
Requires: perl(File::Temp)
Requires: perl(Data::Dumper)
Requires: perl(Getopt::Long)
Requires: perl(IPC::Open3)
Requires: perl(Socket)
Requires: perl(Sys::Hostname)
Requires: perl(Test::More)
Requires: perl(Time::HiRes)
%{?scl:Requires:%scl_runtime}
%{?with_conflicts:Conflicts: community-mysql-test}
%if %{with mysql_names}
Provides: mysql-test = %{sameevr}
Provides: mysql-test%{?_isa} = %{sameevr}
%endif
%{?obsoleted_mysql_case_evr:Obsoletes: MySQL-test < %{obsoleted_mysql_case_evr}}
%{?obsoleted_mysql_evr:Obsoletes: mysql-test < %{obsoleted_mysql_evr}}
%description test
MariaDB is a multi-user, multi-threaded SQL database server. This
package contains the regression test suite distributed with
the MariaDB sources.
MariaDB is a community developed branch of MySQL.
%endif
%prep
%setup -q -n mariadb-%{version}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch12 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch37 -p1
# removing bundled cmd-line-utils is now disabled
# we cannot use libedit due #1201988
# rm -r cmd-line-utils
sed -i -e 's/2.8.7/2.6.4/g' cmake/cpack_rpm.cmake
# workaround for upstream bug #56342
rm -f mysql-test/t/ssl_8k_key-master.opt
# generate a list of tests that fail, but are not disabled by upstream
cat %{SOURCE50} | tee mysql-test/rh-skipped-tests.list
# disable some tests failing on different architectures
%ifarch %{arm} aarch64
cat %{SOURCE51} | tee -a mysql-test/rh-skipped-tests.list
%endif
%ifarch ppc ppc64 ppc64p7 s390 s390x
cat %{SOURCE52} | tee -a mysql-test/rh-skipped-tests.list
%endif
cp %{SOURCE2} %{SOURCE3} %{SOURCE10} %{SOURCE11} %{SOURCE12} %{SOURCE13} \
%{SOURCE14} %{SOURCE15} %{SOURCE16} %{SOURCE17} %{SOURCE19} \
scripts
%if 0%{?scl:1}
%patch90 -p1
%endif
%build
# fail quickly and obviously if user tries to build as root
%if %runselftest
if [ x"$(id -u)" = "x0" ]; then
echo "mysql's regression tests fail if run as root."
echo "If you really need to build the RPM as root, use"
echo "--nocheck to skip the regression tests."
exit 1
fi
%endif
%{?scl:scl enable %{scl} - << "EOF"}
CFLAGS="%{optflags} -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE"
# force PIC mode so that we can build libmysqld.so
CFLAGS="$CFLAGS -fPIC"
# GCC 4.9 causes segfaults: https://mariadb.atlassian.net/browse/MDEV-6360
CFLAGS="$CFLAGS -fno-delete-null-pointer-checks"
# gcc seems to have some bugs on sparc as of 4.4.1, back off optimization
# submitted as bz #529298
%ifarch sparc sparcv9 sparc64
CFLAGS=`echo $CFLAGS| sed -e "s|-O2|-O1|g" `
%endif
# significant performance gains can be achieved by compiling with -O3 optimization
# rhbz#1051069
%ifarch ppc64
CFLAGS=`echo $CFLAGS| sed -e "s|-O2|-O3|g" `
%endif
CXXFLAGS="$CFLAGS"
export CFLAGS CXXFLAGS
%if 0%{?_hardened_build}
# building with PIE
LDFLAGS="$LDFLAGS -pie -Wl,-z,relro,-z,now"
export LDFLAGS
%endif
# The INSTALL_xxx macros have to be specified relative to CMAKE_INSTALL_PREFIX
# so we can't use %%{_datadir} and so forth here.
%cmake . \
-DBUILD_CONFIG=mysql_release \
-DFEATURE_SET="community" \
-DWITH_READLINE=ON \
-DINSTALL_LAYOUT=RPM \
-DDAEMON_NAME="%{daemon_name}" \
-DDAEMON_NO_PREFIX="%{daemon_no_prefix}" \
%if 0%{?scl:1}
-DSCL_NAME="%{?scl}" \
-DSCL_NAME_UPPER="%{?scl_upper}" \
-DSCL_SCRIPTS="%{?_scl_scripts}" \
%endif
-DLOG_LOCATION="%{logfile}" \
-DPID_FILE_DIR="%{pidfiledir}" \
-DNICE_PROJECT_NAME="MariaDB" \
-DRPM="%{?rhel:rhel%{rhel}}%{!?rhel:fedora%{fedora}}" \
-DCMAKE_INSTALL_PREFIX="%{_prefix}" \
-DINSTALL_SYSCONFDIR="%{_sysconfdir}" \
-DINSTALL_SYSCONF2DIR="%{_sysconfdir}/my.cnf.d" \
-DINSTALL_DOCDIR="share/doc/%{_pkgdocdirname}" \
-DINSTALL_DOCREADMEDIR="share/doc/%{_pkgdocdirname}" \
-DINSTALL_INCLUDEDIR=include/mysql \
-DINSTALL_INFODIR=share/info \
-DINSTALL_LIBDIR="%{_lib}/mysql" \
-DINSTALL_MANDIR=share/man \
-DINSTALL_MYSQLSHAREDIR=share/%{pkg_name} \
-DINSTALL_MYSQLTESTDIR=share/mysql-test \
-DINSTALL_PLUGINDIR="%{_lib}/mysql/plugin" \
-DINSTALL_SBINDIR=libexec \
-DINSTALL_SCRIPTDIR=bin \
-DINSTALL_SQLBENCHDIR=share \
-DINSTALL_SUPPORTFILESDIR=share/%{pkg_name} \
-DMYSQL_DATADIR="%{dbdatadir}" \
-DMYSQL_UNIX_ADDR="/var/lib/mysql/mysql.sock" \
-DENABLED_LOCAL_INFILE=ON \
-DENABLE_DTRACE=ON \
-DWITH_EMBEDDED_SERVER=ON \
-DWITH_SSL=system \
-DWITH_ZLIB=system \
%{?with_pcre: -DWITH_PCRE=system}\
-DWITH_JEMALLOC=no \
%{!?with_tokudb: -DWITHOUT_TOKUDB=ON}\
%{!?with_mroonga: -DWITHOUT_MROONGA=ON}\
-DTMPDIR=/var/tmp \
%{?with_debug: -DCMAKE_BUILD_TYPE=Debug}\
%{?_hardened_build:-DWITH_MYSQLD_LDFLAGS="-pie -Wl,-z,relro,-z,now"}
make %{?_smp_mflags} VERBOSE=1
%{?scl:EOF}
# debuginfo extraction scripts fail to find source files in their real
# location -- satisfy them by copying these files into location, which
# is expected by scripts
for e in innobase xtradb ; do
for f in pars0grm.y pars0lex.l ; do
cp -p "storage/$e/pars/$f" "storage/$e/$f"
done
done
%install
%{?scl:scl enable %{scl} - << "EOF"}
make DESTDIR=%{buildroot} install
%{?scl:EOF}
# cmake generates some completely wacko references to -lprobes_mysql when
# building with dtrace support. Haven't found where to shut that off,
# so resort to this blunt instrument. While at it, let's not reference
# libmysqlclient_r anymore either.
sed -e 's/-lprobes_mysql//' -e 's/-lmysqlclient_r/-lmysqlclient/' \
%{buildroot}%{_bindir}/mysql_config >mysql_config.tmp
cp -p -f mysql_config.tmp %{buildroot}%{_bindir}/mysql_config
chmod 755 %{buildroot}%{_bindir}/mysql_config
# multilib header support
# we only apply this to known Red Hat multilib arches, per bug #181335
unamei=$(uname -i)
%ifarch %{arm}
unamei=arm
%endif
%ifarch %{power64}
unamei=ppc64
%endif
%ifarch %{arm} aarch64 %{ix86} x86_64 ppc %{power64} %{sparc} s390 s390x
mv %{buildroot}%{_includedir}/mysql/my_config.h %{buildroot}%{_includedir}/mysql/my_config_${unamei}.h
mv %{buildroot}%{_includedir}/mysql/private/config.h %{buildroot}%{_includedir}/mysql/private/my_config_${unamei}.h
install -p -m 644 %{SOURCE4} %{buildroot}%{_includedir}/mysql/
install -p -m 644 %{SOURCE4} %{buildroot}%{_includedir}/mysql/private/config.h
mv %{buildroot}%{_bindir}/mysql_config %{buildroot}%{_bindir}/mysql_config-%{__isa_bits}
install -p -m 0755 scripts/mysql_config_multilib %{buildroot}%{_bindir}/mysql_config
%endif
# install INFO_SRC, INFO_BIN into libdir (upstream thinks these are doc files,
# but that's pretty wacko --- see also %%{name}-file-contents.patch)
install -p -m 644 Docs/INFO_SRC %{buildroot}%{_libdir}/mysql/
install -p -m 644 Docs/INFO_BIN %{buildroot}%{_libdir}/mysql/
rm -rf %{buildroot}%{_pkgdocdir}/MariaDB-server-%{version}/
mkdir -p %{buildroot}%{logfiledir}
chmod 0750 %{buildroot}%{logfiledir}
touch %{buildroot}%{logfile}
# current setting in my.cnf is to use /var/run/mariadb for creating pid file,
# however since my.cnf is not updated by RPM if changed, we need to create mysqld
# as well because users can have odd settings in their /etc/my.cnf
mkdir -p %{buildroot}%{pidfiledir}
install -p -m 0755 -d %{buildroot}%{dbdatadir}
# create directory for socket
%{?scl:install -p -m 0755 -d %{buildroot}/var/lib/mysql}
%if %{with config}
install -D -p -m 0644 scripts/my.cnf %{buildroot}%{_sysconfdir}/my.cnf
%else
rm -f %{buildroot}%{_sysconfdir}/my.cnf.d/mysql-clients.cnf
rm -f %{buildroot}%{_sysconfdir}/my.cnf
%endif
# use different config file name for each variant of server
mv %{buildroot}%{_sysconfdir}/my.cnf.d/server.cnf %{buildroot}%{_sysconfdir}/my.cnf.d/%{pkg_name}-server.cnf
# install systemd unit files and scripts for handling server startup
%if %{with init_systemd}
install -D -p -m 644 scripts/mysql.service %{buildroot}%{_unitdir}/%{daemon_name}.service
install -D -p -m 0644 scripts/mysql.tmpfiles.d %{buildroot}%{_tmpfilesdir}/%{name}.conf
%if 0%{?mysqld_pid_dir:1}
echo "d %{_root_localstatedir}/run/%{mysqld_pid_dir} 0755 mysql mysql -" >>%{buildroot}%{_tmpfilesdir}/%{name}.conf
%endif
%endif
# install SysV init script
%if %{with init_sysv}
install -D -p -m 755 scripts/mysql.init %{buildroot}%{daemondir}/%{daemon_name}
%endif
# helper scripts for service starting
install -p -m 755 scripts/mysql-prepare-db-dir %{buildroot}%{_libexecdir}/mysql-prepare-db-dir
install -p -m 755 scripts/mysql-wait-ready %{buildroot}%{_libexecdir}/mysql-wait-ready
install -p -m 755 scripts/mysql-wait-stop %{buildroot}%{_libexecdir}/mysql-wait-stop
install -p -m 755 scripts/mysql-check-socket %{buildroot}%{_libexecdir}/mysql-check-socket
install -p -m 755 scripts/mysql-check-upgrade %{buildroot}%{_libexecdir}/mysql-check-upgrade
install -p -m 644 scripts/mysql-scripts-common %{buildroot}%{_libexecdir}/mysql-scripts-common
# daemon helper for fixing SELinux in systemd
%if %{with init_systemd} && 0%{?scl:1}
install -p -m 755 %{SOURCE40} %{buildroot}%{_libexecdir}/mysqld_safe-scl-helper
%endif
# Remove libmysqld.a
rm -f %{buildroot}%{_libdir}/mysql/libmysqld.a
# libmysqlclient_r is no more. Upstream tries to replace it with symlinks
# but that really doesn't work (wrong soname in particular). We'll keep
# just the devel libmysqlclient_r.so link, so that rebuilding without any
# source change is enough to get rid of dependency on libmysqlclient_r.
rm -f %{buildroot}%{_libdir}/mysql/libmysqlclient_r.so*
ln -s libmysqlclient.so %{buildroot}%{_libdir}/mysql/libmysqlclient_r.so
# mysql-test includes one executable that doesn't belong under /usr/share,
# so move it and provide a symlink
mv %{buildroot}%{_datadir}/mysql-test/lib/My/SafeProcess/my_safe_process %{buildroot}%{_bindir}
ln -s ../../../../../bin/my_safe_process %{buildroot}%{_datadir}/mysql-test/lib/My/SafeProcess/my_safe_process
# should move this to /etc/ ?
rm -f %{buildroot}%{_bindir}/mysql_embedded
rm -f %{buildroot}%{_libdir}/mysql/*.a
rm -f %{buildroot}%{_datadir}/%{pkg_name}/binary-configure
rm -f %{buildroot}%{_datadir}/%{pkg_name}/magic
rm -f %{buildroot}%{_datadir}/%{pkg_name}/ndb-config-2-node.ini
rm -f %{buildroot}%{_datadir}/%{pkg_name}/mysql.server
rm -f %{buildroot}%{_datadir}/%{pkg_name}/mysqld_multi.server
rm -f %{buildroot}%{_mandir}/man1/mysql-stress-test.pl.1*
rm -f %{buildroot}%{_mandir}/man1/mysql-test-run.pl.1*
rm -f %{buildroot}%{_bindir}/mytop
# put logrotate script where it needs to be
mkdir -p %{buildroot}%{logrotateddir}
mv %{buildroot}%{_datadir}/%{pkg_name}/mysql-log-rotate %{buildroot}%{logrotateddir}/%{daemon_name}
chmod 644 %{buildroot}%{logrotateddir}/%{daemon_name}
%if %{with clibrary} && 0%{!?scl:1}
mkdir -p %{buildroot}%{_sysconfdir}/ld.so.conf.d
echo "%{_libdir}/mysql" > %{buildroot}%{_sysconfdir}/ld.so.conf.d/%{name}-%{_arch}.conf
%endif
# copy additional docs into build tree so %%doc will find them
install -p -m 0644 %{SOURCE5} %{basename:%{SOURCE5}}
install -p -m 0644 %{SOURCE6} %{basename:%{SOURCE6}}
install -p -m 0644 %{SOURCE7} %{basename:%{SOURCE7}}
install -p -m 0644 %{SOURCE16} %{basename:%{SOURCE16}}
# install the list of skipped tests to be available for user runs
install -p -m 0644 mysql-test/rh-skipped-tests.list %{buildroot}%{_datadir}/mysql-test
# remove unneeded RHEL-4 SELinux stuff
rm -rf %{buildroot}%{_datadir}/%{pkg_name}/SELinux/
# remove SysV init script
rm -f %{buildroot}%{_sysconfdir}/init.d/mysql
# remove duplicate logrotate script
rm -f %{buildroot}%{_sysconfdir}/logrotate.d/mysql
# remove solaris files
rm -rf %{buildroot}%{_datadir}/%{pkg_name}/solaris/
%if %{without clibrary}
unlink %{buildroot}%{_libdir}/mysql/libmysqlclient.so
unlink %{buildroot}%{_libdir}/mysql/libmysqlclient_r.so
rm -rf %{buildroot}%{_libdir}/mysql/libmysqlclient*.so.*
rm -rf %{buildroot}%{_sysconfdir}/ld.so.conf.d
rm -f %{buildroot}%{_sysconfdir}/my.cnf.d/client.cnf
%endif
%if %{without embedded}
rm -f %{buildroot}%{_libdir}/mysql/libmysqld.so*
rm -f %{buildroot}%{_bindir}/{mysql_client_test_embedded,mysqltest_embedded}
rm -f %{buildroot}%{_mandir}/man1/{mysql_client_test_embedded,mysqltest_embedded}.1*
%endif
%if %{without devel}
rm -f %{buildroot}%{_bindir}/mysql_config*
rm -rf %{buildroot}%{_includedir}/mysql
rm -f %{buildroot}%{_datadir}/aclocal/mysql.m4
rm -f %{buildroot}%{_libdir}/mysql/libmysqlclient*.so
rm -f %{buildroot}%{_mandir}/man1/mysql_config.1*
%endif
%if %{without client}
rm -f %{buildroot}%{_bindir}/{msql2mysql,mysql,mysql_find_rows,\
mysql_plugin,mysql_waitpid,mysqlaccess,mysqladmin,mysqlbinlog,mysqlcheck,\
mysqldump,mysqlimport,mysqlshow,mysqlslap,my_print_defaults}
rm -f %{buildroot}%{_mandir}/man1/{msql2mysql,mysql,mysql_find_rows,\
mysql_plugin,mysql_waitpid,mysqlaccess,mysqladmin,mysqlbinlog,mysqlcheck,\
mysqldump,mysqlimport,mysqlshow,mysqlslap,my_print_defaults}.1*
%endif
%if %{without connect}
rm -f %{buildroot}%{_sysconfdir}/my.cnf.d/connect.cnf
%endif
%if %{without oqgraph}
rm -f %{buildroot}%{_sysconfdir}/my.cnf.d/oqgraph.cnf
%endif
%if %{without common}
rm -rf %{buildroot}%{_datadir}/%{pkg_name}/charsets
%endif
%if %{without errmsg}
rm -f %{buildroot}%{_datadir}/%{pkg_name}/errmsg-utf8.txt
rm -rf %{buildroot}%{_datadir}/%{pkg_name}/{english,czech,danish,dutch,estonian,\
french,german,greek,hungarian,italian,japanese,korean,norwegian,norwegian-ny,\
polish,portuguese,romanian,russian,serbian,slovak,spanish,swedish,ukrainian}
%endif
%if %{without bench}
rm -rf %{buildroot}%{_datadir}/sql-bench
%endif
%if %{without test}
rm -f %{buildroot}%{_bindir}/{mysql_client_test,my_safe_process}
rm -rf %{buildroot}%{_datadir}/mysql-test
rm -f %{buildroot}%{_mandir}/man1/mysql_client_test.1*
%endif
%if 0%{?scl:1}
# generate a configuration file for daemon
cat << EOF | tee -a %{buildroot}%{?_scl_scripts}/service-environment
# Services are started in a fresh environment without any influence of user's
# environment (like environment variable values). As a consequence,
# information of all enabled collections will be lost during service start up.
# If user needs to run a service under any software collection enabled, this
# collection has to be written into %{scl_upper}_SCLS_ENABLED variable
# in %{?_scl_scripts}/service-environment.
%{scl_upper}_SCLS_ENABLED="%{scl}"
EOF
%endif #scl
%check
%if %{with test}
%if %runselftest
%{?scl:scl enable %{scl} - << "EOF"}
# hack for https://mariadb.atlassian.net/browse/MDEV-7454
%{?with_init_sysv:LD_LIBRARY_PATH=$(pwd)/unittest/mytap }make test VERBOSE=1
# hack to let 32- and 64-bit tests run concurrently on same build machine
export MTR_PARALLEL=1
# builds might happen at the same host, avoid collision
export MTR_BUILD_THREAD=%{__isa_bits}
# The cmake build scripts don't provide any simple way to control the
# options for mysql-test-run, so ignore the make target and just call it
# manually. Nonstandard options chosen are:
# --force to continue tests after a failure
# no retries please
# test SSL with --ssl
# skip tests that are listed in rh-skipped-tests.list
# avoid redundant test runs with --binlog-format=mixed
# increase timeouts to prevent unwanted failures during mass rebuilds
(
set -e
cd mysql-test
perl ./mysql-test-run.pl --force --retry=0 --ssl \
%if ! %{check_testsuite}
--skip-test-list=rh-skipped-tests.list \
%endif
--suite-timeout=720 --testcase-timeout=30 \
--mysqld=--binlog-format=mixed --force-restart \
--shutdown-timeout=60 --max-test-fail=0
# cmake build scripts will install the var cruft if left alone :-(
rm -rf var
)
%{?scl:EOF}
%endif
%endif
%pre server
/usr/sbin/groupadd -g 27 -o -r mysql >/dev/null 2>&1 || :
/usr/sbin/useradd -M -N -g mysql -o -r -d %{mysqluserhome} -s /sbin/nologin \
-c "MySQL Server" -u 27 mysql >/dev/null 2>&1 || :
%if %{with clibrary}
%post libs -p /sbin/ldconfig
%endif
%if %{with embedded}
%post embedded -p /sbin/ldconfig
%endif
%post server
%if 0%{?scl:1}
semanage fcontext -a -e "%{se_daemon_source}" "%{daemondir}/%{daemon_name}%{?with_init_systemd:.service}" >/dev/null 2>&1 || :
semanage fcontext -a -t mysqld_var_run_t "%{pidfiledir}" >/dev/null 2>&1 || :
# work-around for rhbz#1203991
semanage fcontext -a -t mysqld_etc_t '/etc/my\.cnf\.d/.*' >/dev/null 2>&1 || :
%if 0%{?rhel} <= 6
# work-around for rhbz#1194206
semanage fcontext -a -t mysqld_log_t '/var/log/mariadb(/.*)?' >/dev/null 2>&1 || :
%endif
%if %{with init_systemd}
# work-around for rhbz#1172683
semanage fcontext -a -t mysqld_safe_exec_t %{_root_libexecdir}/mysqld_safe-scl-helper >/dev/null 2>&1 || :
%endif
selinuxenabled && load_policy || :
restorecon -R "%{?_scl_root}/" >/dev/null 2>&1 || :
restorecon -R "%{_sysconfdir}" >/dev/null 2>&1 || :
restorecon -R "%{_localstatedir}" >/dev/null 2>&1 || :
restorecon -R "%{daemondir}/%{daemon_name}%{?with_init_systemd:.service}" >/dev/null 2>&1 || :
restorecon -R "%{pidfiledir}" >/dev/null 2>&1 || :
%endif
%if %{with init_systemd}
%systemd_post %{daemon_name}.service
%endif
%if %{with init_sysv}
if [ $1 = 1 ]; then
/sbin/chkconfig --add %{daemon_name}
fi