Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-db/mariadb/
Date: Wed, 07 Oct 2020 22:30:35
Message-Id: 1602109812.eac865fddbb514bcbc2b97d71ab093aa410c94d5.whissi@gentoo
1 commit: eac865fddbb514bcbc2b97d71ab093aa410c94d5
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Wed Oct 7 22:28:42 2020 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Wed Oct 7 22:30:12 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=eac865fd
7
8 dev-db/mariadb: security cleanup
9
10 Bug: https://bugs.gentoo.org/747166
11 Package-Manager: Portage-3.0.8, Repoman-3.0.1
12 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
13
14 dev-db/mariadb/Manifest | 8 -
15 dev-db/mariadb/mariadb-10.1.38-r2.ebuild | 892 -------------------------
16 dev-db/mariadb/mariadb-10.1.45-r1.ebuild | 925 --------------------------
17 dev-db/mariadb/mariadb-10.1.46.ebuild | 925 --------------------------
18 dev-db/mariadb/mariadb-10.2.33.ebuild | 1017 -----------------------------
19 dev-db/mariadb/mariadb-10.3.24.ebuild | 1008 -----------------------------
20 dev-db/mariadb/mariadb-10.4.14.ebuild | 1038 ------------------------------
21 dev-db/mariadb/mariadb-10.5.5.ebuild | 1033 -----------------------------
22 8 files changed, 6846 deletions(-)
23
24 diff --git a/dev-db/mariadb/Manifest b/dev-db/mariadb/Manifest
25 index e035a95a337..1d9a00a2c70 100644
26 --- a/dev-db/mariadb/Manifest
27 +++ b/dev-db/mariadb/Manifest
28 @@ -1,27 +1,19 @@
29 -DIST mariadb-10.1.38.tar.gz 63535685 BLAKE2B c179ea2f60287c2bc1c0d1c47ae989ac2653a24063e8344cef2f3062fc6798e18b969e8f9aa8287104ce2518e6c644cb8d3a4650b5a0bc5dfde973e76e618955 SHA512 184582f3a902a989ba3d9c4d21288c014c8b469adbbb4cbabc621c5006022cef29baed8c1140ed4476b124da83b76dfa414295ed0c3374be826e75aca953a77b
30 -DIST mariadb-10.1.45-patches-04.tar.xz 8808 BLAKE2B 79b6ad86665b6ceea990813c1b60937283ccfd572e5aef095df9951fac0a35e10b7cab002a18adcdb4b643a4d881c57ed468a15fc2fe8f0b9755dc07c2c81fc6 SHA512 eba4c39a275a27faec01dcefd36635fb8ed4f9d651e244420ce0856932378196b9daa98c9de339dc84c3e07fb77fda27c2aa46930c741a1c4c53057b4f9b86c6
31 -DIST mariadb-10.1.45.tar.gz 63673824 BLAKE2B 002aedf61282244905256757fe18eebe67f8a05d45496eee4804e5fba9edf58ece15188d6537ed45245b9342bc514376727c91261ec3f3a3d809c569c84a63de SHA512 708daf6cf98a914ca378e3461f3431f13d6274e20ef37de239e5d90db58215c50bfbc450e6b3b00d847cc819ab9de2bc780831009581e43db38d63397a417ace
32 DIST mariadb-10.1.46-patches-01.tar.xz 8824 BLAKE2B b30d1c6625d87605fc934007ebfbd449f327969b1f65bb22a1d432691a3927a3f20c55f646f9a4e8cbdcdcadf16a2518e05441ab0088bac876a81f87bb62b925 SHA512 93ef056f697d83ced4d585c31558dded94667447fc6785ed79b15dbbde4df4a3667cefec1f2007649dd0fed3c1cf86cfe5cf626588678d2a851f8c5f7b3d4092
33 -DIST mariadb-10.1.46.tar.gz 63741294 BLAKE2B 5a2ca06b7ac14896f874bb18a38dcfb2336d0b77160d3295e9a268ffaa6feec2319a5d4e5985851327f1122fa7650749a09c384eeba5ab9369fce993464702f8 SHA512 a45816edfcfb7f33fc4e316cd19d777069358b7cd0968be23922ffee886e9db8600568425e4d81a0e033a255b6c46441fefa4f5bc5da96579527b481a10a7213
34 DIST mariadb-10.1.47.tar.gz 63751492 BLAKE2B 4e01a641e1c387c4d61b3fc8747685ce549628304da7ec4375a5dd3ec1e1b5ec67e501eff2f12c47d73e84cc8a6b78bb79a7b326951e3f58131d918495c55039 SHA512 68ca6471a3dca91b7c8cdb1fb19b5387d3ef29a3598eeae70428373dc319eab9371d73cc5d06582f8d14f53ee9c0d7c6969b379f3961c8960308717fa6070349
35 DIST mariadb-10.2.22.tar.gz 71907765 BLAKE2B e7781a9e1bb0becca543ebb0b9e03912fbafa9de45bbd5c7232f92d29b934148dd124ad462bf8aa5aec2e4ee0bf75a03fae5e5fe97a77e1d93095052a577c14b SHA512 cd61d0c2d528b23b975e6ea142560d9b9ebff7ecda6fa9b3659b25b3406e8cc925918f4c3bb0e200ddb8d0520bcaa4d4f70d245b4731896f9ba2f1bdf0a817b2
36 DIST mariadb-10.2.32-patches-03.tar.xz 6048 BLAKE2B a6f8f25ec23d1d86d228d719927daa9131779239917b86eab9f82086744294c0a4f03b1a73a3baa599e367775457d6c345fa0820b89063b2e6379c0fb7076ad0 SHA512 324804f13f59593d26cc5fd8c1cdeac2f16cf55012ca65b0a7223512920e1ea94619991fdcb3d19184b6428e4a627fec75532c88ae8297f9b8398fcf730058a9
37 DIST mariadb-10.2.32.tar.gz 73646729 BLAKE2B 581906d67f0aada9e85aec7bfee03ed8927a4e836f0639fa5f31576f5df70ce2b6ed3da0b96ad616f5ed71d7717531a073cb911c6d92274f6724911e086104af SHA512 824aa94724b639337a5b4c2e86a1f5ceaeaa940eb234f852df1ba0aafd64e269335e2aca0b05d52164e090cfd6f7d14477df9e096473aa5d9286d47944a765b4
38 DIST mariadb-10.2.33-patches-01.tar.xz 6024 BLAKE2B cb4283a36b303b1422d53c454bc6390ce80f3a88c9f9cd459468cf9bff792a1af197a5e5b3f7e45376024ef78bc6049cecafd8654e1b767f741f35129624ab12 SHA512 ebe9c1295089c04e869516f3ef278673986c1227b92bb9cd96cc561b0392f22870200cf58db91fdfe7e113b04b5b6d66c904b2d1353011cbd89723a8ce83fec2
39 -DIST mariadb-10.2.33.tar.gz 73769891 BLAKE2B d5d564e6c51a6460247b999ae1d58433f15f5c7a4ffe7c676845857036c766aaf24e66cbbbaebc12cc55be97a22a4dec4916551bde65eac043cc036fc9e731b6 SHA512 336184931688beba5733d510db00d05eceb3909f8fcdf198189ea1fa96af6a401aa4f0b9e13e3fb0211f7be6c14aba8d0a9b245bd3c2a173e5b1f930a7a18460
40 DIST mariadb-10.2.34.tar.gz 73758617 BLAKE2B e25e4a6ef9916e6ff88d445bb729a5d1a33913a8aef1ecae3d701917f91d091f6f831bf428ab99d9ff7360f600bb98fad57fbc4f053632ba5c33e7cfbc333264 SHA512 ace6132ec5d02c4857e8b30b11697eb9a8ca007d11843d0288a1d5b519c3203658b8b0a01620fdd20297474c577be3f967828077012e5e13e6ee63c30bb4e8b7
41 DIST mariadb-10.3.23-patches-03.tar.xz 5520 BLAKE2B 30bc247ed6d97aefaa1ed48f379fc9aab3df3409aa9a108728313c7c69ab0641b69ccb0289eda9539df367f85b2db494473d3836807dfbf60df1e0c832e57369 SHA512 64bff196d1651348d303571fd551a5666d9514c1ee17cd9296b9d420c4b3d7d9b339644a1cad029bae3c35a666b405d471a37846138f2551f3b1b88d99b80844
42 DIST mariadb-10.3.23.tar.gz 72582611 BLAKE2B 493605519f714cbe87b938f6ca3243d29189adbfcbb33c4e10a4a3f01b08d875f18b96b647dc92566b785c2cef9862ebacfd55954d13ab0a7a745606e40fb6e9 SHA512 535cd2ce80a95b6c0a1aa559cc3275dfcd559c3a4f958fab3382923190a16e6bc5b4ad79acaa518244512ff618568c239c0edef8a701d958362ede19a29c2986
43 DIST mariadb-10.3.24-patches-01.tar.xz 5508 BLAKE2B c3b75205ecec0b73c85696a3382dd9271d495389f05d1bff66548f5f316f6d5f2ee7204020f265a6dd7ee7c28e1a010d74b056b9c9ab244651ba417e496fb1a9 SHA512 d9d408e6ba08a8a321b9a6e72a6347c4317652e91ade0056ff8621dafbbaf398e33d6b15247e89a2d60b731021d30cba9611356ced2cf848d1807cb3d376c378
44 -DIST mariadb-10.3.24.tar.gz 72714002 BLAKE2B c25a1546369e8996dea2a4d00022a8a5a4f11727866cb3d377aa534b617b76540fe49871c92d38487b667db68885e7aabe22a7400015f513394f18fdd2899bcd SHA512 cfd0154d984ddc344554cd3df1d02b0811f8e35c90caf745532491688850736d079c67d40e9414daba83f2bd0c06569bfc99213d5280c63cf051c68abd7c56b5
45 DIST mariadb-10.3.25.tar.gz 72710424 BLAKE2B 95029946e2ed04368beadf33b42121c612fa9d146e648fd584078e4df88e3c93f6373e1e996817644e06f3b2713a257e3079167434e9227db01dc1a2ad08aad0 SHA512 9504e401db3b65b2b2bd4d3c91a468d357e82fdafbf90d54539a291e46570c2bed66ae047b17b9da95e925f8970fa048d329ba06c2dd6de7d46d5a0f2aad1f4d
46 DIST mariadb-10.4.13-patches-03.tar.xz 5520 BLAKE2B 949b7f6ee5a9a6077424264e53d2b7af8ceb56cb38b204800e1c3ec93fc929d57b201e075f8ed735364b5421a3b922ba45fc94ba006f1e6d94494efa17b521ef SHA512 042c3ca8a75ebbb1c2baa508603d4248a178f87b7126b439ef6894eaab979f01c47cd8fbea3c106cce2a951e9308c76e72b4e444dcbee09a991cb524f2b9fac8
47 DIST mariadb-10.4.13.tar.gz 80608459 BLAKE2B e9ada14da6ec7492311068549a5b6e5a66e1177312013b25472c084a21fbace543ec43b47f2e12190d45432648d508f311198521f42359561f8d75ea60f98205 SHA512 68919ceffb3d4afdd0d94daa77439a954c82ce4e08fbe06044fc397940eeb88a39ec75932cbd08ff26ef3cf7636fdb779947cda5b2764aa1fd888be19c44b566
48 DIST mariadb-10.4.14-patches-01.tar.xz 5512 BLAKE2B f32e1d383ffd99de431bc34c36101c71c5e631344527e96b80ca6bd0a68015b45a4c33d6f0518cb4aa2bcfd493b64b6607671450ca045243404c0d65ebbc66fd SHA512 201fe82cbcca705dba52b32405d463b5569d97a5ffd9fd2967ec7fc3c3ff305011b3d2c3c0e9f7c19aaac57b26661bd361f3b6da6f3812f25934ec18856c7051
49 -DIST mariadb-10.4.14.tar.gz 80789865 BLAKE2B fed455e906af9fe105f52cc7180a6b8d8839fdbffac079f2ced265741c2ab8010c78c0e75ff77740d45a2bd02a15c379bdb3a0237152848a0ce1a7aaac4cbf32 SHA512 c09817c1dd7962132bcf2886c97ad17ce43c00ee687724028e5f39f6a6a93877ae8695c2c795abba6a4f3bc40674f93a53d6d43f46788a4a8a42c4a65a22c91c
50 DIST mariadb-10.4.15.tar.gz 80777094 BLAKE2B 576e06c1d62b399851e13fe0ac55ea94c462889bbd16ec25a2358e174e2822521008ad0dc021d742b1a12c5b22424208b6df92c2c0fb698a083b6a67a771bd64 SHA512 d7090e9e2a2b6fc5611fe498c44b00dbcd02e04456aaff3dc4cef7ef8cd284523776d01511f6f25f717306f6c49fca3f914d298f80e1c920cb6f9f87abebc0ca
51 DIST mariadb-10.5.5-patches-02.tar.xz 6060 BLAKE2B 185a2016836721f76c19228ca39c1c7610c34210e23b42f254e4c4fde34c74d9c77bb0d1a441175c14938ecafea3e9575fa3b7349db826aef63e7d7e7a21901a SHA512 8a26bdbec19d45739ef7accd3cea999bde465714141532d999500df2ebd93bb98a00b8b86b1e855ea4f0cba6984b21ff09beee75372f840282a91f5dc95db432
52 -DIST mariadb-10.5.5.tar.gz 86880268 BLAKE2B 58430dd4e7199d674bbd4f7381a56129e067ed1bb30c171545fe9fac3a83f7db2c57cc1b577ef242deb99dd69e17a1d3cbf756031711d27b04c97a7e93e14c60 SHA512 09bed291b39142f8e2f40eabbb443f6f384368b331406a09fd92d3d27ecc75644219066850d89495ed65c6f0d3ac32d51e29e65375331dcc2de4801313178d45
53 DIST mariadb-10.5.6.tar.gz 86884252 BLAKE2B b0230acf43d54e976c4e757139dbaa2bb6ed992b0d056728142fc7fa41bd62539be22eae5aac614ea49acf220646ee57ecc67ff1373c6aa142434e6743a4d174 SHA512 c62bd6278d389baf179962bc6f617693cf3ba748382e96963b1ef5bbee8d1c9f0964025cf00fb7ff5de088a79362b65657ed30a8adbb61fe524bfd0d8d753421
54 DIST mariadb-5.5.68.tar.gz 45969389 BLAKE2B 5b3a647649c614825adccbc83faa40ba330dae0a1f8005b2297cc6a44fbc00bf817f2d854af315f995e1065bd4d14a2f21a9cec44b5c78402524467d876d8157 SHA512 3419790aa88a7e2a5d80e56ca94683d22ca2d5d817dfe19904d11454f34cfc3b9d55e603295ea58580a3c9fe96a6c6f9b650e1058c4e8f2f2e82f09165436865
55 DIST mysql-extras-20190305-2052Z.tar.bz2 331304 BLAKE2B 1d2c35a961159fa5ce9ee6699fce943f5a5b5cf60b11c9bb4bcccee4943f4508a9eb6d01050c642353ac592ce1a6b421abf2a1bebc706c44c4c8a36aa698ec43 SHA512 ae63403320e010acbb92f8aec6da8ed4f267cef0bad37147d594076fd94571de7f98bfc2afbe94af5d716f58d57696fd958b1e13e20e87052f252ed4a188cd3c
56
57 diff --git a/dev-db/mariadb/mariadb-10.1.38-r2.ebuild b/dev-db/mariadb/mariadb-10.1.38-r2.ebuild
58 deleted file mode 100644
59 index b205f74ad1b..00000000000
60 --- a/dev-db/mariadb/mariadb-10.1.38-r2.ebuild
61 +++ /dev/null
62 @@ -1,892 +0,0 @@
63 -# Copyright 1999-2020 Gentoo Authors
64 -# Distributed under the terms of the GNU General Public License v2
65 -
66 -EAPI="6"
67 -MY_EXTRAS_VER="20190305-2052Z"
68 -SUBSLOT="18"
69 -
70 -JAVA_PKG_OPT_USE="jdbc"
71 -
72 -# Keeping eutils in EAPI=6 for emktemp in pkg_config
73 -
74 -inherit eutils systemd flag-o-matic prefix toolchain-funcs java-pkg-opt-2 user cmake-utils multilib-build
75 -
76 -SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz "
77 -
78 -# Gentoo patches to MySQL
79 -if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then
80 - SRC_URI="${SRC_URI}
81 - mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
82 - https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
83 - https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
84 - https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
85 - https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
86 -fi
87 -
88 -HOMEPAGE="https://mariadb.org/"
89 -DESCRIPTION="An enhanced, drop-in replacement for MySQL"
90 -LICENSE="GPL-2"
91 -SLOT="10.1/${SUBSLOT:-0}"
92 -IUSE="+backup bindist client-libs cracklib debug extraengine galera jdbc jemalloc kerberos
93 - innodb-lz4 innodb-lzo innodb-snappy latin1 libressl mroonga numa odbc oqgraph pam
94 - +perl profiling selinux +server sphinx sst-rsync sst-mariabackup sst-xtrabackup
95 - systemd systemtap static static-libs tcmalloc test tokudb xml yassl"
96 -
97 -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
98 -RESTRICT="!bindist? ( bindist ) !test? ( test ) libressl? ( test )"
99 -
100 -REQUIRED_USE="jdbc? ( extraengine server !static )
101 - server? ( tokudb? ( jemalloc !tcmalloc ) )
102 - ?? ( tcmalloc jemalloc )
103 - static? ( yassl !pam )"
104 -
105 -KEYWORDS="ppc ppc64"
106 -
107 -# Shorten the path because the socket path length must be shorter than 107 chars
108 -# and we will run a mysql server during test phase
109 -S="${WORKDIR}/mysql"
110 -
111 -if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then
112 - MY_PATCH_DIR="${WORKDIR%/}/mysql-extras"
113 - inherit git-r3
114 - EGIT_REPO_URI="git://anongit.gentoo.org/proj/mysql-extras.git"
115 - EGIT_CHECKOUT_DIR="${WORKDIR%/}/mysql-extras"
116 - EGIT_CLONE_TYPE=shallow
117 -else
118 - MY_PATCH_DIR="${WORKDIR%/}/mysql-extras-${MY_EXTRAS_VER}"
119 -fi
120 -
121 -PATCHES=(
122 - "${MY_PATCH_DIR}"/20006_all_cmake_elib-mariadb-10.1.27.patch
123 - "${MY_PATCH_DIR}"/20009_all_mariadb_myodbc_symbol_fix-5.5.38.patch
124 - "${MY_PATCH_DIR}"/20015_all_mariadb-pkgconfig-location.patch
125 - "${MY_PATCH_DIR}"/20018_all_mariadb-10.1.16-without-clientlibs-tools.patch
126 - "${MY_PATCH_DIR}"/20025_all_mariadb-10.1.26-gssapi-detect.patch
127 - "${MY_PATCH_DIR}"/20029_all_mariadb-10.1.37-enable-numa.patch
128 - "${MY_PATCH_DIR}"/20035_all_mariadb-10.1-atomic-detection.patch
129 -)
130 -
131 -# Be warned, *DEPEND are version-dependant
132 -# These are used for both runtime and compiletime
133 -COMMON_DEPEND="
134 - kernel_linux? (
135 - sys-process/procps:0=
136 - dev-libs/libaio:0=
137 - )
138 - >=sys-apps/sed-4
139 - >=sys-apps/texinfo-4.7-r1
140 - jemalloc? ( dev-libs/jemalloc:0= )
141 - tcmalloc? ( dev-util/google-perftools:0= )
142 - systemtap? ( >=dev-util/systemtap-1.3:0= )
143 - !yassl? (
144 - !libressl? ( dev-libs/openssl:0= !>=dev-libs/openssl-1.1 )
145 - libressl? ( dev-libs/libressl:0= )
146 - )
147 - >=sys-libs/zlib-1.2.3:0=
148 - sys-libs/ncurses:0=
149 - !bindist? (
150 - sys-libs/binutils-libs:0=
151 - >=sys-libs/readline-4.1:0=
152 - )
153 - server? (
154 - backup? ( app-arch/libarchive:0= )
155 - cracklib? ( sys-libs/cracklib:0= )
156 - extraengine? (
157 - odbc? ( dev-db/unixODBC:0= )
158 - xml? ( dev-libs/libxml2:2= )
159 - sys-libs/zlib[minizip]
160 - )
161 - innodb-lz4? ( app-arch/lz4 )
162 - innodb-lzo? ( dev-libs/lzo )
163 - innodb-snappy? ( app-arch/snappy )
164 - kerberos? ( virtual/krb5 )
165 - mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 )
166 - numa? ( sys-process/numactl )
167 - oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= )
168 - pam? ( sys-libs/pam:0= )
169 - systemd? ( sys-apps/systemd:= )
170 - tokudb? ( app-arch/snappy )
171 - )
172 - !yassl? ( !libressl? ( !>=dev-libs/openssl-1.1.0 ) )
173 - >=dev-libs/libpcre-8.41-r1:3=
174 - !client-libs? ( dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] )
175 -"
176 -DEPEND="virtual/yacc
177 - static? ( sys-libs/ncurses[static-libs] )
178 - || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
179 - server? ( extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) ) )
180 - ${COMMON_DEPEND}"
181 -RDEPEND="selinux? ( sec-policy/selinux-mysql )
182 - client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c )
183 - !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
184 - !dev-db/mariadb:0
185 - !dev-db/mariadb:5.5
186 - !dev-db/mariadb:10.2
187 - !dev-db/mariadb:10.3
188 - !dev-db/mariadb:10.4
189 - !dev-db/mariadb:10.5
190 - server? ( !prefix? ( dev-db/mysql-init-scripts ) )
191 - ${COMMON_DEPEND}
192 - server? ( galera? (
193 - sys-apps/iproute2
194 - =sys-cluster/galera-25*
195 - sst-rsync? ( sys-process/lsof )
196 - sst-mariabackup? ( net-misc/socat[ssl] )
197 - sst-xtrabackup? ( net-misc/socat[ssl] )
198 - ) )
199 - perl? ( !dev-db/mytop
200 - virtual/perl-Getopt-Long
201 - dev-perl/TermReadKey
202 - virtual/perl-Term-ANSIColor
203 - virtual/perl-Time-HiRes )
204 - server? ( extraengine? ( jdbc? ( >=virtual/jre-1.6 ) ) )
205 -"
206 -# For other stuff to bring us in
207 -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
208 -# percona-xtrabackup-bin causes a circular dependency if DBD-mysql is not already installed
209 -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )
210 - server? ( galera? ( sst-xtrabackup? ( || ( >=dev-db/percona-xtrabackup-bin-2.2.4 dev-db/percona-xtrabackup ) ) ) )"
211 -
212 -pkg_setup() {
213 - if [[ ${MERGE_TYPE} != binary ]] ; then
214 - local GCC_MAJOR_SET=$(gcc-major-version)
215 - local GCC_MINOR_SET=$(gcc-minor-version)
216 - if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \
217 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
218 - eerror "${PN} with tokudb needs to be built with gcc-4.7 or later."
219 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
220 - die
221 - fi
222 - # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
223 - # non x86{,_64} arches
224 - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
225 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
226 - eerror "${PN} needs to be built with gcc-4.7 or later."
227 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
228 - die
229 - fi
230 - fi
231 - java-pkg-opt-2_pkg_setup
232 - if has test ${FEATURES} && \
233 - use server && ! has userpriv ${FEATURES} ; then
234 - eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
235 - fi
236 -
237 - # This should come after all of the die statements
238 - enewgroup mysql 60 || die "problem adding 'mysql' group"
239 - enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
240 -}
241 -
242 -pkg_preinst() {
243 - java-pkg-opt-2_pkg_preinst
244 -}
245 -
246 -pkg_postinst() {
247 - # Make sure the vars are correctly initialized
248 - mysql_init_vars
249 -
250 - # Create log directory securely if it does not exist
251 - [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
252 -
253 - if use server ; then
254 - if use pam; then
255 - einfo
256 - elog "This install includes the PAM authentication plugin."
257 - elog "To activate and configure the PAM plugin, please read:"
258 - elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/"
259 - einfo
260 - fi
261 -
262 - if [[ -z "${REPLACING_VERSIONS}" ]] ; then
263 - einfo
264 - elog "You might want to run:"
265 - elog "\"emerge --config =${CATEGORY}/${PF}\""
266 - elog "if this is a new install."
267 - elog
268 - elog "If you are switching server implentations, you should run the"
269 - elog "mysql_upgrade tool."
270 - einfo
271 - else
272 - einfo
273 - elog "If you are upgrading major versions, you should run the"
274 - elog "mysql_upgrade tool."
275 - einfo
276 - fi
277 -
278 - einfo
279 - elog "Be sure to edit the my.cnf file to activate your cluster settings."
280 - elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
281 - elog "The first time the cluster is activated, you should add"
282 - elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
283 - elog "This option should then be removed for subsequent starts."
284 - einfo
285 - fi
286 -}
287 -
288 -src_unpack() {
289 - unpack ${A}
290 - # Grab the patches
291 - [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR%/}/mysql-extras" git-r3_src_unpack
292 -
293 - mv -f "${WORKDIR%/}/${PN%%-galera}-${PV}" "${S}" || die
294 -}
295 -
296 -src_prepare() {
297 - _disable_engine() {
298 - echo > "${S%/}/storage/${1}/CMakeLists.txt" || die
299 - }
300 -
301 - _disable_plugin() {
302 - echo > "${S%/}/plugin/${1}/CMakeLists.txt" || die
303 - }
304 -
305 - if use tcmalloc; then
306 - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S%/}/sql/CMakeLists.txt" || die
307 - fi
308 -
309 - # Don't build bundled xz-utils for tokudb
310 - echo > "${S%/}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die
311 - sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S%/}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die
312 - sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S%/}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die
313 -
314 - local plugin
315 - local server_plugins=( handler_socket auth_socket feedback metadata_lock_info
316 - locale_info qc_info server_audit semisync sql_errlog )
317 - local test_plugins=( audit_null auth_examples daemon_example fulltext )
318 - if ! use server; then # These plugins are for the server
319 - for plugin in "${server_plugins[@]}" ; do
320 - _disable_plugin "${plugin}"
321 - done
322 - fi
323 -
324 - if ! use test; then # These plugins are only used during testing
325 - for plugin in "${test_plugins[@]}" ; do
326 - _disable_plugin "${plugin}"
327 - done
328 - fi
329 -
330 - # Collides with mariadb-connector-c bug 655980
331 - _disable_plugin auth_dialog
332 -
333 - # Avoid useless library checks
334 - use mroonga || _disable_engine mroonga
335 - use oqgraph || _disable_engine oqgraph
336 - _disable_engine example
337 -
338 - cmake-utils_src_prepare
339 - java-pkg-opt-2_src_prepare
340 -}
341 -
342 -src_configure() {
343 - # bug 508724 mariadb cannot use ld.gold
344 - tc-ld-disable-gold
345 - # Bug #114895, bug #110149
346 - filter-flags "-O" "-O[01]"
347 -
348 - append-cxxflags -felide-constructors
349 -
350 - # bug #283926, with GCC4.4, this is required to get correct behavior.
351 - append-flags -fno-strict-aliasing
352 -
353 - CMAKE_BUILD_TYPE="RelWithDebInfo"
354 -
355 - # debug hack wrt #497532
356 - mycmakeargs=(
357 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
358 - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
359 - -DDEFAULT_SYSCONFDIR="${EPREFIX}/etc/mysql"
360 - -DINSTALL_BINDIR=bin
361 - -DINSTALL_DOCDIR=share/doc/${PF}
362 - -DINSTALL_DOCREADMEDIR=share/doc/${PF}
363 - -DINSTALL_INCLUDEDIR=include/mysql
364 - -DINSTALL_INFODIR=share/info
365 - -DINSTALL_LIBDIR=$(get_libdir)
366 - -DINSTALL_MANDIR=share/man
367 - -DINSTALL_MYSQLSHAREDIR=share/mariadb
368 - -DINSTALL_MYSQLTESTDIR=$(usex test 'share/mariadb/mysql-test' '')
369 - -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin
370 - -DINSTALL_SCRIPTDIR=share/mariadb/scripts
371 - -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql"
372 - -DINSTALL_SBINDIR=sbin
373 - -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb"
374 - -DCOMPILATION_COMMENT="Gentoo Linux ${PF}"
375 - -DWITH_UNIT_TESTS=$(usex test ON OFF)
376 - -DWITH_ZLIB=system
377 - -DENABLED_LOCAL_INFILE=1
378 - -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock"
379 - -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock"
380 - -DWITH_DEFAULT_COMPILER_OPTIONS=0
381 - -DWITH_DEFAULT_FEATURE_SET=0
382 - -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)"
383 - # The build forces this to be defined when cross-compiling. We pass it
384 - # all the time for simplicity and to make sure it is actually correct.
385 - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
386 - -DWITHOUT_CLIENTLIBS=YES
387 - -DWITH_READLINE=$(usex bindist 1 0)
388 - -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1)
389 - -DENABLE_DTRACE=$(usex systemtap)
390 - -DWITH_SSL=$(usex yassl bundled system)
391 - )
392 -
393 - if use server ; then
394 -
395 - # Federated{,X} must be treated special otherwise they will not be built as plugins
396 - if ! use extraengine ; then
397 - mycmakeargs+=(
398 - -DPLUGIN_FEDERATED=NO
399 - -DPLUGIN_FEDERATEDX=NO )
400 - fi
401 -
402 - mycmakeargs+=(
403 - -DWITH_JEMALLOC=$(usex jemalloc system)
404 - -DWITH_PCRE=system
405 - -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO)
406 - -DPLUGIN_SPHINX=$(usex sphinx YES NO)
407 - -DPLUGIN_TOKUDB=$(usex tokudb YES NO)
408 - -DPLUGIN_AUTH_PAM=$(usex pam YES NO)
409 - -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO)
410 - -DPLUGIN_CASSANDRA=NO
411 - -DPLUGIN_SEQUENCE=$(usex extraengine YES NO)
412 - -DPLUGIN_SPIDER=$(usex extraengine YES NO)
413 - -DPLUGIN_CONNECT=$(usex extraengine YES NO)
414 - -DCONNECT_WITH_MYSQL=1
415 - -DCONNECT_WITH_LIBXML2=$(usex xml)
416 - -DCONNECT_WITH_ODBC=$(usex odbc)
417 - -DCONNECT_WITH_JDBC=$(usex jdbc)
418 - # Build failure and autodep wrt bug 639144
419 - -DCONNECT_WITH_MONGO=OFF
420 - -DWITH_WSREP=$(usex galera)
421 - -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF)
422 - -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF)
423 - -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF)
424 - -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO)
425 - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
426 - -DPLUGIN_AUTH_GSSAPI_CLIENT=NO
427 - -DWITH_MARIABACKUP=$(usex backup ON OFF)
428 - -DWITH_LIBARCHIVE=$(usex backup ON OFF)
429 - -DWITH_SYSTEMD=$(usex systemd yes no)
430 - -DWITH_NUMA=$(usex numa ON OFF)
431 - -DINSTALL_SQLBENCHDIR=''
432 - )
433 -
434 - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
435 - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
436 - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
437 - ewarn "You MUST file bugs without these variables set."
438 -
439 - mycmakeargs+=(
440 - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
441 - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
442 - )
443 -
444 - elif ! use latin1 ; then
445 - mycmakeargs+=(
446 - -DDEFAULT_CHARSET=utf8
447 - -DDEFAULT_COLLATION=utf8_general_ci
448 - )
449 - else
450 - mycmakeargs+=(
451 - -DDEFAULT_CHARSET=latin1
452 - -DDEFAULT_COLLATION=latin1_swedish_ci
453 - )
454 - fi
455 - mycmakeargs+=(
456 - -DEXTRA_CHARSETS=all
457 - -DMYSQL_USER=mysql
458 - -DDISABLE_SHARED=$(usex static YES NO)
459 - -DWITH_DEBUG=$(usex debug)
460 - -DWITH_EMBEDDED_SERVER=OFF
461 - -DENABLED_PROFILING=$(usex profiling)
462 - )
463 -
464 - if use static; then
465 - mycmakeargs+=( -DWITH_PIC=1 )
466 - fi
467 -
468 - if use jemalloc || use tcmalloc ; then
469 - mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
470 - fi
471 -
472 - # Storage engines
473 - mycmakeargs+=(
474 - -DWITH_ARCHIVE_STORAGE_ENGINE=1
475 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1
476 - -DWITH_CSV_STORAGE_ENGINE=1
477 - -DWITH_HEAP_STORAGE_ENGINE=1
478 - -DWITH_INNOBASE_STORAGE_ENGINE=1
479 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1
480 - -DWITH_MYISAM_STORAGE_ENGINE=1
481 - -DWITH_PARTITION_STORAGE_ENGINE=1
482 - )
483 -
484 - else
485 - mycmakeargs+=(
486 - -DWITHOUT_SERVER=1
487 - -DWITH_EMBEDDED_SERVER=OFF
488 - -DEXTRA_CHARSETS=none
489 - -DINSTALL_SQLBENCHDIR=
490 - -DWITH_SYSTEMD=no
491 - )
492 - fi
493 -
494 - cmake-utils_src_configure
495 -}
496 -
497 -src_compile() {
498 - cmake-utils_src_compile
499 -}
500 -
501 -src_install() {
502 - cmake-utils_src_install
503 -
504 - # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used
505 - if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then
506 - rm "${ED}/usr/include/mysql/server/private/config.h" || die
507 - fi
508 -
509 - # Make sure the vars are correctly initialized
510 - mysql_init_vars
511 -
512 - # Convenience links
513 - einfo "Making Convenience links for mysqlcheck multi-call binary"
514 - dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
515 - dosym "mysqlcheck" "/usr/bin/mysqlrepair"
516 - dosym "mysqlcheck" "/usr/bin/mysqloptimize"
517 -
518 - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
519 - if [[ -d "${ED}/usr/data" ]] ; then
520 - rm -Rf "${ED}/usr/data" || die
521 - fi
522 -
523 - # Unless they explicitly specific USE=test, then do not install the
524 - # testsuite. It DOES have a use to be installed, esp. when you want to do a
525 - # validation of your database configuration after tuning it.
526 - if ! use test ; then
527 - rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
528 - fi
529 -
530 - # Configuration stuff
531 - einfo "Building default configuration ..."
532 - insinto "${MY_SYSCONFDIR#${EPREFIX}}"
533 - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
534 - local mycnf_src="my.cnf-5.6-r1"
535 - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
536 - "${FILESDIR}/${mycnf_src}" \
537 - > "${TMPDIR}/my.cnf.ok" || die
538 - use prefix && sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' "${TMPDIR}/my.cnf.ok"
539 - if use latin1 ; then
540 - sed -i \
541 - -e "/character-set/s|utf8|latin1|g" \
542 - "${TMPDIR}/my.cnf.ok" || die
543 - fi
544 - eprefixify "${TMPDIR}/my.cnf.ok"
545 - newins "${TMPDIR}/my.cnf.ok" my.cnf
546 -
547 - if use server ; then
548 - einfo "Including support files and sample configurations"
549 - docinto "support-files"
550 - local script
551 - for script in \
552 - "${S}"/support-files/magic
553 - do
554 - [[ -f "$script" ]] && dodoc "${script}"
555 - done
556 -
557 - docinto "scripts"
558 - for script in "${S}"/scripts/mysql* ; do
559 - [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
560 - done
561 - # Manually install supporting files that conflict with other packages
562 - # but are needed for galera and initial installation
563 - exeinto /usr/libexec/mariadb
564 - doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror"
565 - fi
566 -
567 - #Remove mytop if perl is not selected
568 - [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop"
569 -}
570 -
571 -# Official test instructions:
572 -# USE='extraengine perl server' \
573 -# FEATURES='test userpriv -usersandbox' \
574 -# ebuild mariadb-X.X.XX.ebuild \
575 -# digest clean package
576 -src_test() {
577 -
578 - _disable_test() {
579 - local rawtestname reason
580 - rawtestname="${1}" ; shift
581 - reason="${@}"
582 - ewarn "test '${rawtestname}' disabled: '${reason}'"
583 - echo ${rawtestname} : ${reason} >> "${T}/disabled.def"
584 - }
585 -
586 - local TESTDIR="${BUILD_DIR}/mysql-test"
587 - local retstatus_unit
588 - local retstatus_tests
589 -
590 - if ! use server ; then
591 - einfo "Skipping server tests due to minimal build."
592 - return 0
593 - fi
594 -
595 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
596 - # localhost. Also causes weird failures.
597 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
598 -
599 - if [[ $UID -eq 0 ]]; then
600 - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
601 - fi
602 - has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox"
603 -
604 - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
605 -
606 - # Run CTest (test-units)
607 -# cmake-utils_src_test
608 -# retstatus_unit=$?
609 -
610 - # Ensure that parallel runs don't die
611 - export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
612 - # Enable parallel testing, auto will try to detect number of cores
613 - # You may set this by hand.
614 - # The default maximum is 8 unless MTR_MAX_PARALLEL is increased
615 - export MTR_PARALLEL="${MTR_PARALLEL:-auto}"
616 -
617 - # create directories because mysqladmin might run out of order
618 - mkdir -p "${T}"/var-tests{,/log} || die
619 -
620 - # Run mysql tests
621 - pushd "${TESTDIR}" > /dev/null || die
622 -
623 - touch "${T}/disabled.def"
624 - # These are failing in MariaDB 10.0 for now and are believed to be
625 - # false positives:
626 - #
627 - # main.mysql_client_test, main.mysql_client_test_nonblock
628 - # main.mysql_client_test_comp:
629 - # segfaults at random under Portage only, suspect resource limits.
630 -
631 - local t
632 - for t in plugins.cracklib_password_check plugins.two_password_validations ; do
633 - _disable_test "$t" "False positive due to varying policies"
634 - done
635 -
636 - for t in main.mysql_client_test main.mysql_client_test_nonblock \
637 - rpl.rpl_semi_sync_uninstall_plugin \
638 - main.mysql_client_test_comp rpl.rpl_extra_col_master_myisam ; do
639 - _disable_test "$t" "False positives in Gentoo"
640 - done
641 -
642 - if ! use client-libs ; then
643 - _disable_test main.plugin_auth "Needs client libraries built"
644 - fi
645 -
646 - _disable_test sys_vars.sysvars_server_notembedded "Broken test" # bug #661700 required profiling always on
647 -
648 - # run mysql-test tests
649 - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def"
650 - retstatus_tests=$?
651 -
652 - popd > /dev/null || die
653 -
654 - # Cleanup is important for these testcases.
655 - pkill -9 -f "${S}/ndb" 2>/dev/null
656 - pkill -9 -f "${S}/sql" 2>/dev/null
657 -
658 - local failures=""
659 - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
660 - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
661 -
662 - [[ -z "$failures" ]] || die "Test failures: $failures"
663 - einfo "Tests successfully completed"
664 -}
665 -
666 -mysql_init_vars() {
667 - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"}
668 - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
669 - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
670 - MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
671 -
672 - if [[ -z "${MY_DATADIR}" ]] ; then
673 - MY_DATADIR=""
674 - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
675 - MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
676 - | sed -ne '/datadir/s|^--datadir=||p' \
677 - | tail -n1`
678 - if [[ -z "${MY_DATADIR}" ]] ; then
679 - MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
680 - | sed -e 's/.*=\s*//' \
681 - | tail -n1`
682 - fi
683 - fi
684 - if [[ -z "${MY_DATADIR}" ]] ; then
685 - MY_DATADIR="${MY_LOCALSTATEDIR}"
686 - einfo "Using default MY_DATADIR"
687 - fi
688 - elog "MySQL MY_DATADIR is ${MY_DATADIR}"
689 -
690 - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
691 - if [[ -e "${MY_DATADIR}" ]] ; then
692 - # If you get this and you're wondering about it, see bug #207636
693 - elog "MySQL datadir found in ${MY_DATADIR}"
694 - elog "A new one will not be created."
695 - PREVIOUS_DATADIR="yes"
696 - else
697 - PREVIOUS_DATADIR="no"
698 - fi
699 - export PREVIOUS_DATADIR
700 - fi
701 - else
702 - if [[ ${EBUILD_PHASE} == "config" ]]; then
703 - local new_MY_DATADIR
704 - new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
705 - | sed -ne '/datadir/s|^--datadir=||p' \
706 - | tail -n1`
707 -
708 - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
709 - ewarn "MySQL MY_DATADIR has changed"
710 - ewarn "from ${MY_DATADIR}"
711 - ewarn "to ${new_MY_DATADIR}"
712 - MY_DATADIR="${new_MY_DATADIR}"
713 - fi
714 - fi
715 - fi
716 -
717 - export MY_SHAREDSTATEDIR MY_SYSCONFDIR
718 - export MY_LOCALSTATEDIR MY_LOGDIR
719 - export MY_DATADIR
720 -}
721 -
722 -pkg_config() {
723 - _getoptval() {
724 - local mypd="${EROOT}"/usr/bin/my_print_defaults
725 - local section="$1"
726 - local flag="--${2}="
727 - local extra_options="${3}"
728 - "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp"
729 - }
730 - local old_MY_DATADIR="${MY_DATADIR}"
731 - local old_HOME="${HOME}"
732 - # my_print_defaults needs to read stuff in $HOME/.my.cnf
733 - export HOME=${EPREFIX}/root
734 -
735 - # Make sure the vars are correctly initialized
736 - mysql_init_vars
737 -
738 - [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
739 - if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then
740 - die "Minimal builds do NOT include the MySQL server"
741 - fi
742 -
743 - if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then
744 - local MY_DATADIR_s="${ROOT}/${MY_DATADIR}"
745 - MY_DATADIR_s="${MY_DATADIR_s%%/}"
746 - local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}"
747 - old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
748 -
749 - if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then
750 - if [[ -d "${MY_DATADIR_s}" ]]; then
751 - ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
752 - ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
753 - else
754 - elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
755 - mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
756 - || die "Moving MY_DATADIR failed"
757 - fi
758 - else
759 - ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
760 - if [[ -d "${MY_DATADIR_s}" ]]; then
761 - ewarn "Attempting to use ${MY_DATADIR_s}"
762 - else
763 - eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
764 - die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
765 - fi
766 - fi
767 - fi
768 -
769 - local pwd1="a"
770 - local pwd2="b"
771 - local maxtry=15
772 -
773 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
774 - local tmp_mysqld_password_source=
775 -
776 - for tmp_mysqld_password_source in mysql client; do
777 - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
778 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
779 - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then
780 - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then
781 - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
782 - MYSQL_ROOT_PASSWORD=
783 - continue
784 - fi
785 -
786 - einfo "Found password in '${tmp_mysqld_password_source}' section!"
787 - break
788 - fi
789 - done
790 -
791 - # Sometimes --show is required to display passwords in some implementations of my_print_defaults
792 - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then
793 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
794 - fi
795 -
796 - unset tmp_mysqld_password_source
797 - fi
798 - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir)"
799 - # These are dir+prefix
800 - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log)"
801 - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
802 - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin)"
803 - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
804 -
805 - if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then
806 - einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
807 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR"
808 - fi
809 - if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then
810 - einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
811 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN"
812 - fi
813 - if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then
814 - einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
815 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG"
816 - fi
817 -
818 - if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then
819 - ewarn "You have already a MySQL database in place."
820 - ewarn "(${ROOT}/${MY_DATADIR}/*)"
821 - ewarn "Please rename or delete it if you wish to replace it."
822 - die "MySQL database already exists!"
823 - fi
824 -
825 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
826 - # localhost. Also causes weird failures.
827 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
828 -
829 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
830 -
831 - einfo "Please provide a password for the mysql 'root' user now"
832 - einfo "or through the ${HOME}/.my.cnf file."
833 - ewarn "Avoid [\"'\\_%] characters in the password"
834 - read -rsp " >" pwd1 ; echo
835 -
836 - einfo "Retype the password"
837 - read -rsp " >" pwd2 ; echo
838 -
839 - if [[ "x$pwd1" != "x$pwd2" ]] ; then
840 - die "Passwords are not the same"
841 - fi
842 - MYSQL_ROOT_PASSWORD="${pwd1}"
843 - unset pwd1 pwd2
844 - fi
845 -
846 - local options
847 - local sqltmp="$(emktemp)"
848 -
849 - # Fix bug 446200. Don't reference host my.cnf, needs to come first,
850 - # see https://bugs.mysql.com/bug.php?id=31312
851 - use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
852 -
853 - # Figure out which options we need to disable to do the setup
854 - local helpfile="${TMPDIR}/mysqld-help"
855 - "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
856 - for opt in grant-tables host-cache name-resolve networking slave-start \
857 - federated ssl log-bin relay-log slow-query-log external-locking \
858 - log-slave-updates \
859 - ; do
860 - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
861 - egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
862 - done
863 -
864 - einfo "Creating the mysql database and setting proper permissions on it ..."
865 -
866 - # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
867 - PID_DIR="${EROOT}/var/run/mysqld"
868 - if [[ ! -d "${PID_DIR}" ]]; then
869 - install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
870 - fi
871 -
872 - if [[ ! -d "${MY_DATADIR}" ]]; then
873 - install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory"
874 - fi
875 -
876 - pushd "${TMPDIR}" &>/dev/null || die
877 -
878 - # Filling timezones, see
879 - # https://dev.mysql.com/doc/mysql/en/time-zone-support.html
880 - "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null
881 -
882 - local cmd=( "${EROOT}usr/share/mariadb/scripts/mysql_install_db" )
883 - [[ -f "${cmd}" ]] || cmd=( "${EROOT}usr/bin/mysql_install_db" )
884 - cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" )
885 - einfo "Command: ${cmd[*]}"
886 - su -s /bin/sh -c "${cmd[*]}" mysql \
887 - >"${TMPDIR}"/mysql_install_db.log 2>&1
888 - if [ $? -ne 0 ]; then
889 - grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2
890 - die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log"
891 - fi
892 - popd &>/dev/null || die
893 - [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \
894 - || die "MySQL databases not installed"
895 -
896 - use prefix || options="${options} --user=mysql"
897 -
898 - local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock"
899 - local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid"
900 - local mysqld="${EROOT}/usr/sbin/mysqld \
901 - ${options} \
902 - --log-warnings=0 \
903 - --basedir=${EROOT}/usr \
904 - --datadir=${ROOT}/${MY_DATADIR} \
905 - --max_allowed_packet=8M \
906 - --net_buffer_length=16K \
907 - --socket=${socket} \
908 - --pid-file=${pidfile} \
909 - --tmpdir=${ROOT}/${MYSQL_TMPDIR}"
910 - #einfo "About to start mysqld: ${mysqld}"
911 - ebegin "Starting mysqld"
912 - einfo "Command ${mysqld}"
913 - ${mysqld} &
914 - rc=$?
915 - while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
916 - maxtry=$((${maxtry}-1))
917 - echo -n "."
918 - sleep 1
919 - done
920 - eend $rc
921 -
922 - if ! [[ -S "${socket}" ]]; then
923 - die "Completely failed to start up mysqld with: ${mysqld}"
924 - fi
925 -
926 - ebegin "Setting root password"
927 - # Do this from memory, as we don't want clear text passwords in temp files
928 - local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES"
929 - "${EROOT}/usr/bin/mysql" \
930 - "--socket=${socket}" \
931 - -hlocalhost \
932 - -e "${sql}"
933 - eend $?
934 -
935 - if [[ -n "${sqltmp}" ]] ; then
936 - ebegin "Loading \"zoneinfo\", this step may require a few seconds"
937 - "${EROOT}/usr/bin/mysql" \
938 - "--socket=${socket}" \
939 - -hlocalhost \
940 - -uroot \
941 - --password="${MYSQL_ROOT_PASSWORD}" \
942 - mysql < "${sqltmp}"
943 - rc=$?
944 - eend $?
945 - [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!"
946 - fi
947 -
948 - # Stop the server and cleanup
949 - einfo "Stopping the server ..."
950 - kill $(< "${pidfile}" )
951 - rm -f "${sqltmp}"
952 - wait %1
953 - einfo "Done"
954 -}
955
956 diff --git a/dev-db/mariadb/mariadb-10.1.45-r1.ebuild b/dev-db/mariadb/mariadb-10.1.45-r1.ebuild
957 deleted file mode 100644
958 index 616c340d5a8..00000000000
959 --- a/dev-db/mariadb/mariadb-10.1.45-r1.ebuild
960 +++ /dev/null
961 @@ -1,925 +0,0 @@
962 -# Copyright 1999-2020 Gentoo Authors
963 -# Distributed under the terms of the GNU General Public License v2
964 -
965 -EAPI="6"
966 -SUBSLOT="18"
967 -
968 -JAVA_PKG_OPT_USE="jdbc"
969 -
970 -# Keeping eutils in EAPI=6 for emktemp in pkg_config
971 -
972 -inherit eutils systemd flag-o-matic prefix toolchain-funcs \
973 - multiprocessing java-pkg-opt-2 cmake-utils multilib-build
974 -
975 -# Patch version
976 -PATCH_SET="https://dev.gentoo.org/~whissi/dist/${PN}/${PN}-10.1.45-patches-04.tar.xz"
977 -
978 -SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz
979 - ${PATCH_SET}"
980 -
981 -HOMEPAGE="https://mariadb.org/"
982 -DESCRIPTION="An enhanced, drop-in replacement for MySQL"
983 -LICENSE="GPL-2"
984 -SLOT="10.1/${SUBSLOT:-0}"
985 -IUSE="+backup bindist client-libs cracklib debug extraengine galera jdbc jemalloc kerberos
986 - innodb-lz4 innodb-lzo innodb-snappy latin1 libressl mroonga numa odbc oqgraph pam
987 - +perl profiling selinux +server sphinx sst-rsync sst-mariabackup sst-xtrabackup
988 - systemd systemtap static static-libs tcmalloc test tokudb xml yassl"
989 -
990 -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
991 -RESTRICT="!bindist? ( bindist ) libressl? ( test ) !test? ( test )"
992 -
993 -REQUIRED_USE="jdbc? ( extraengine server !static )
994 - server? ( tokudb? ( jemalloc !tcmalloc ) )
995 - ?? ( tcmalloc jemalloc )
996 - static? ( yassl !pam )"
997 -
998 -KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
999 -
1000 -# Shorten the path because the socket path length must be shorter than 107 chars
1001 -# and we will run a mysql server during test phase
1002 -S="${WORKDIR}/mysql"
1003 -
1004 -# Be warned, *DEPEND are version-dependant
1005 -# These are used for both runtime and compiletime
1006 -COMMON_DEPEND="
1007 - kernel_linux? (
1008 - sys-process/procps:0=
1009 - dev-libs/libaio:0=
1010 - )
1011 - >=sys-apps/sed-4
1012 - >=sys-apps/texinfo-4.7-r1
1013 - jemalloc? ( dev-libs/jemalloc:0= )
1014 - tcmalloc? ( dev-util/google-perftools:0= )
1015 - systemtap? ( >=dev-util/systemtap-1.3:0= )
1016 - !yassl? (
1017 - !libressl? ( dev-libs/openssl:0= !>=dev-libs/openssl-1.1 )
1018 - libressl? ( dev-libs/libressl:0= )
1019 - )
1020 - >=sys-libs/zlib-1.2.3:0=
1021 - sys-libs/ncurses:0=
1022 - !bindist? (
1023 - sys-libs/binutils-libs:0=
1024 - >=sys-libs/readline-4.1:0=
1025 - )
1026 - server? (
1027 - backup? ( app-arch/libarchive:0= )
1028 - cracklib? ( sys-libs/cracklib:0= )
1029 - extraengine? (
1030 - odbc? ( dev-db/unixODBC:0= )
1031 - xml? ( dev-libs/libxml2:2= )
1032 - sys-libs/zlib[minizip]
1033 - )
1034 - innodb-lz4? ( app-arch/lz4 )
1035 - innodb-lzo? ( dev-libs/lzo )
1036 - innodb-snappy? ( app-arch/snappy )
1037 - kerberos? ( virtual/krb5 )
1038 - mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 )
1039 - numa? ( sys-process/numactl )
1040 - oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= )
1041 - pam? ( sys-libs/pam:0= )
1042 - systemd? ( sys-apps/systemd:= )
1043 - tokudb? ( app-arch/snappy )
1044 - )
1045 - !yassl? ( !libressl? ( !>=dev-libs/openssl-1.1.0 ) )
1046 - >=dev-libs/libpcre-8.41-r1:3=
1047 - !client-libs? ( dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] )
1048 -"
1049 -DEPEND="virtual/yacc
1050 - static? ( sys-libs/ncurses[static-libs] )
1051 - || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
1052 - server? (
1053 - extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) )
1054 - test? ( acct-group/mysql acct-user/mysql )
1055 - )
1056 - ${COMMON_DEPEND}"
1057 -RDEPEND="selinux? ( sec-policy/selinux-mysql )
1058 - client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c )
1059 - !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
1060 - !dev-db/mariadb:0
1061 - !dev-db/mariadb:5.5
1062 - !dev-db/mariadb:10.2
1063 - !dev-db/mariadb:10.3
1064 - !dev-db/mariadb:10.4
1065 - !dev-db/mariadb:10.5
1066 - ${COMMON_DEPEND}
1067 - server? (
1068 - galera? (
1069 - sys-apps/iproute2
1070 - =sys-cluster/galera-25*
1071 - sst-rsync? ( sys-process/lsof )
1072 - sst-mariabackup? ( net-misc/socat[ssl] )
1073 - sst-xtrabackup? ( net-misc/socat[ssl] )
1074 - )
1075 - !prefix? ( dev-db/mysql-init-scripts acct-group/mysql acct-user/mysql )
1076 - extraengine? ( jdbc? ( >=virtual/jre-1.6 ) )
1077 - )
1078 - perl? (
1079 - !dev-db/mytop
1080 - virtual/perl-Getopt-Long
1081 - dev-perl/TermReadKey
1082 - virtual/perl-Term-ANSIColor
1083 - virtual/perl-Time-HiRes
1084 - )
1085 -"
1086 -# For other stuff to bring us in
1087 -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
1088 -# percona-xtrabackup-bin causes a circular dependency if DBD-mysql is not already installed
1089 -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )
1090 - server? ( galera? ( sst-xtrabackup? ( || ( >=dev-db/percona-xtrabackup-bin-2.2.4 dev-db/percona-xtrabackup ) ) ) )"
1091 -
1092 -mysql_init_vars() {
1093 - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"}
1094 - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
1095 - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
1096 - MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
1097 -
1098 - if [[ -z "${MY_DATADIR}" ]] ; then
1099 - MY_DATADIR=""
1100 - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
1101 - MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \
1102 - | sed -ne '/datadir/s|^--datadir=||p' \
1103 - | tail -n1)
1104 - if [[ -z "${MY_DATADIR}" ]] ; then
1105 - MY_DATADIR=$(grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
1106 - | sed -e 's/.*=\s*//' \
1107 - | tail -n1)
1108 - fi
1109 - fi
1110 - if [[ -z "${MY_DATADIR}" ]] ; then
1111 - MY_DATADIR="${MY_LOCALSTATEDIR}"
1112 - einfo "Using default MY_DATADIR"
1113 - fi
1114 - elog "MySQL MY_DATADIR is ${MY_DATADIR}"
1115 -
1116 - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
1117 - if [[ -e "${MY_DATADIR}" ]] ; then
1118 - # If you get this and you're wondering about it, see bug #207636
1119 - elog "MySQL datadir found in ${MY_DATADIR}"
1120 - elog "A new one will not be created."
1121 - PREVIOUS_DATADIR="yes"
1122 - else
1123 - PREVIOUS_DATADIR="no"
1124 - fi
1125 - export PREVIOUS_DATADIR
1126 - fi
1127 - else
1128 - if [[ ${EBUILD_PHASE} == "config" ]]; then
1129 - local new_MY_DATADIR
1130 - new_MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \
1131 - | sed -ne '/datadir/s|^--datadir=||p' \
1132 - | tail -n1)
1133 -
1134 - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
1135 - ewarn "MySQL MY_DATADIR has changed"
1136 - ewarn "from ${MY_DATADIR}"
1137 - ewarn "to ${new_MY_DATADIR}"
1138 - MY_DATADIR="${new_MY_DATADIR}"
1139 - fi
1140 - fi
1141 - fi
1142 -
1143 - export MY_SHAREDSTATEDIR MY_SYSCONFDIR
1144 - export MY_LOCALSTATEDIR MY_LOGDIR
1145 - export MY_DATADIR
1146 -}
1147 -
1148 -pkg_setup() {
1149 - if [[ ${MERGE_TYPE} != binary ]] ; then
1150 - local GCC_MAJOR_SET=$(gcc-major-version)
1151 - local GCC_MINOR_SET=$(gcc-minor-version)
1152 -
1153 - if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \
1154 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
1155 - eerror "${PN} with tokudb needs to be built with gcc-4.7 or later."
1156 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
1157 - die
1158 - fi
1159 -
1160 - # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
1161 - # non x86{,_64} arches
1162 - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
1163 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
1164 - eerror "${PN} needs to be built with gcc-4.7 or later."
1165 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
1166 - die
1167 - fi
1168 -
1169 - if has test ${FEATURES} ; then
1170 - # Bug #213475 - MySQL _will_ object strenuously if your machine is named
1171 - # localhost. Also causes weird failures.
1172 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
1173 -
1174 - if ! has userpriv ${FEATURES} ; then
1175 - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
1176 - fi
1177 - fi
1178 - fi
1179 -
1180 - java-pkg-opt-2_pkg_setup
1181 -}
1182 -
1183 -src_unpack() {
1184 - unpack ${A}
1185 -
1186 - mv -f "${WORKDIR%/}/${PN%%-galera}-${PV}" "${S}" || die
1187 -}
1188 -
1189 -src_prepare() {
1190 - eapply "${WORKDIR}"/mariadb-patches
1191 -
1192 - eapply_user
1193 -
1194 - _disable_engine() {
1195 - echo > "${S%/}/storage/${1}/CMakeLists.txt" || die
1196 - }
1197 -
1198 - _disable_plugin() {
1199 - echo > "${S%/}/plugin/${1}/CMakeLists.txt" || die
1200 - }
1201 -
1202 - if use tcmalloc; then
1203 - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S%/}/sql/CMakeLists.txt" || die
1204 - fi
1205 -
1206 - # Don't build bundled xz-utils for tokudb
1207 - echo > "${S%/}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die
1208 - sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S%/}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die
1209 - sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S%/}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die
1210 -
1211 - # Fix -fno-common error
1212 - sed -i -e '/^datasink_t datasink_buffer;$/d' extra/mariabackup/xbstream.c || die
1213 -
1214 - local plugin
1215 - local server_plugins=( handler_socket auth_socket feedback metadata_lock_info
1216 - locale_info qc_info server_audit semisync sql_errlog )
1217 - local test_plugins=( audit_null auth_examples daemon_example fulltext )
1218 - if ! use server; then # These plugins are for the server
1219 - for plugin in "${server_plugins[@]}" ; do
1220 - _disable_plugin "${plugin}"
1221 - done
1222 - fi
1223 -
1224 - if ! use test; then # These plugins are only used during testing
1225 - for plugin in "${test_plugins[@]}" ; do
1226 - _disable_plugin "${plugin}"
1227 - done
1228 - fi
1229 -
1230 - # Collides with mariadb-connector-c bug 655980
1231 - _disable_plugin auth_dialog
1232 -
1233 - # Avoid useless library checks
1234 - use mroonga || _disable_engine mroonga
1235 - use oqgraph || _disable_engine oqgraph
1236 - _disable_engine example
1237 -
1238 - cmake-utils_src_prepare
1239 - java-pkg-opt-2_src_prepare
1240 -}
1241 -
1242 -src_configure() {
1243 - # bug 508724 mariadb cannot use ld.gold
1244 - tc-ld-disable-gold
1245 - # Bug #114895, bug #110149
1246 - filter-flags "-O" "-O[01]"
1247 -
1248 - append-cxxflags -felide-constructors
1249 -
1250 - # bug #283926, with GCC4.4, this is required to get correct behavior.
1251 - append-flags -fno-strict-aliasing
1252 -
1253 - CMAKE_BUILD_TYPE="RelWithDebInfo"
1254 -
1255 - # debug hack wrt #497532
1256 - mycmakeargs=(
1257 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
1258 - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
1259 - -DDEFAULT_SYSCONFDIR="${EPREFIX}/etc/mysql"
1260 - -DINSTALL_BINDIR=bin
1261 - -DINSTALL_DOCDIR=share/doc/${PF}
1262 - -DINSTALL_DOCREADMEDIR=share/doc/${PF}
1263 - -DINSTALL_INCLUDEDIR=include/mysql
1264 - -DINSTALL_INFODIR=share/info
1265 - -DINSTALL_LIBDIR=$(get_libdir)
1266 - -DINSTALL_MANDIR=share/man
1267 - -DINSTALL_MYSQLSHAREDIR=share/mariadb
1268 - -DINSTALL_MYSQLTESTDIR=$(usex test 'share/mariadb/mysql-test' '')
1269 - -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin
1270 - -DINSTALL_SCRIPTDIR=share/mariadb/scripts
1271 - -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql"
1272 - -DINSTALL_SBINDIR=sbin
1273 - -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb"
1274 - -DCOMPILATION_COMMENT="Gentoo Linux ${PF}"
1275 - -DWITH_UNIT_TESTS=$(usex test ON OFF)
1276 - -DWITH_ZLIB=system
1277 - -DENABLED_LOCAL_INFILE=1
1278 - -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock"
1279 - -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock"
1280 - -DWITH_DEFAULT_COMPILER_OPTIONS=0
1281 - -DWITH_DEFAULT_FEATURE_SET=0
1282 - -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)"
1283 - # The build forces this to be defined when cross-compiling. We pass it
1284 - # all the time for simplicity and to make sure it is actually correct.
1285 - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
1286 - -DWITHOUT_CLIENTLIBS=YES
1287 - -DWITH_READLINE=$(usex bindist 1 0)
1288 - -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1)
1289 - -DENABLE_DTRACE=$(usex systemtap)
1290 - -DWITH_SSL=$(usex yassl bundled system)
1291 - -DPLUGIN_CLIENT_ED25519=NO
1292 - -DPLUGIN_AUTH_GSSAPI_CLIENT=NO
1293 - )
1294 -
1295 - if use server ; then
1296 -
1297 - # Federated{,X} must be treated special otherwise they will not be built as plugins
1298 - if ! use extraengine ; then
1299 - mycmakeargs+=(
1300 - -DPLUGIN_FEDERATED=NO
1301 - -DPLUGIN_FEDERATEDX=NO )
1302 - fi
1303 -
1304 - mycmakeargs+=(
1305 - -DWITH_JEMALLOC=$(usex jemalloc system)
1306 - -DWITH_PCRE=system
1307 - -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO)
1308 - -DPLUGIN_SPHINX=$(usex sphinx YES NO)
1309 - -DPLUGIN_TOKUDB=$(usex tokudb YES NO)
1310 - -DPLUGIN_AUTH_PAM=$(usex pam YES NO)
1311 - -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO)
1312 - -DPLUGIN_CASSANDRA=NO
1313 - -DPLUGIN_SEQUENCE=$(usex extraengine YES NO)
1314 - -DPLUGIN_SPIDER=$(usex extraengine YES NO)
1315 - -DPLUGIN_CONNECT=$(usex extraengine YES NO)
1316 - -DCONNECT_WITH_MYSQL=1
1317 - -DCONNECT_WITH_LIBXML2=$(usex xml)
1318 - -DCONNECT_WITH_ODBC=$(usex odbc)
1319 - -DCONNECT_WITH_JDBC=$(usex jdbc)
1320 - # Build failure and autodep wrt bug 639144
1321 - -DCONNECT_WITH_MONGO=OFF
1322 - -DWITH_WSREP=$(usex galera)
1323 - -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF)
1324 - -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF)
1325 - -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF)
1326 - -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO)
1327 - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
1328 - -DPLUGIN_AUTH_GSSAPI_CLIENT=NO
1329 - -DWITH_MARIABACKUP=$(usex backup ON OFF)
1330 - -DWITH_LIBARCHIVE=$(usex backup ON OFF)
1331 - -DWITH_SYSTEMD=$(usex systemd yes no)
1332 - -DWITH_NUMA=$(usex numa ON OFF)
1333 - -DINSTALL_SQLBENCHDIR=''
1334 - )
1335 -
1336 - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
1337 - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
1338 - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
1339 - ewarn "You MUST file bugs without these variables set."
1340 -
1341 - mycmakeargs+=(
1342 - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
1343 - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
1344 - )
1345 -
1346 - elif ! use latin1 ; then
1347 - mycmakeargs+=(
1348 - -DDEFAULT_CHARSET=utf8
1349 - -DDEFAULT_COLLATION=utf8_general_ci
1350 - )
1351 - else
1352 - mycmakeargs+=(
1353 - -DDEFAULT_CHARSET=latin1
1354 - -DDEFAULT_COLLATION=latin1_swedish_ci
1355 - )
1356 - fi
1357 - mycmakeargs+=(
1358 - -DEXTRA_CHARSETS=all
1359 - -DMYSQL_USER=mysql
1360 - -DDISABLE_SHARED=$(usex static YES NO)
1361 - -DWITH_DEBUG=$(usex debug)
1362 - -DWITH_EMBEDDED_SERVER=OFF
1363 - -DENABLED_PROFILING=$(usex profiling)
1364 - )
1365 -
1366 - if use static; then
1367 - mycmakeargs+=( -DWITH_PIC=1 )
1368 - fi
1369 -
1370 - if use jemalloc || use tcmalloc ; then
1371 - mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
1372 - fi
1373 -
1374 - # Storage engines
1375 - mycmakeargs+=(
1376 - -DWITH_ARCHIVE_STORAGE_ENGINE=1
1377 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1
1378 - -DWITH_CSV_STORAGE_ENGINE=1
1379 - -DWITH_HEAP_STORAGE_ENGINE=1
1380 - -DWITH_INNOBASE_STORAGE_ENGINE=1
1381 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1
1382 - -DWITH_MYISAM_STORAGE_ENGINE=1
1383 - -DWITH_PARTITION_STORAGE_ENGINE=1
1384 - )
1385 -
1386 - else
1387 - mycmakeargs+=(
1388 - -DWITHOUT_SERVER=1
1389 - -DWITH_EMBEDDED_SERVER=OFF
1390 - -DEXTRA_CHARSETS=none
1391 - -DINSTALL_SQLBENCHDIR=
1392 - -DWITH_SYSTEMD=no
1393 - )
1394 - fi
1395 -
1396 - cmake-utils_src_configure
1397 -}
1398 -
1399 -src_compile() {
1400 - cmake-utils_src_compile
1401 -}
1402 -
1403 -# Official test instructions:
1404 -# USE='extraengine perl server' \
1405 -# FEATURES='test userpriv' \
1406 -# ebuild mariadb-X.X.XX.ebuild \
1407 -# digest clean package
1408 -src_test() {
1409 - _disable_test() {
1410 - local rawtestname bug reason
1411 - rawtestname="${1}" ; shift
1412 - bug="${1}" ; shift
1413 - reason="${@}"
1414 - ewarn "test '${rawtestname}' disabled: '${reason}' (BUG#${bug})"
1415 - echo "${rawtestname} : BUG#${bug} ${reason}" >> "${T}/disabled.def"
1416 - }
1417 -
1418 - local TESTDIR="${BUILD_DIR}/mysql-test"
1419 - local retstatus_unit
1420 - local retstatus_tests
1421 -
1422 - if ! use server ; then
1423 - einfo "Skipping server tests due to minimal build."
1424 - return 0
1425 - fi
1426 -
1427 - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
1428 -
1429 - # Run CTest (test-units)
1430 - cmake-utils_src_test
1431 - retstatus_unit=$?
1432 -
1433 - # Ensure that parallel runs don't die
1434 - export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
1435 -
1436 - if [[ -z "${MTR_PARALLEL}" ]] ; then
1437 - local -x MTR_PARALLEL=$(makeopts_jobs)
1438 -
1439 - if [[ ${MTR_PARALLEL} -gt 4 ]] ; then
1440 - # Running multiple tests in parallel usually require higher ulimit
1441 - # and fs.aio-max-nr setting. In addition, tests like main.multi_update
1442 - # are known to hit timeout when system is busy.
1443 - # To avoid test failure we will limit MTR_PARALLEL to 4 instead of
1444 - # using "auto".
1445 - local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})"
1446 - info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!"
1447 - einfo "${info_msg}"
1448 - unset info_msg
1449 - MTR_PARALLEL=4
1450 - fi
1451 - else
1452 - einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'"
1453 - fi
1454 -
1455 - # Try to increase file limits to increase test coverage
1456 - if ! ulimit -n 16500 1>/dev/null 2>&1 ; then
1457 - # Upper limit comes from parts.partition_* tests
1458 - ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager."
1459 -
1460 - if ! ulimit -n 4162 1>/dev/null 2>&1 ; then
1461 - # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)'
1462 - ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager."
1463 -
1464 - if ! ulimit -n 3000 1>/dev/null 2>&1 ; then
1465 - ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager."
1466 - else
1467 - einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)."
1468 - fi
1469 - else
1470 - einfo "Will run test suite with open file limit set to 4162 (medium test coverage)."
1471 - fi
1472 - else
1473 - einfo "Will run test suite with open file limit set to 16500 (best test coverage)."
1474 - fi
1475 -
1476 - # create directories because mysqladmin might run out of order
1477 - mkdir -p "${T}"/var-tests{,/log} || die
1478 -
1479 - cp "${S}"/mysql-test/unstable-tests "${T}/disabled.def" || die
1480 -
1481 - local -a disabled_tests
1482 - disabled_tests+=( "compat/oracle.plugin;0;Needs example plugin which Gentoo disables" )
1483 - disabled_tests+=( "main.explain_non_select;0;Sporadically failing test" )
1484 - disabled_tests+=( "main.func_time;0;Dependent on time test was written" )
1485 - disabled_tests+=( "main.grant;0;Sporadically failing test" )
1486 - disabled_tests+=( "main.join_cache;0;Sporadically failing test" )
1487 - disabled_tests+=( "main.plugin_auth;0;Needs client libraries built" )
1488 - disabled_tests+=( "main.stat_tables;0;Sporadically failing test" )
1489 - disabled_tests+=( "main.stat_tables_innodb;0;Sporadically failing test" )
1490 - disabled_tests+=( "mariabackup.*;0;Broken test suite" )
1491 - disabled_tests+=( "plugins.auth_ed25519;0;Needs client libraries built" )
1492 - disabled_tests+=( "plugins.cracklib_password_check;0;False positive due to varying policies" )
1493 - disabled_tests+=( "plugins.two_password_validations;0;False positive due to varying policies" )
1494 - disabled_tests+=( "roles.acl_statistics;0;False positive due to a user count mismatch caused by previous test" )
1495 -
1496 - if ! use latin1 ; then
1497 - disabled_tests+=( "funcs_1.is_columns_mysql;0;Requires USE=latin1" )
1498 - disabled_tests+=( "main.information_schema;0;Requires USE=latin1" )
1499 - disabled_tests+=( "main.mysql;0;Requires USE=latin1" )
1500 - disabled_tests+=( "main.system_mysql_db;0;Requires USE=latin1" )
1501 - fi
1502 -
1503 - if ! use profiling ; then
1504 - disabled_tests+=( "sys_vars.sysvars_server_notembedded;0;Requires USE=profiling" )
1505 - fi
1506 -
1507 - local test_infos_str test_infos_arr
1508 - for test_infos_str in "${disabled_tests[@]}" ; do
1509 - IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}"
1510 -
1511 - if [[ ${#test_infos_arr[@]} != 3 ]] ; then
1512 - die "Invalid test data set, not matching format: ${test_infos_str}"
1513 - fi
1514 -
1515 - _disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}"
1516 - done
1517 - unset test_infos_str test_infos_arr
1518 -
1519 - # run mysql-test tests
1520 - pushd "${TESTDIR}" &>/dev/null || die
1521 - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def"
1522 - retstatus_tests=$?
1523 -
1524 - popd &>/dev/null || die
1525 -
1526 - # Cleanup is important for these testcases.
1527 - pkill -9 -f "${S}/ndb" 2>/dev/null
1528 - pkill -9 -f "${S}/sql" 2>/dev/null
1529 -
1530 - local failures=""
1531 - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
1532 - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
1533 -
1534 - [[ -z "$failures" ]] || die "Test failures: $failures"
1535 - einfo "Tests successfully completed"
1536 -}
1537 -
1538 -src_install() {
1539 - cmake-utils_src_install
1540 -
1541 - # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used
1542 - if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then
1543 - rm "${ED}/usr/include/mysql/server/private/config.h" || die
1544 - fi
1545 -
1546 - # Make sure the vars are correctly initialized
1547 - mysql_init_vars
1548 -
1549 - # Convenience links
1550 - einfo "Making Convenience links for mysqlcheck multi-call binary"
1551 - dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
1552 - dosym "mysqlcheck" "/usr/bin/mysqlrepair"
1553 - dosym "mysqlcheck" "/usr/bin/mysqloptimize"
1554 -
1555 - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
1556 - if [[ -d "${ED}/usr/data" ]] ; then
1557 - rm -Rf "${ED}/usr/data" || die
1558 - fi
1559 -
1560 - # Unless they explicitly specific USE=test, then do not install the
1561 - # testsuite. It DOES have a use to be installed, esp. when you want to do a
1562 - # validation of your database configuration after tuning it.
1563 - if ! use test ; then
1564 - rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
1565 - fi
1566 -
1567 - # Configuration stuff
1568 - einfo "Building default configuration ..."
1569 - insinto "${MY_SYSCONFDIR#${EPREFIX}}"
1570 - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
1571 - local mycnf_src="my.cnf-5.6-r1"
1572 - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
1573 - "${FILESDIR}/${mycnf_src}" \
1574 - > "${TMPDIR}/my.cnf.ok" || die
1575 - use prefix && sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' "${TMPDIR}/my.cnf.ok"
1576 - if use latin1 ; then
1577 - sed -i \
1578 - -e "/character-set/s|utf8|latin1|g" \
1579 - "${TMPDIR}/my.cnf.ok" || die
1580 - fi
1581 - eprefixify "${TMPDIR}/my.cnf.ok"
1582 - newins "${TMPDIR}/my.cnf.ok" my.cnf
1583 -
1584 - if use server ; then
1585 - einfo "Including support files and sample configurations"
1586 - docinto "support-files"
1587 - local script
1588 - for script in \
1589 - "${S}"/support-files/magic
1590 - do
1591 - [[ -f "$script" ]] && dodoc "${script}"
1592 - done
1593 -
1594 - docinto "scripts"
1595 - for script in "${S}"/scripts/mysql* ; do
1596 - [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
1597 - done
1598 - # Manually install supporting files that conflict with other packages
1599 - # but are needed for galera and initial installation
1600 - exeinto /usr/libexec/mariadb
1601 - doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror"
1602 - fi
1603 -
1604 - #Remove mytop if perl is not selected
1605 - [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop"
1606 -}
1607 -
1608 -pkg_preinst() {
1609 - java-pkg-opt-2_pkg_preinst
1610 -}
1611 -
1612 -pkg_postinst() {
1613 - # Make sure the vars are correctly initialized
1614 - mysql_init_vars
1615 -
1616 - # Create log directory securely if it does not exist
1617 - [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
1618 -
1619 - if use server ; then
1620 - if use pam; then
1621 - einfo
1622 - elog "This install includes the PAM authentication plugin."
1623 - elog "To activate and configure the PAM plugin, please read:"
1624 - elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/"
1625 - einfo
1626 - fi
1627 -
1628 - if [[ -z "${REPLACING_VERSIONS}" ]] ; then
1629 - einfo
1630 - elog "You might want to run:"
1631 - elog "\"emerge --config =${CATEGORY}/${PF}\""
1632 - elog "if this is a new install."
1633 - elog
1634 - elog "If you are switching server implentations, you should run the"
1635 - elog "mysql_upgrade tool."
1636 - einfo
1637 - else
1638 - einfo
1639 - elog "If you are upgrading major versions, you should run the"
1640 - elog "mysql_upgrade tool."
1641 - einfo
1642 - fi
1643 -
1644 - einfo
1645 - elog "Be sure to edit the my.cnf file to activate your cluster settings."
1646 - elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
1647 - elog "The first time the cluster is activated, you should add"
1648 - elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
1649 - elog "This option should then be removed for subsequent starts."
1650 - einfo
1651 - fi
1652 -}
1653 -
1654 -pkg_config() {
1655 - _getoptval() {
1656 - local mypd="${EROOT}"usr/libexec/mariadb/my_print_defaults
1657 - local section="$1"
1658 - local flag="--${2}="
1659 - local extra_options="${3}"
1660 - "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp"
1661 - }
1662 - local old_MY_DATADIR="${MY_DATADIR}"
1663 - local old_HOME="${HOME}"
1664 - # my_print_defaults needs to read stuff in $HOME/.my.cnf
1665 - export HOME=${EPREFIX}/root
1666 -
1667 - # Make sure the vars are correctly initialized
1668 - mysql_init_vars
1669 -
1670 - [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
1671 - if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then
1672 - die "Minimal builds do NOT include the MySQL server"
1673 - fi
1674 -
1675 - if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then
1676 - local MY_DATADIR_s="${ROOT}/${MY_DATADIR}"
1677 - MY_DATADIR_s="${MY_DATADIR_s%%/}"
1678 - local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}"
1679 - old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
1680 -
1681 - if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then
1682 - if [[ -d "${MY_DATADIR_s}" ]]; then
1683 - ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
1684 - ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
1685 - else
1686 - elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
1687 - mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
1688 - || die "Moving MY_DATADIR failed"
1689 - fi
1690 - else
1691 - ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
1692 - if [[ -d "${MY_DATADIR_s}" ]]; then
1693 - ewarn "Attempting to use ${MY_DATADIR_s}"
1694 - else
1695 - eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
1696 - die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
1697 - fi
1698 - fi
1699 - fi
1700 -
1701 - local pwd1="a"
1702 - local pwd2="b"
1703 - local maxtry=15
1704 -
1705 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
1706 - local tmp_mysqld_password_source=
1707 -
1708 - for tmp_mysqld_password_source in mysql client; do
1709 - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
1710 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
1711 - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then
1712 - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then
1713 - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
1714 - MYSQL_ROOT_PASSWORD=
1715 - continue
1716 - fi
1717 -
1718 - einfo "Found password in '${tmp_mysqld_password_source}' section!"
1719 - break
1720 - fi
1721 - done
1722 -
1723 - # Sometimes --show is required to display passwords in some implementations of my_print_defaults
1724 - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then
1725 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
1726 - fi
1727 -
1728 - unset tmp_mysqld_password_source
1729 - fi
1730 - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir | tail -n1)"
1731 - # These are dir+prefix
1732 - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log | tail -n1)"
1733 - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
1734 - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin | tail -n1)"
1735 - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
1736 -
1737 - if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then
1738 - einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
1739 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR"
1740 - fi
1741 - if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then
1742 - einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
1743 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN"
1744 - fi
1745 - if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then
1746 - einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
1747 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG"
1748 - fi
1749 -
1750 - if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then
1751 - ewarn "You have already a MySQL database in place."
1752 - ewarn "(${ROOT}/${MY_DATADIR}/*)"
1753 - ewarn "Please rename or delete it if you wish to replace it."
1754 - die "MySQL database already exists!"
1755 - fi
1756 -
1757 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
1758 - # localhost. Also causes weird failures.
1759 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
1760 -
1761 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
1762 -
1763 - einfo "Please provide a password for the mysql 'root' user now"
1764 - einfo "or through the ${HOME}/.my.cnf file."
1765 - ewarn "Avoid [\"'\\_%] characters in the password"
1766 - read -rsp " >" pwd1 ; echo
1767 -
1768 - einfo "Retype the password"
1769 - read -rsp " >" pwd2 ; echo
1770 -
1771 - if [[ "x$pwd1" != "x$pwd2" ]] ; then
1772 - die "Passwords are not the same"
1773 - fi
1774 - MYSQL_ROOT_PASSWORD="${pwd1}"
1775 - unset pwd1 pwd2
1776 - fi
1777 -
1778 - local options
1779 - local sqltmp="$(emktemp)"
1780 -
1781 - # Fix bug 446200. Don't reference host my.cnf, needs to come first,
1782 - # see https://bugs.mysql.com/bug.php?id=31312
1783 - use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
1784 -
1785 - # Figure out which options we need to disable to do the setup
1786 - local helpfile="${TMPDIR}/mysqld-help"
1787 - "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
1788 - for opt in grant-tables host-cache name-resolve networking slave-start \
1789 - federated ssl log-bin relay-log slow-query-log external-locking \
1790 - log-slave-updates \
1791 - ; do
1792 - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
1793 - egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
1794 - done
1795 -
1796 - einfo "Creating the mysql database and setting proper permissions on it ..."
1797 -
1798 - # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
1799 - PID_DIR="${EROOT}/var/run/mysqld"
1800 - if [[ ! -d "${PID_DIR}" ]]; then
1801 - install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
1802 - fi
1803 -
1804 - if [[ ! -d "${MY_DATADIR}" ]]; then
1805 - install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory"
1806 - fi
1807 -
1808 - pushd "${TMPDIR}" &>/dev/null || die
1809 -
1810 - # Filling timezones, see
1811 - # https://dev.mysql.com/doc/mysql/en/time-zone-support.html
1812 - "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null
1813 -
1814 - local cmd=( "${EROOT}usr/share/mariadb/scripts/mysql_install_db" )
1815 - [[ -f "${cmd}" ]] || cmd=( "${EROOT}usr/bin/mysql_install_db" )
1816 - cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" )
1817 - einfo "Command: ${cmd[*]}"
1818 - su -s /bin/sh -c "${cmd[*]}" mysql \
1819 - >"${TMPDIR}"/mysql_install_db.log 2>&1
1820 - if [ $? -ne 0 ]; then
1821 - grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2
1822 - die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log"
1823 - fi
1824 - popd &>/dev/null || die
1825 - [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \
1826 - || die "MySQL databases not installed"
1827 -
1828 - use prefix || options="${options} --user=mysql"
1829 -
1830 - local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock"
1831 - local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid"
1832 - local mysqld="${EROOT}/usr/sbin/mysqld \
1833 - ${options} \
1834 - --log-warnings=0 \
1835 - --basedir=${EROOT}/usr \
1836 - --datadir=${ROOT}/${MY_DATADIR} \
1837 - --max_allowed_packet=8M \
1838 - --net_buffer_length=16K \
1839 - --socket=${socket} \
1840 - --pid-file=${pidfile} \
1841 - --tmpdir=${ROOT}/${MYSQL_TMPDIR}"
1842 - #einfo "About to start mysqld: ${mysqld}"
1843 - ebegin "Starting mysqld"
1844 - einfo "Command ${mysqld}"
1845 - ${mysqld} &
1846 - rc=$?
1847 - while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
1848 - maxtry=$((${maxtry}-1))
1849 - echo -n "."
1850 - sleep 1
1851 - done
1852 - eend $rc
1853 -
1854 - if ! [[ -S "${socket}" ]]; then
1855 - die "Completely failed to start up mysqld with: ${mysqld}"
1856 - fi
1857 -
1858 - ebegin "Setting root password"
1859 - # Do this from memory, as we don't want clear text passwords in temp files
1860 - local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES"
1861 - "${EROOT}/usr/bin/mysql" \
1862 - "--socket=${socket}" \
1863 - -hlocalhost \
1864 - -e "${sql}"
1865 - eend $?
1866 -
1867 - if [[ -n "${sqltmp}" ]] ; then
1868 - ebegin "Loading \"zoneinfo\", this step may require a few seconds"
1869 - "${EROOT}/usr/bin/mysql" \
1870 - "--socket=${socket}" \
1871 - -hlocalhost \
1872 - -uroot \
1873 - --password="${MYSQL_ROOT_PASSWORD}" \
1874 - mysql < "${sqltmp}"
1875 - rc=$?
1876 - eend $?
1877 - [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!"
1878 - fi
1879 -
1880 - # Stop the server and cleanup
1881 - einfo "Stopping the server ..."
1882 - kill $(< "${pidfile}" )
1883 - rm -f "${sqltmp}"
1884 - wait %1
1885 - einfo "Done"
1886 -}
1887
1888 diff --git a/dev-db/mariadb/mariadb-10.1.46.ebuild b/dev-db/mariadb/mariadb-10.1.46.ebuild
1889 deleted file mode 100644
1890 index fd560e8d61a..00000000000
1891 --- a/dev-db/mariadb/mariadb-10.1.46.ebuild
1892 +++ /dev/null
1893 @@ -1,925 +0,0 @@
1894 -# Copyright 1999-2020 Gentoo Authors
1895 -# Distributed under the terms of the GNU General Public License v2
1896 -
1897 -EAPI="7"
1898 -SUBSLOT="18"
1899 -
1900 -JAVA_PKG_OPT_USE="jdbc"
1901 -
1902 -inherit eutils systemd flag-o-matic prefix toolchain-funcs \
1903 - multiprocessing java-pkg-opt-2 cmake multilib-build
1904 -
1905 -# Patch version
1906 -PATCH_SET="https://dev.gentoo.org/~whissi/dist/${PN}/${PN}-10.1.46-patches-01.tar.xz"
1907 -
1908 -SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz
1909 - ${PATCH_SET}"
1910 -
1911 -HOMEPAGE="https://mariadb.org/"
1912 -DESCRIPTION="An enhanced, drop-in replacement for MySQL"
1913 -LICENSE="GPL-2"
1914 -SLOT="10.1/${SUBSLOT:-0}"
1915 -IUSE="+backup bindist client-libs cracklib debug extraengine galera jdbc jemalloc kerberos
1916 - innodb-lz4 innodb-lzo innodb-snappy latin1 libressl mroonga numa odbc oqgraph pam
1917 - +perl profiling selinux +server sphinx sst-rsync sst-mariabackup sst-xtrabackup
1918 - systemd systemtap static static-libs tcmalloc test tokudb xml yassl"
1919 -
1920 -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
1921 -RESTRICT="!bindist? ( bindist ) libressl? ( test ) !test? ( test )"
1922 -
1923 -REQUIRED_USE="jdbc? ( extraengine server !static )
1924 - server? ( tokudb? ( jemalloc !tcmalloc ) )
1925 - ?? ( tcmalloc jemalloc )
1926 - static? ( yassl !pam )"
1927 -
1928 -KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
1929 -
1930 -# Shorten the path because the socket path length must be shorter than 107 chars
1931 -# and we will run a mysql server during test phase
1932 -S="${WORKDIR}/mysql"
1933 -
1934 -# Be warned, *DEPEND are version-dependant
1935 -# These are used for both runtime and compiletime
1936 -COMMON_DEPEND="
1937 - kernel_linux? (
1938 - sys-process/procps:0=
1939 - dev-libs/libaio:0=
1940 - )
1941 - >=sys-apps/sed-4
1942 - >=sys-apps/texinfo-4.7-r1
1943 - jemalloc? ( dev-libs/jemalloc:0= )
1944 - tcmalloc? ( dev-util/google-perftools:0= )
1945 - systemtap? ( >=dev-util/systemtap-1.3:0= )
1946 - >=sys-libs/zlib-1.2.3:0=
1947 - kerberos? ( virtual/krb5 )
1948 - !yassl? (
1949 - !libressl? ( dev-libs/openssl:0= !>=dev-libs/openssl-1.1 )
1950 - libressl? ( dev-libs/libressl:0= )
1951 - )
1952 - sys-libs/ncurses:0=
1953 - !bindist? (
1954 - sys-libs/binutils-libs:0=
1955 - >=sys-libs/readline-4.1:0=
1956 - )
1957 - server? (
1958 - backup? ( app-arch/libarchive:0= )
1959 - cracklib? ( sys-libs/cracklib:0= )
1960 - extraengine? (
1961 - odbc? ( dev-db/unixODBC:0= )
1962 - xml? ( dev-libs/libxml2:2= )
1963 - sys-libs/zlib[minizip]
1964 - )
1965 - innodb-lz4? ( app-arch/lz4 )
1966 - innodb-lzo? ( dev-libs/lzo )
1967 - innodb-snappy? ( app-arch/snappy )
1968 - mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 )
1969 - numa? ( sys-process/numactl )
1970 - oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= )
1971 - pam? ( sys-libs/pam:0= )
1972 - systemd? ( sys-apps/systemd:= )
1973 - tokudb? ( app-arch/snappy )
1974 - )
1975 - >=dev-libs/libpcre-8.41-r1:3=
1976 - !client-libs? ( dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] )
1977 -"
1978 -BDEPEND="virtual/yacc
1979 - || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
1980 -"
1981 -DEPEND="static? ( sys-libs/ncurses[static-libs] )
1982 - server? (
1983 - extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) )
1984 - test? ( acct-group/mysql acct-user/mysql )
1985 - )
1986 - ${COMMON_DEPEND}"
1987 -RDEPEND="selinux? ( sec-policy/selinux-mysql )
1988 - client-libs? ( !dev-db/mysql-connector-c )
1989 - !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
1990 - !dev-db/mariadb:0
1991 - !dev-db/mariadb:5.5
1992 - !dev-db/mariadb:10.2
1993 - !dev-db/mariadb:10.3
1994 - !dev-db/mariadb:10.4
1995 - !dev-db/mariadb:10.5
1996 - ${COMMON_DEPEND}
1997 - server? (
1998 - galera? (
1999 - sys-apps/iproute2
2000 - =sys-cluster/galera-25*
2001 - sst-rsync? ( sys-process/lsof )
2002 - sst-mariabackup? ( net-misc/socat[ssl] )
2003 - sst-xtrabackup? ( net-misc/socat[ssl] )
2004 - )
2005 - !prefix? ( dev-db/mysql-init-scripts acct-group/mysql acct-user/mysql )
2006 - extraengine? ( jdbc? ( >=virtual/jre-1.6 ) )
2007 - )
2008 - perl? (
2009 - !dev-db/mytop
2010 - virtual/perl-Getopt-Long
2011 - dev-perl/TermReadKey
2012 - virtual/perl-Term-ANSIColor
2013 - virtual/perl-Time-HiRes
2014 - )
2015 -"
2016 -# For other stuff to bring us in
2017 -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
2018 -# percona-xtrabackup-bin causes a circular dependency if DBD-mysql is not already installed
2019 -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )
2020 - server? ( galera? ( sst-xtrabackup? ( || ( >=dev-db/percona-xtrabackup-bin-2.2.4 dev-db/percona-xtrabackup ) ) ) )"
2021 -
2022 -mysql_init_vars() {
2023 - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"}
2024 - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
2025 - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
2026 - MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
2027 -
2028 - if [[ -z "${MY_DATADIR}" ]] ; then
2029 - MY_DATADIR=""
2030 - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
2031 - MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \
2032 - | sed -ne '/datadir/s|^--datadir=||p' \
2033 - | tail -n1)
2034 - if [[ -z "${MY_DATADIR}" ]] ; then
2035 - MY_DATADIR=$(grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
2036 - | sed -e 's/.*=\s*//' \
2037 - | tail -n1)
2038 - fi
2039 - fi
2040 - if [[ -z "${MY_DATADIR}" ]] ; then
2041 - MY_DATADIR="${MY_LOCALSTATEDIR}"
2042 - einfo "Using default MY_DATADIR"
2043 - fi
2044 - elog "MySQL MY_DATADIR is ${MY_DATADIR}"
2045 -
2046 - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
2047 - if [[ -e "${MY_DATADIR}" ]] ; then
2048 - # If you get this and you're wondering about it, see bug #207636
2049 - elog "MySQL datadir found in ${MY_DATADIR}"
2050 - elog "A new one will not be created."
2051 - PREVIOUS_DATADIR="yes"
2052 - else
2053 - PREVIOUS_DATADIR="no"
2054 - fi
2055 - export PREVIOUS_DATADIR
2056 - fi
2057 - else
2058 - if [[ ${EBUILD_PHASE} == "config" ]]; then
2059 - local new_MY_DATADIR
2060 - new_MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \
2061 - | sed -ne '/datadir/s|^--datadir=||p' \
2062 - | tail -n1)
2063 -
2064 - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
2065 - ewarn "MySQL MY_DATADIR has changed"
2066 - ewarn "from ${MY_DATADIR}"
2067 - ewarn "to ${new_MY_DATADIR}"
2068 - MY_DATADIR="${new_MY_DATADIR}"
2069 - fi
2070 - fi
2071 - fi
2072 -
2073 - export MY_SHAREDSTATEDIR MY_SYSCONFDIR
2074 - export MY_LOCALSTATEDIR MY_LOGDIR
2075 - export MY_DATADIR
2076 -}
2077 -
2078 -pkg_setup() {
2079 - if [[ ${MERGE_TYPE} != binary ]] ; then
2080 - local GCC_MAJOR_SET=$(gcc-major-version)
2081 - local GCC_MINOR_SET=$(gcc-minor-version)
2082 -
2083 - if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \
2084 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
2085 - eerror "${PN} with tokudb needs to be built with gcc-4.7 or later."
2086 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
2087 - die
2088 - fi
2089 -
2090 - # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
2091 - # non x86{,_64} arches
2092 - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
2093 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
2094 - eerror "${PN} needs to be built with gcc-4.7 or later."
2095 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
2096 - die
2097 - fi
2098 -
2099 - if has test ${FEATURES} ; then
2100 - # Bug #213475 - MySQL _will_ object strenuously if your machine is named
2101 - # localhost. Also causes weird failures.
2102 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
2103 -
2104 - if ! has userpriv ${FEATURES} ; then
2105 - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
2106 - fi
2107 - fi
2108 - fi
2109 -
2110 - java-pkg-opt-2_pkg_setup
2111 -}
2112 -
2113 -src_unpack() {
2114 - unpack ${A}
2115 -
2116 - mv -f "${WORKDIR%/}/${PN%%-galera}-${PV}" "${S}" || die
2117 -}
2118 -
2119 -src_prepare() {
2120 - eapply "${WORKDIR}"/mariadb-patches
2121 -
2122 - eapply_user
2123 -
2124 - _disable_plugin() {
2125 - echo > "${S}/plugin/${1}/CMakeLists.txt" || die
2126 - }
2127 - _disable_engine() {
2128 - echo > "${S}/storage/${1}/CMakeLists.txt" || die
2129 - }
2130 -
2131 - if use tcmalloc; then
2132 - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S%/}/sql/CMakeLists.txt" || die
2133 - fi
2134 -
2135 - # Don't build bundled xz-utils for tokudb
2136 - echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die
2137 - sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die
2138 - sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die
2139 -
2140 - # Fix -fno-common error
2141 - sed -i -e '/^datasink_t datasink_buffer;$/d' extra/mariabackup/xbstream.c || die
2142 -
2143 - local plugin
2144 - local server_plugins=( handler_socket auth_socket feedback metadata_lock_info
2145 - locale_info qc_info server_audit semisync sql_errlog )
2146 - local test_plugins=( audit_null auth_examples daemon_example fulltext )
2147 - if ! use server; then # These plugins are for the server
2148 - for plugin in "${server_plugins[@]}" ; do
2149 - _disable_plugin "${plugin}"
2150 - done
2151 - fi
2152 -
2153 - if ! use test; then # These plugins are only used during testing
2154 - for plugin in "${test_plugins[@]}" ; do
2155 - _disable_plugin "${plugin}"
2156 - done
2157 - fi
2158 -
2159 - # Collides with mariadb-connector-c bug 655980
2160 - _disable_plugin auth_dialog
2161 -
2162 - # Avoid useless library checks
2163 - use mroonga || _disable_engine mroonga
2164 - use oqgraph || _disable_engine oqgraph
2165 - _disable_engine example
2166 -
2167 - cmake_src_prepare
2168 - java-pkg-opt-2_src_prepare
2169 -}
2170 -
2171 -src_configure() {
2172 - # bug 508724 mariadb cannot use ld.gold
2173 - tc-ld-disable-gold
2174 - # Bug #114895, bug #110149
2175 - filter-flags "-O" "-O[01]"
2176 -
2177 - append-cxxflags -felide-constructors
2178 -
2179 - # bug #283926, with GCC4.4, this is required to get correct behavior.
2180 - append-flags -fno-strict-aliasing
2181 -
2182 - CMAKE_BUILD_TYPE="RelWithDebInfo"
2183 -
2184 - # debug hack wrt #497532
2185 - mycmakeargs=(
2186 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
2187 - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
2188 - -DDEFAULT_SYSCONFDIR="${EPREFIX}/etc/mysql"
2189 - -DINSTALL_BINDIR=bin
2190 - -DINSTALL_DOCDIR=share/doc/${PF}
2191 - -DINSTALL_DOCREADMEDIR=share/doc/${PF}
2192 - -DINSTALL_INCLUDEDIR=include/mysql
2193 - -DINSTALL_INFODIR=share/info
2194 - -DINSTALL_LIBDIR=$(get_libdir)
2195 - -DINSTALL_MANDIR=share/man
2196 - -DINSTALL_MYSQLSHAREDIR=share/mariadb
2197 - -DINSTALL_MYSQLTESTDIR=$(usex test 'share/mariadb/mysql-test' '')
2198 - -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin
2199 - -DINSTALL_SCRIPTDIR=share/mariadb/scripts
2200 - -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql"
2201 - -DINSTALL_SBINDIR=sbin
2202 - -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb"
2203 - -DCOMPILATION_COMMENT="Gentoo Linux ${PF}"
2204 - -DWITH_UNIT_TESTS=$(usex test ON OFF)
2205 - -DWITH_ZLIB=system
2206 - -DENABLED_LOCAL_INFILE=1
2207 - -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock"
2208 - -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock"
2209 - -DWITH_DEFAULT_COMPILER_OPTIONS=0
2210 - -DWITH_DEFAULT_FEATURE_SET=0
2211 - -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)"
2212 - # The build forces this to be defined when cross-compiling. We pass it
2213 - # all the time for simplicity and to make sure it is actually correct.
2214 - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
2215 - -DWITHOUT_CLIENTLIBS=YES
2216 - -DWITH_READLINE=$(usex bindist 1 0)
2217 - -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1)
2218 - -DENABLE_DTRACE=$(usex systemtap)
2219 - -DWITH_SSL=$(usex yassl bundled system)
2220 - -DPLUGIN_CLIENT_ED25519=NO
2221 - -DPLUGIN_AUTH_GSSAPI_CLIENT=NO
2222 - )
2223 -
2224 - if use server ; then
2225 -
2226 - # Federated{,X} must be treated special otherwise they will not be built as plugins
2227 - if ! use extraengine ; then
2228 - mycmakeargs+=(
2229 - -DPLUGIN_FEDERATED=NO
2230 - -DPLUGIN_FEDERATEDX=NO )
2231 - fi
2232 -
2233 - mycmakeargs+=(
2234 - -DWITH_JEMALLOC=$(usex jemalloc system)
2235 - -DWITH_PCRE=system
2236 - -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO)
2237 - -DPLUGIN_SPHINX=$(usex sphinx YES NO)
2238 - -DPLUGIN_TOKUDB=$(usex tokudb YES NO)
2239 - -DPLUGIN_AUTH_PAM=$(usex pam YES NO)
2240 - -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO)
2241 - -DPLUGIN_CASSANDRA=NO
2242 - -DPLUGIN_SEQUENCE=$(usex extraengine YES NO)
2243 - -DPLUGIN_SPIDER=$(usex extraengine YES NO)
2244 - -DPLUGIN_CONNECT=$(usex extraengine YES NO)
2245 - -DCONNECT_WITH_MYSQL=1
2246 - -DCONNECT_WITH_LIBXML2=$(usex xml)
2247 - -DCONNECT_WITH_ODBC=$(usex odbc)
2248 - -DCONNECT_WITH_JDBC=$(usex jdbc)
2249 - # Build failure and autodep wrt bug 639144
2250 - -DCONNECT_WITH_MONGO=OFF
2251 - -DWITH_WSREP=$(usex galera)
2252 - -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF)
2253 - -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF)
2254 - -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF)
2255 - -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO)
2256 - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
2257 - -DPLUGIN_AUTH_GSSAPI_CLIENT=NO
2258 - -DWITH_MARIABACKUP=$(usex backup ON OFF)
2259 - -DWITH_LIBARCHIVE=$(usex backup ON OFF)
2260 - -DWITH_SYSTEMD=$(usex systemd yes no)
2261 - -DWITH_NUMA=$(usex numa ON OFF)
2262 - -DINSTALL_SQLBENCHDIR=''
2263 - )
2264 -
2265 - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
2266 - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
2267 - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
2268 - ewarn "You MUST file bugs without these variables set."
2269 -
2270 - mycmakeargs+=(
2271 - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
2272 - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
2273 - )
2274 -
2275 - elif ! use latin1 ; then
2276 - mycmakeargs+=(
2277 - -DDEFAULT_CHARSET=utf8
2278 - -DDEFAULT_COLLATION=utf8_general_ci
2279 - )
2280 - else
2281 - mycmakeargs+=(
2282 - -DDEFAULT_CHARSET=latin1
2283 - -DDEFAULT_COLLATION=latin1_swedish_ci
2284 - )
2285 - fi
2286 - mycmakeargs+=(
2287 - -DEXTRA_CHARSETS=all
2288 - -DMYSQL_USER=mysql
2289 - -DDISABLE_SHARED=$(usex static YES NO)
2290 - -DWITH_DEBUG=$(usex debug)
2291 - -DWITH_EMBEDDED_SERVER=OFF
2292 - -DENABLED_PROFILING=$(usex profiling)
2293 - )
2294 -
2295 - if use static; then
2296 - mycmakeargs+=( -DWITH_PIC=1 )
2297 - fi
2298 -
2299 - if use jemalloc || use tcmalloc ; then
2300 - mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
2301 - fi
2302 -
2303 - # Storage engines
2304 - mycmakeargs+=(
2305 - -DWITH_ARCHIVE_STORAGE_ENGINE=1
2306 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1
2307 - -DWITH_CSV_STORAGE_ENGINE=1
2308 - -DWITH_HEAP_STORAGE_ENGINE=1
2309 - -DWITH_INNOBASE_STORAGE_ENGINE=1
2310 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1
2311 - -DWITH_MYISAM_STORAGE_ENGINE=1
2312 - -DWITH_PARTITION_STORAGE_ENGINE=1
2313 - )
2314 -
2315 - else
2316 - mycmakeargs+=(
2317 - -DWITHOUT_SERVER=1
2318 - -DWITH_EMBEDDED_SERVER=OFF
2319 - -DEXTRA_CHARSETS=none
2320 - -DINSTALL_SQLBENCHDIR=
2321 - -DWITH_SYSTEMD=no
2322 - )
2323 - fi
2324 -
2325 - cmake_src_configure
2326 -}
2327 -
2328 -src_compile() {
2329 - cmake_src_compile
2330 -}
2331 -
2332 -# Official test instructions:
2333 -# USE='extraengine perl server' \
2334 -# FEATURES='test userpriv' \
2335 -# ebuild mariadb-X.X.XX.ebuild \
2336 -# digest clean package
2337 -src_test() {
2338 - _disable_test() {
2339 - local rawtestname bug reason
2340 - rawtestname="${1}" ; shift
2341 - bug="${1}" ; shift
2342 - reason="${@}"
2343 - ewarn "test '${rawtestname}' disabled: '${reason}' (BUG#${bug})"
2344 - echo "${rawtestname} : BUG#${bug} ${reason}" >> "${T}/disabled.def"
2345 - }
2346 -
2347 - local TESTDIR="${BUILD_DIR}/mysql-test"
2348 - local retstatus_unit
2349 - local retstatus_tests
2350 -
2351 - if ! use server ; then
2352 - einfo "Skipping server tests due to minimal build."
2353 - return 0
2354 - fi
2355 -
2356 - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
2357 -
2358 - # Run CTest (test-units)
2359 - cmake_src_test
2360 - retstatus_unit=$?
2361 -
2362 - # Ensure that parallel runs don't die
2363 - export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
2364 -
2365 - if [[ -z "${MTR_PARALLEL}" ]] ; then
2366 - local -x MTR_PARALLEL=$(makeopts_jobs)
2367 -
2368 - if [[ ${MTR_PARALLEL} -gt 4 ]] ; then
2369 - # Running multiple tests in parallel usually require higher ulimit
2370 - # and fs.aio-max-nr setting. In addition, tests like main.multi_update
2371 - # are known to hit timeout when system is busy.
2372 - # To avoid test failure we will limit MTR_PARALLEL to 4 instead of
2373 - # using "auto".
2374 - local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})"
2375 - info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!"
2376 - einfo "${info_msg}"
2377 - unset info_msg
2378 - MTR_PARALLEL=4
2379 - fi
2380 - else
2381 - einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'"
2382 - fi
2383 -
2384 - # Try to increase file limits to increase test coverage
2385 - if ! ulimit -n 16500 1>/dev/null 2>&1 ; then
2386 - # Upper limit comes from parts.partition_* tests
2387 - ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager."
2388 -
2389 - if ! ulimit -n 4162 1>/dev/null 2>&1 ; then
2390 - # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)'
2391 - ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager."
2392 -
2393 - if ! ulimit -n 3000 1>/dev/null 2>&1 ; then
2394 - ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager."
2395 - else
2396 - einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)."
2397 - fi
2398 - else
2399 - einfo "Will run test suite with open file limit set to 4162 (medium test coverage)."
2400 - fi
2401 - else
2402 - einfo "Will run test suite with open file limit set to 16500 (best test coverage)."
2403 - fi
2404 -
2405 - # create directories because mysqladmin might run out of order
2406 - mkdir -p "${T}"/var-tests{,/log} || die
2407 -
2408 - cp "${S}"/mysql-test/unstable-tests "${T}/disabled.def" || die
2409 -
2410 - local -a disabled_tests
2411 - disabled_tests+=( "compat/oracle.plugin;0;Needs example plugin which Gentoo disables" )
2412 - disabled_tests+=( "main.explain_non_select;0;Sporadically failing test" )
2413 - disabled_tests+=( "main.func_time;0;Dependent on time test was written" )
2414 - disabled_tests+=( "main.grant;0;Sporadically failing test" )
2415 - disabled_tests+=( "main.join_cache;0;Sporadically failing test" )
2416 - disabled_tests+=( "main.plugin_auth;0;Needs client libraries built" )
2417 - disabled_tests+=( "main.stat_tables;0;Sporadically failing test" )
2418 - disabled_tests+=( "main.stat_tables_innodb;0;Sporadically failing test" )
2419 - disabled_tests+=( "mariabackup.*;0;Broken test suite" )
2420 - disabled_tests+=( "plugins.auth_ed25519;0;Needs client libraries built" )
2421 - disabled_tests+=( "plugins.cracklib_password_check;0;False positive due to varying policies" )
2422 - disabled_tests+=( "plugins.two_password_validations;0;False positive due to varying policies" )
2423 - disabled_tests+=( "roles.acl_statistics;0;False positive due to a user count mismatch caused by previous test" )
2424 -
2425 - if ! use latin1 ; then
2426 - disabled_tests+=( "funcs_1.is_columns_mysql;0;Requires USE=latin1" )
2427 - disabled_tests+=( "main.information_schema;0;Requires USE=latin1" )
2428 - disabled_tests+=( "main.mysql;0;Requires USE=latin1" )
2429 - disabled_tests+=( "main.system_mysql_db;0;Requires USE=latin1" )
2430 - fi
2431 -
2432 - if ! use profiling ; then
2433 - disabled_tests+=( "sys_vars.sysvars_server_notembedded;0;Requires USE=profiling" )
2434 - fi
2435 -
2436 - local test_infos_str test_infos_arr
2437 - for test_infos_str in "${disabled_tests[@]}" ; do
2438 - IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}"
2439 -
2440 - if [[ ${#test_infos_arr[@]} != 3 ]] ; then
2441 - die "Invalid test data set, not matching format: ${test_infos_str}"
2442 - fi
2443 -
2444 - _disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}"
2445 - done
2446 - unset test_infos_str test_infos_arr
2447 -
2448 - # run mysql-test tests
2449 - pushd "${TESTDIR}" &>/dev/null || die
2450 - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def"
2451 - retstatus_tests=$?
2452 -
2453 - popd &>/dev/null || die
2454 -
2455 - # Cleanup is important for these testcases.
2456 - pkill -9 -f "${S}/ndb" 2>/dev/null
2457 - pkill -9 -f "${S}/sql" 2>/dev/null
2458 -
2459 - local failures=""
2460 - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
2461 - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
2462 -
2463 - [[ -z "$failures" ]] || die "Test failures: $failures"
2464 - einfo "Tests successfully completed"
2465 -}
2466 -
2467 -src_install() {
2468 - cmake_src_install
2469 -
2470 - # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used
2471 - if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then
2472 - rm "${ED}/usr/include/mysql/server/private/config.h" || die
2473 - fi
2474 -
2475 - # Make sure the vars are correctly initialized
2476 - mysql_init_vars
2477 -
2478 - # Convenience links
2479 - einfo "Making Convenience links for mysqlcheck multi-call binary"
2480 - dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
2481 - dosym "mysqlcheck" "/usr/bin/mysqlrepair"
2482 - dosym "mysqlcheck" "/usr/bin/mysqloptimize"
2483 -
2484 - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
2485 - if [[ -d "${ED}/usr/data" ]] ; then
2486 - rm -Rf "${ED}/usr/data" || die
2487 - fi
2488 -
2489 - # Unless they explicitly specific USE=test, then do not install the
2490 - # testsuite. It DOES have a use to be installed, esp. when you want to do a
2491 - # validation of your database configuration after tuning it.
2492 - if ! use test ; then
2493 - rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
2494 - fi
2495 -
2496 - # Configuration stuff
2497 - einfo "Building default configuration ..."
2498 - insinto "${MY_SYSCONFDIR#${EPREFIX}}"
2499 - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
2500 - local mycnf_src="my.cnf-5.6-r1"
2501 - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
2502 - "${FILESDIR}/${mycnf_src}" \
2503 - > "${TMPDIR}/my.cnf.ok" || die
2504 - use prefix && sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' "${TMPDIR}/my.cnf.ok"
2505 - if use latin1 ; then
2506 - sed -i \
2507 - -e "/character-set/s|utf8|latin1|g" \
2508 - "${TMPDIR}/my.cnf.ok" || die
2509 - fi
2510 - eprefixify "${TMPDIR}/my.cnf.ok"
2511 - newins "${TMPDIR}/my.cnf.ok" my.cnf
2512 -
2513 - if use server ; then
2514 - einfo "Including support files and sample configurations"
2515 - docinto "support-files"
2516 - local script
2517 - for script in \
2518 - "${S}"/support-files/magic
2519 - do
2520 - [[ -f "$script" ]] && dodoc "${script}"
2521 - done
2522 -
2523 - docinto "scripts"
2524 - for script in "${S}"/scripts/mysql* ; do
2525 - [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
2526 - done
2527 - # Manually install supporting files that conflict with other packages
2528 - # but are needed for galera and initial installation
2529 - exeinto /usr/libexec/mariadb
2530 - doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror"
2531 - fi
2532 -
2533 - # Remove mytop if perl is not selected
2534 - if [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl ; then
2535 - rm -f "${ED}/usr/bin/mytop" || die
2536 - fi
2537 -}
2538 -
2539 -pkg_preinst() {
2540 - java-pkg-opt-2_pkg_preinst
2541 -}
2542 -
2543 -pkg_postinst() {
2544 - # Make sure the vars are correctly initialized
2545 - mysql_init_vars
2546 -
2547 - # Create log directory securely if it does not exist
2548 - [[ -d "${ROOT}/${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}/${MY_LOGDIR}"
2549 -
2550 - if use server ; then
2551 - if use pam; then
2552 - einfo
2553 - elog "This install includes the PAM authentication plugin."
2554 - elog "To activate and configure the PAM plugin, please read:"
2555 - elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/"
2556 - einfo
2557 - fi
2558 -
2559 - if [[ -z "${REPLACING_VERSIONS}" ]] ; then
2560 - einfo
2561 - elog "You might want to run:"
2562 - elog "\"emerge --config =${CATEGORY}/${PF}\""
2563 - elog "if this is a new install."
2564 - elog
2565 - elog "If you are switching server implentations, you should run the"
2566 - elog "mysql_upgrade tool."
2567 - einfo
2568 - else
2569 - einfo
2570 - elog "If you are upgrading major versions, you should run the"
2571 - elog "mysql_upgrade tool."
2572 - einfo
2573 - fi
2574 -
2575 - einfo
2576 - elog "Be sure to edit the my.cnf file to activate your cluster settings."
2577 - elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
2578 - elog "The first time the cluster is activated, you should add"
2579 - elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
2580 - elog "This option should then be removed for subsequent starts."
2581 - einfo
2582 - fi
2583 -}
2584 -
2585 -pkg_config() {
2586 - _getoptval() {
2587 - local mypd="${EROOT}"/usr/libexec/mariadb/my_print_defaults
2588 - local section="$1"
2589 - local flag="--${2}="
2590 - local extra_options="${3}"
2591 - "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp"
2592 - }
2593 - local old_MY_DATADIR="${MY_DATADIR}"
2594 - local old_HOME="${HOME}"
2595 - # my_print_defaults needs to read stuff in $HOME/.my.cnf
2596 - export HOME=${EPREFIX}/root
2597 -
2598 - # Make sure the vars are correctly initialized
2599 - mysql_init_vars
2600 -
2601 - [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
2602 - if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then
2603 - die "Minimal builds do NOT include the MySQL server"
2604 - fi
2605 -
2606 - if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then
2607 - local MY_DATADIR_s="${ROOT}/${MY_DATADIR}"
2608 - MY_DATADIR_s="${MY_DATADIR_s%%/}"
2609 - local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}"
2610 - old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
2611 -
2612 - if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then
2613 - if [[ -d "${MY_DATADIR_s}" ]]; then
2614 - ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
2615 - ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
2616 - else
2617 - elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
2618 - mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
2619 - || die "Moving MY_DATADIR failed"
2620 - fi
2621 - else
2622 - ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
2623 - if [[ -d "${MY_DATADIR_s}" ]]; then
2624 - ewarn "Attempting to use ${MY_DATADIR_s}"
2625 - else
2626 - eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
2627 - die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
2628 - fi
2629 - fi
2630 - fi
2631 -
2632 - local pwd1="a"
2633 - local pwd2="b"
2634 - local maxtry=15
2635 -
2636 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
2637 - local tmp_mysqld_password_source=
2638 -
2639 - for tmp_mysqld_password_source in mysql client; do
2640 - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
2641 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
2642 - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then
2643 - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then
2644 - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
2645 - MYSQL_ROOT_PASSWORD=
2646 - continue
2647 - fi
2648 -
2649 - einfo "Found password in '${tmp_mysqld_password_source}' section!"
2650 - break
2651 - fi
2652 - done
2653 -
2654 - # Sometimes --show is required to display passwords in some implementations of my_print_defaults
2655 - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then
2656 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
2657 - fi
2658 -
2659 - unset tmp_mysqld_password_source
2660 - fi
2661 - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir | tail -n1)"
2662 - # These are dir+prefix
2663 - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log | tail -n1)"
2664 - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
2665 - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin | tail -n1)"
2666 - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
2667 -
2668 - if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then
2669 - einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
2670 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR"
2671 - fi
2672 - if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then
2673 - einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
2674 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN"
2675 - fi
2676 - if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then
2677 - einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
2678 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG"
2679 - fi
2680 -
2681 - if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then
2682 - ewarn "You have already a MySQL database in place."
2683 - ewarn "(${ROOT}/${MY_DATADIR}/*)"
2684 - ewarn "Please rename or delete it if you wish to replace it."
2685 - die "MySQL database already exists!"
2686 - fi
2687 -
2688 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
2689 - # localhost. Also causes weird failures.
2690 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
2691 -
2692 - if [[ -z "${MYSQL_ROOT_PASSWORD}" ]]; then
2693 -
2694 - einfo "Please provide a password for the mysql 'root'@'localhost' user now"
2695 - einfo "or through the ${HOME}/.my.cnf file."
2696 - ewarn "Avoid [\"'\\_%] characters in the password"
2697 - read -rsp " >" pwd1 ; echo
2698 -
2699 - einfo "Retype the password"
2700 - read -rsp " >" pwd2 ; echo
2701 -
2702 - if [[ "x$pwd1" != "x$pwd2" ]] ; then
2703 - die "Passwords are not the same"
2704 - fi
2705 -
2706 - MYSQL_ROOT_PASSWORD="${pwd1}"
2707 - unset pwd1 pwd2
2708 - fi
2709 -
2710 - local options
2711 - local sqltmp="$(emktemp)"
2712 -
2713 - # Fix bug 446200. Don't reference host my.cnf, needs to come first,
2714 - # see https://bugs.mysql.com/bug.php?id=31312
2715 - use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
2716 -
2717 - # Figure out which options we need to disable to do the setup
2718 - local helpfile="${TMPDIR}/mysqld-help"
2719 - "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
2720 - for opt in grant-tables host-cache name-resolve networking slave-start \
2721 - federated ssl log-bin relay-log slow-query-log external-locking \
2722 - log-slave-updates \
2723 - ; do
2724 - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
2725 - egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
2726 - done
2727 -
2728 - einfo "Creating the mysql database and setting proper permissions on it ..."
2729 -
2730 - # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
2731 - PID_DIR="${EROOT}/var/run/mysqld"
2732 - if [[ ! -d "${PID_DIR}" ]]; then
2733 - install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
2734 - fi
2735 -
2736 - if [[ ! -d "${MY_DATADIR}" ]]; then
2737 - install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory"
2738 - fi
2739 -
2740 - pushd "${TMPDIR}" &>/dev/null || die
2741 -
2742 - # Filling timezones, see
2743 - # https://dev.mysql.com/doc/mysql/en/time-zone-support.html
2744 - "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null
2745 -
2746 - local cmd=( "${EROOT}/usr/share/mariadb/scripts/mysql_install_db" )
2747 - [[ -f "${cmd}" ]] || cmd=( "${EROOT}/usr/bin/mysql_install_db" )
2748 - cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" )
2749 - einfo "Command: ${cmd[*]}"
2750 - su -s /bin/sh -c "${cmd[*]}" mysql \
2751 - >"${TMPDIR}"/mysql_install_db.log 2>&1
2752 - if [[ $? -ne 0 ]]; then
2753 - grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2
2754 - die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log"
2755 - fi
2756 - popd &>/dev/null || die
2757 - [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \
2758 - || die "MySQL databases not installed"
2759 -
2760 - use prefix || options="${options} --user=mysql"
2761 -
2762 - local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock"
2763 - local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid"
2764 - local mysqld="${EROOT}/usr/sbin/mysqld \
2765 - ${options} \
2766 - --log-warnings=0 \
2767 - --basedir=${EROOT}/usr \
2768 - --datadir=${ROOT}/${MY_DATADIR} \
2769 - --max_allowed_packet=8M \
2770 - --net_buffer_length=16K \
2771 - --socket=${socket} \
2772 - --pid-file=${pidfile} \
2773 - --tmpdir=${ROOT}/${MYSQL_TMPDIR}"
2774 - #einfo "About to start mysqld: ${mysqld}"
2775 - ebegin "Starting mysqld"
2776 - einfo "Command ${mysqld}"
2777 - ${mysqld} &
2778 - rc=$?
2779 - while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
2780 - maxtry=$((${maxtry}-1))
2781 - echo -n "."
2782 - sleep 1
2783 - done
2784 - eend $rc
2785 -
2786 - if ! [[ -S "${socket}" ]]; then
2787 - die "Completely failed to start up mysqld with: ${mysqld}"
2788 - fi
2789 -
2790 - ebegin "Setting root password"
2791 - # Do this from memory, as we don't want clear text passwords in temp files
2792 - local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES"
2793 - "${EROOT}/usr/bin/mysql" \
2794 - "--socket=${socket}" \
2795 - -hlocalhost \
2796 - -e "${sql}"
2797 - eend $?
2798 -
2799 - if [[ -n "${sqltmp}" ]] ; then
2800 - ebegin "Loading \"zoneinfo\", this step may require a few seconds"
2801 - "${EROOT}/usr/bin/mysql" \
2802 - "--socket=${socket}" \
2803 - -hlocalhost \
2804 - -uroot \
2805 - --password="${MYSQL_ROOT_PASSWORD}" \
2806 - mysql < "${sqltmp}"
2807 - rc=$?
2808 - eend $?
2809 - [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!"
2810 - fi
2811 -
2812 - # Stop the server and cleanup
2813 - einfo "Stopping the server ..."
2814 - kill $(< "${pidfile}" )
2815 - rm -f "${sqltmp}"
2816 - wait %1
2817 - einfo "Done"
2818 -}
2819
2820 diff --git a/dev-db/mariadb/mariadb-10.2.33.ebuild b/dev-db/mariadb/mariadb-10.2.33.ebuild
2821 deleted file mode 100644
2822 index 636a95ff869..00000000000
2823 --- a/dev-db/mariadb/mariadb-10.2.33.ebuild
2824 +++ /dev/null
2825 @@ -1,1017 +0,0 @@
2826 -# Copyright 1999-2020 Gentoo Authors
2827 -# Distributed under the terms of the GNU General Public License v2
2828 -
2829 -EAPI="7"
2830 -SUBSLOT="18"
2831 -
2832 -JAVA_PKG_OPT_USE="jdbc"
2833 -
2834 -inherit eutils systemd flag-o-matic prefix toolchain-funcs \
2835 - multiprocessing java-pkg-opt-2 cmake
2836 -
2837 -# Patch version
2838 -PATCH_SET="https://dev.gentoo.org/~whissi/dist/${PN}/${PN}-10.2.33-patches-01.tar.xz"
2839 -
2840 -SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz
2841 - ${PATCH_SET}"
2842 -
2843 -HOMEPAGE="https://mariadb.org/"
2844 -DESCRIPTION="An enhanced, drop-in replacement for MySQL"
2845 -LICENSE="GPL-2 LGPL-2.1+"
2846 -SLOT="10.2/${SUBSLOT:-0}"
2847 -IUSE="+backup bindist client-libs cracklib debug extraengine galera innodb-lz4
2848 - innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 libressl mroonga
2849 - numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx
2850 - sst-rsync sst-mariabackup sst-xtrabackup static systemd systemtap tcmalloc
2851 - test tokudb xml yassl"
2852 -
2853 -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
2854 -RESTRICT="!bindist? ( bindist ) libressl? ( test ) !test? ( test )"
2855 -
2856 -REQUIRED_USE="jdbc? ( extraengine server !static )
2857 - server? ( tokudb? ( jemalloc !tcmalloc ) )
2858 - ?? ( tcmalloc jemalloc )
2859 - static? ( yassl !pam )"
2860 -
2861 -KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
2862 -
2863 -# Shorten the path because the socket path length must be shorter than 107 chars
2864 -# and we will run a mysql server during test phase
2865 -S="${WORKDIR}/mysql"
2866 -
2867 -# Be warned, *DEPEND are version-dependant
2868 -# These are used for both runtime and compiletime
2869 -COMMON_DEPEND="
2870 - kernel_linux? (
2871 - sys-process/procps:0=
2872 - dev-libs/libaio:0=
2873 - )
2874 - >=sys-apps/sed-4
2875 - >=sys-apps/texinfo-4.7-r1
2876 - jemalloc? ( dev-libs/jemalloc:0= )
2877 - tcmalloc? ( dev-util/google-perftools:0= )
2878 - systemtap? ( >=dev-util/systemtap-1.3:0= )
2879 - >=sys-libs/zlib-1.2.3:0=
2880 - kerberos? ( virtual/krb5 )
2881 - yassl? ( net-libs/gnutls:0= )
2882 - !yassl? (
2883 - !libressl? ( >=dev-libs/openssl-1.0.0:0= )
2884 - libressl? ( dev-libs/libressl:0= )
2885 - )
2886 - sys-libs/ncurses:0=
2887 - !bindist? (
2888 - sys-libs/binutils-libs:0=
2889 - >=sys-libs/readline-4.1:0=
2890 - )
2891 - server? (
2892 - backup? ( app-arch/libarchive:0= )
2893 - cracklib? ( sys-libs/cracklib:0= )
2894 - extraengine? (
2895 - odbc? ( dev-db/unixODBC:0= )
2896 - xml? ( dev-libs/libxml2:2= )
2897 - )
2898 - innodb-lz4? ( app-arch/lz4 )
2899 - innodb-lzo? ( dev-libs/lzo )
2900 - innodb-snappy? ( app-arch/snappy )
2901 - mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 )
2902 - numa? ( sys-process/numactl )
2903 - oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= )
2904 - pam? ( sys-libs/pam:0= )
2905 - systemd? ( sys-apps/systemd:= )
2906 - tokudb? ( app-arch/snappy )
2907 - )
2908 - >=dev-libs/libpcre-8.41-r1:3=
2909 -"
2910 -BDEPEND="virtual/yacc
2911 - || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
2912 -"
2913 -DEPEND="static? ( sys-libs/ncurses[static-libs] )
2914 - server? (
2915 - extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) )
2916 - test? ( acct-group/mysql acct-user/mysql )
2917 - )
2918 - ${COMMON_DEPEND}"
2919 -RDEPEND="selinux? ( sec-policy/selinux-mysql )
2920 - !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
2921 - !dev-db/mariadb:0
2922 - !dev-db/mariadb:5.5
2923 - !dev-db/mariadb:10.1
2924 - !dev-db/mariadb:10.3
2925 - !dev-db/mariadb:10.4
2926 - !dev-db/mariadb:10.5
2927 - !<virtual/mysql-5.6-r11
2928 - ${COMMON_DEPEND}
2929 - server? (
2930 - galera? (
2931 - sys-apps/iproute2
2932 - =sys-cluster/galera-25*
2933 - sst-rsync? ( sys-process/lsof )
2934 - sst-mariabackup? ( net-misc/socat[ssl] )
2935 - sst-xtrabackup? ( net-misc/socat[ssl] )
2936 - )
2937 - !prefix? ( dev-db/mysql-init-scripts acct-group/mysql acct-user/mysql )
2938 - extraengine? ( jdbc? ( >=virtual/jre-1.6 ) )
2939 - )
2940 - perl? (
2941 - !dev-db/mytop
2942 - virtual/perl-Getopt-Long
2943 - dev-perl/TermReadKey
2944 - virtual/perl-Term-ANSIColor
2945 - virtual/perl-Time-HiRes
2946 - )
2947 -"
2948 -# For other stuff to bring us in
2949 -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
2950 -# percona-xtrabackup-bin causes a circular dependency if DBD-mysql is not already installed
2951 -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )
2952 - server? (
2953 - galera? (
2954 - sst-xtrabackup? (
2955 - || ( >=dev-db/percona-xtrabackup-bin-2.2.4 dev-db/percona-xtrabackup )
2956 - )
2957 - )
2958 - )"
2959 -
2960 -mysql_init_vars() {
2961 - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"}
2962 - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
2963 - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
2964 - MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
2965 -
2966 - if [[ -z "${MY_DATADIR}" ]] ; then
2967 - MY_DATADIR=""
2968 - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
2969 - MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \
2970 - | sed -ne '/datadir/s|^--datadir=||p' \
2971 - | tail -n1)
2972 - if [[ -z "${MY_DATADIR}" ]] ; then
2973 - MY_DATADIR=$(grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
2974 - | sed -e 's/.*=\s*//' \
2975 - | tail -n1)
2976 - fi
2977 - fi
2978 - if [[ -z "${MY_DATADIR}" ]] ; then
2979 - MY_DATADIR="${MY_LOCALSTATEDIR}"
2980 - einfo "Using default MY_DATADIR"
2981 - fi
2982 - elog "MySQL MY_DATADIR is ${MY_DATADIR}"
2983 -
2984 - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
2985 - if [[ -e "${MY_DATADIR}" ]] ; then
2986 - # If you get this and you're wondering about it, see bug #207636
2987 - elog "MySQL datadir found in ${MY_DATADIR}"
2988 - elog "A new one will not be created."
2989 - PREVIOUS_DATADIR="yes"
2990 - else
2991 - PREVIOUS_DATADIR="no"
2992 - fi
2993 - export PREVIOUS_DATADIR
2994 - fi
2995 - else
2996 - if [[ ${EBUILD_PHASE} == "config" ]]; then
2997 - local new_MY_DATADIR
2998 - new_MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \
2999 - | sed -ne '/datadir/s|^--datadir=||p' \
3000 - | tail -n1)
3001 -
3002 - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
3003 - ewarn "MySQL MY_DATADIR has changed"
3004 - ewarn "from ${MY_DATADIR}"
3005 - ewarn "to ${new_MY_DATADIR}"
3006 - MY_DATADIR="${new_MY_DATADIR}"
3007 - fi
3008 - fi
3009 - fi
3010 -
3011 - export MY_SHAREDSTATEDIR MY_SYSCONFDIR
3012 - export MY_LOCALSTATEDIR MY_LOGDIR
3013 - export MY_DATADIR
3014 -}
3015 -
3016 -pkg_setup() {
3017 - if [[ ${MERGE_TYPE} != binary ]] ; then
3018 - local GCC_MAJOR_SET=$(gcc-major-version)
3019 - local GCC_MINOR_SET=$(gcc-minor-version)
3020 -
3021 - if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \
3022 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
3023 - eerror "${PN} with tokudb needs to be built with gcc-4.7 or later."
3024 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
3025 - die
3026 - fi
3027 -
3028 - # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
3029 - # non x86{,_64} arches
3030 - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
3031 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
3032 - eerror "${PN} needs to be built with gcc-4.7 or later."
3033 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
3034 - die
3035 - fi
3036 -
3037 - if has test ${FEATURES} ; then
3038 - # Bug #213475 - MySQL _will_ object strenuously if your machine is named
3039 - # localhost. Also causes weird failures.
3040 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
3041 -
3042 - if ! has userpriv ${FEATURES} ; then
3043 - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
3044 - fi
3045 - fi
3046 - fi
3047 -
3048 - java-pkg-opt-2_pkg_setup
3049 -}
3050 -
3051 -src_unpack() {
3052 - unpack ${A}
3053 -
3054 - mv -f "${WORKDIR}/${P/_rc/}" "${S}" || die
3055 -}
3056 -
3057 -src_prepare() {
3058 - eapply "${WORKDIR}"/mariadb-patches
3059 -
3060 - eapply_user
3061 -
3062 - _disable_plugin() {
3063 - echo > "${S}/plugin/${1}/CMakeLists.txt" || die
3064 - }
3065 - _disable_engine() {
3066 - echo > "${S}/storage/${1}/CMakeLists.txt" || die
3067 - }
3068 -
3069 - if use jemalloc; then
3070 - echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt"
3071 - elif use tcmalloc; then
3072 - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt"
3073 - fi
3074 -
3075 - # Don't build bundled xz-utils for tokudb
3076 - echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die
3077 - sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die
3078 - sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die
3079 -
3080 - local plugin
3081 - local server_plugins=( handler_socket auth_socket feedback metadata_lock_info
3082 - locale_info qc_info server_audit sql_errlog auth_ed25519 )
3083 - local test_plugins=( audit_null auth_examples daemon_example fulltext
3084 - debug_key_management example_key_management )
3085 - if ! use server; then # These plugins are for the server
3086 - for plugin in "${server_plugins[@]}" ; do
3087 - _disable_plugin "${plugin}"
3088 - done
3089 - fi
3090 -
3091 - if ! use test; then # These plugins are only used during testing
3092 - for plugin in "${test_plugins[@]}" ; do
3093 - _disable_plugin "${plugin}"
3094 - done
3095 - _disable_engine test_sql_discovery
3096 - fi
3097 -
3098 - _disable_engine example
3099 -
3100 - if ! use oqgraph ; then # avoids extra library checks
3101 - _disable_engine oqgraph
3102 - fi
3103 -
3104 - if use mroonga ; then
3105 - # Remove the bundled groonga
3106 - # There is no CMake flag, it simply checks for existance
3107 - rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga"
3108 - else
3109 - _disable_engine mroonga
3110 - fi
3111 -
3112 - # Fix galera_recovery.sh script
3113 - sed -i -e "s~@bindir@/my_print_defaults~${EPREFIX}/usr/libexec/mariadb/my_print_defaults~" \
3114 - scripts/galera_recovery.sh || die
3115 -
3116 - cmake_src_prepare
3117 - java-pkg-opt-2_src_prepare
3118 -}
3119 -
3120 -src_configure() {
3121 - # bug 508724 mariadb cannot use ld.gold
3122 - tc-ld-disable-gold
3123 - # Bug #114895, bug #110149
3124 - filter-flags "-O" "-O[01]"
3125 -
3126 - append-cxxflags -felide-constructors
3127 -
3128 - # bug #283926, with GCC4.4, this is required to get correct behavior.
3129 - append-flags -fno-strict-aliasing
3130 -
3131 - CMAKE_BUILD_TYPE="RelWithDebInfo"
3132 -
3133 - # debug hack wrt #497532
3134 - mycmakeargs=(
3135 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
3136 - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
3137 - -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql"
3138 - -DSYSCONFDIR="${EPREFIX}/etc/mysql"
3139 - -DINSTALL_BINDIR=bin
3140 - -DINSTALL_DOCDIR=share/doc/${PF}
3141 - -DINSTALL_DOCREADMEDIR=share/doc/${PF}
3142 - -DINSTALL_INCLUDEDIR=include/mysql
3143 - -DINSTALL_INFODIR=share/info
3144 - -DINSTALL_LIBDIR=$(get_libdir)
3145 - -DINSTALL_MANDIR=share/man
3146 - -DINSTALL_MYSQLSHAREDIR=share/mariadb
3147 - -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin
3148 - -DINSTALL_SCRIPTDIR=share/mariadb/scripts
3149 - -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql"
3150 - -DINSTALL_SBINDIR=sbin
3151 - -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb"
3152 - -DWITH_COMMENT="Gentoo Linux ${PF}"
3153 - -DWITH_UNIT_TESTS=$(usex test ON OFF)
3154 - -DWITH_LIBEDIT=0
3155 - -DWITH_ZLIB=system
3156 - -DWITHOUT_LIBWRAP=1
3157 - -DENABLED_LOCAL_INFILE=1
3158 - -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock"
3159 - -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock"
3160 - -DWITH_DEFAULT_COMPILER_OPTIONS=0
3161 - -DWITH_DEFAULT_FEATURE_SET=0
3162 - -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)"
3163 - # The build forces this to be defined when cross-compiling. We pass it
3164 - # all the time for simplicity and to make sure it is actually correct.
3165 - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
3166 - -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)"
3167 - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
3168 - -DAUTH_GSSAPI_PLUGIN_TYPE=$(usex kerberos DYNAMIC OFF)
3169 - -DCONC_WITH_EXTERNAL_ZLIB=YES
3170 - -DWITH_EXTERNAL_ZLIB=YES
3171 - -DSUFFIX_INSTALL_DIR=""
3172 - -DWITH_UNITTEST=OFF
3173 - -DWITHOUT_CLIENTLIBS=YES
3174 - -DCLIENT_PLUGIN_DIALOG=OFF
3175 - -DCLIENT_PLUGIN_AUTH_GSSAPI_CLIENT=OFF
3176 - -DCLIENT_PLUGIN_CLIENT_ED25519=OFF
3177 - -DCLIENT_PLUGIN_MYSQL_CLEAR_PASSWORD=STATIC
3178 - -DCLIENT_PLUGIN_CACHING_SHA2_PASSWORD=OFF
3179 - )
3180 - if use test ; then
3181 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test )
3182 - else
3183 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
3184 - fi
3185 -
3186 - if ! use yassl ; then
3187 - mycmakeargs+=( -DWITH_SSL=system -DCLIENT_PLUGIN_SHA256_PASSWORD=STATIC )
3188 - else
3189 - mycmakeargs+=( -DWITH_SSL=bundled )
3190 - fi
3191 -
3192 - # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION
3193 - mycmakeargs+=(
3194 - -DWITH_READLINE=$(usex bindist 1 0)
3195 - -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1)
3196 - -DENABLE_DTRACE=$(usex systemtap)
3197 - )
3198 -
3199 - if use server ; then
3200 -
3201 - # Federated{,X} must be treated special otherwise they will not be built as plugins
3202 - if ! use extraengine ; then
3203 - mycmakeargs+=(
3204 - -DPLUGIN_FEDERATED=NO
3205 - -DPLUGIN_FEDERATEDX=NO )
3206 - fi
3207 -
3208 - mycmakeargs+=(
3209 - -DWITH_JEMALLOC=$(usex jemalloc system)
3210 - -DWITH_PCRE=system
3211 - -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO)
3212 - -DPLUGIN_SPHINX=$(usex sphinx YES NO)
3213 - -DPLUGIN_TOKUDB=$(usex tokudb YES NO)
3214 - -DPLUGIN_AUTH_PAM=$(usex pam YES NO)
3215 - -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO)
3216 - -DPLUGIN_CASSANDRA=NO
3217 - -DPLUGIN_SEQUENCE=$(usex extraengine YES NO)
3218 - -DPLUGIN_SPIDER=$(usex extraengine YES NO)
3219 - -DPLUGIN_CONNECT=$(usex extraengine YES NO)
3220 - -DCONNECT_WITH_MYSQL=1
3221 - -DCONNECT_WITH_LIBXML2=$(usex xml)
3222 - -DCONNECT_WITH_ODBC=$(usex odbc)
3223 - -DCONNECT_WITH_JDBC=$(usex jdbc)
3224 - # Build failure and autodep wrt bug 639144
3225 - -DCONNECT_WITH_MONGO=OFF
3226 - -DWITH_WSREP=$(usex galera)
3227 - -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF)
3228 - -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF)
3229 - -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF)
3230 - -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO)
3231 - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
3232 - -DWITH_MARIABACKUP=$(usex backup ON OFF)
3233 - -DWITH_LIBARCHIVE=$(usex backup ON OFF)
3234 - -DINSTALL_SQLBENCHDIR=share/mariadb
3235 - -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO)
3236 - # systemd is only linked to for server notification
3237 - -DWITH_SYSTEMD=$(usex systemd yes no)
3238 - -DWITH_NUMA=$(usex numa ON OFF)
3239 - )
3240 -
3241 - # Workaround for MDEV-14524
3242 - use tokudb && mycmakeargs+=( -DTOKUDB_OK=1 )
3243 -
3244 - if use test ; then
3245 - # This is needed for the new client lib which tests a real, open server
3246 - mycmakeargs+=( -DSKIP_TESTS=ON )
3247 - fi
3248 -
3249 - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
3250 - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
3251 - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
3252 - ewarn "You MUST file bugs without these variables set."
3253 -
3254 - mycmakeargs+=(
3255 - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
3256 - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
3257 - )
3258 -
3259 - elif ! use latin1 ; then
3260 - mycmakeargs+=(
3261 - -DDEFAULT_CHARSET=utf8
3262 - -DDEFAULT_COLLATION=utf8_general_ci
3263 - )
3264 - else
3265 - mycmakeargs+=(
3266 - -DDEFAULT_CHARSET=latin1
3267 - -DDEFAULT_COLLATION=latin1_swedish_ci
3268 - )
3269 - fi
3270 - mycmakeargs+=(
3271 - -DEXTRA_CHARSETS=all
3272 - -DMYSQL_USER=mysql
3273 - -DDISABLE_SHARED=$(usex static YES NO)
3274 - -DWITH_DEBUG=$(usex debug)
3275 - -DWITH_EMBEDDED_SERVER=OFF
3276 - -DWITH_PROFILING=$(usex profiling)
3277 - )
3278 -
3279 - if use static; then
3280 - mycmakeargs+=( -DWITH_PIC=1 )
3281 - fi
3282 -
3283 - if use jemalloc || use tcmalloc ; then
3284 - mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
3285 - fi
3286 -
3287 - # Storage engines
3288 - mycmakeargs+=(
3289 - -DWITH_ARCHIVE_STORAGE_ENGINE=1
3290 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1
3291 - -DWITH_CSV_STORAGE_ENGINE=1
3292 - -DWITH_HEAP_STORAGE_ENGINE=1
3293 - -DWITH_INNOBASE_STORAGE_ENGINE=1
3294 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1
3295 - -DWITH_MYISAM_STORAGE_ENGINE=1
3296 - -DWITH_PARTITION_STORAGE_ENGINE=1
3297 - )
3298 -
3299 - else
3300 - mycmakeargs+=(
3301 - -DWITHOUT_SERVER=1
3302 - -DWITH_EMBEDDED_SERVER=OFF
3303 - -DEXTRA_CHARSETS=none
3304 - -DINSTALL_SQLBENCHDIR=
3305 - -DWITH_SYSTEMD=no
3306 - )
3307 - fi
3308 -
3309 - cmake_src_configure
3310 -}
3311 -
3312 -src_compile() {
3313 - cmake_src_compile
3314 -}
3315 -
3316 -# Official test instructions:
3317 -# USE='extraengine perl server' \
3318 -# FEATURES='test userpriv' \
3319 -# ebuild mariadb-X.X.XX.ebuild \
3320 -# digest clean package
3321 -src_test() {
3322 - _disable_test() {
3323 - local rawtestname bug reason
3324 - rawtestname="${1}" ; shift
3325 - bug="${1}" ; shift
3326 - reason="${@}"
3327 - ewarn "test '${rawtestname}' disabled: '${reason}' (BUG#${bug})"
3328 - echo "${rawtestname} : BUG#${bug} ${reason}" >> "${T}/disabled.def"
3329 - }
3330 -
3331 - local TESTDIR="${BUILD_DIR}/mysql-test"
3332 - local retstatus_unit
3333 - local retstatus_tests
3334 -
3335 - if ! use server ; then
3336 - einfo "Skipping server tests due to minimal build."
3337 - return 0
3338 - fi
3339 -
3340 - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
3341 -
3342 - # Run CTest (test-units)
3343 - cmake_src_test
3344 - retstatus_unit=$?
3345 -
3346 - # Ensure that parallel runs don't die
3347 - export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
3348 -
3349 - if [[ -z "${MTR_PARALLEL}" ]] ; then
3350 - local -x MTR_PARALLEL=$(makeopts_jobs)
3351 -
3352 - if [[ ${MTR_PARALLEL} -gt 4 ]] ; then
3353 - # Running multiple tests in parallel usually require higher ulimit
3354 - # and fs.aio-max-nr setting. In addition, tests like main.multi_update
3355 - # are known to hit timeout when system is busy.
3356 - # To avoid test failure we will limit MTR_PARALLEL to 4 instead of
3357 - # using "auto".
3358 - local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})"
3359 - info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!"
3360 - einfo "${info_msg}"
3361 - unset info_msg
3362 - MTR_PARALLEL=4
3363 - fi
3364 - else
3365 - einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'"
3366 - fi
3367 -
3368 - # Try to increase file limits to increase test coverage
3369 - if ! ulimit -n 16500 1>/dev/null 2>&1 ; then
3370 - # Upper limit comes from parts.partition_* tests
3371 - ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager."
3372 -
3373 - if ! ulimit -n 4162 1>/dev/null 2>&1 ; then
3374 - # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)'
3375 - ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager."
3376 -
3377 - if ! ulimit -n 3000 1>/dev/null 2>&1 ; then
3378 - ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager."
3379 - else
3380 - einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)."
3381 - fi
3382 - else
3383 - einfo "Will run test suite with open file limit set to 4162 (medium test coverage)."
3384 - fi
3385 - else
3386 - einfo "Will run test suite with open file limit set to 16500 (best test coverage)."
3387 - fi
3388 -
3389 - # create directories because mysqladmin might run out of order
3390 - mkdir -p "${T}"/var-tests{,/log} || die
3391 -
3392 - cp "${S}"/mysql-test/unstable-tests "${T}/disabled.def" || die
3393 -
3394 - local -a disabled_tests
3395 - disabled_tests+=( "compat/oracle.plugin;0;Needs example plugin which Gentoo disables" )
3396 - disabled_tests+=( "main.explain_non_select;0;Sporadically failing test" )
3397 - disabled_tests+=( "main.func_time;0;Dependent on time test was written" )
3398 - disabled_tests+=( "main.grant;0;Sporadically failing test" )
3399 - disabled_tests+=( "main.join_cache;0;Sporadically failing test" )
3400 - disabled_tests+=( "main.plugin_auth;0;Needs client libraries built" )
3401 - disabled_tests+=( "main.stat_tables;0;Sporadically failing test" )
3402 - disabled_tests+=( "main.stat_tables_innodb;0;Sporadically failing test" )
3403 - disabled_tests+=( "mariabackup.*;0;Broken test suite" )
3404 - disabled_tests+=( "plugins.auth_ed25519;0;Needs client libraries built" )
3405 - disabled_tests+=( "plugins.cracklib_password_check;0;False positive due to varying policies" )
3406 - disabled_tests+=( "plugins.two_password_validations;0;False positive due to varying policies" )
3407 - disabled_tests+=( "roles.acl_statistics;0;False positive due to a user count mismatch caused by previous test" )
3408 -
3409 - if ! use latin1 ; then
3410 - disabled_tests+=( "funcs_1.is_columns_mysql;0;Requires USE=latin1" )
3411 - disabled_tests+=( "main.information_schema;0;Requires USE=latin1" )
3412 - disabled_tests+=( "main.system_mysql_db;0;Requires USE=latin1" )
3413 - fi
3414 -
3415 - local test_infos_str test_infos_arr
3416 - for test_infos_str in "${disabled_tests[@]}" ; do
3417 - IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}"
3418 -
3419 - if [[ ${#test_infos_arr[@]} != 3 ]] ; then
3420 - die "Invalid test data set, not matching format: ${test_infos_str}"
3421 - fi
3422 -
3423 - _disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}"
3424 - done
3425 - unset test_infos_str test_infos_arr
3426 -
3427 - # run mysql-test tests
3428 - pushd "${TESTDIR}" &>/dev/null || die
3429 - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def"
3430 - retstatus_tests=$?
3431 -
3432 - popd &>/dev/null || die
3433 -
3434 - # Cleanup is important for these testcases.
3435 - pkill -9 -f "${S}/ndb" 2>/dev/null
3436 - pkill -9 -f "${S}/sql" 2>/dev/null
3437 -
3438 - local failures=""
3439 - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
3440 - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
3441 -
3442 - [[ -z "$failures" ]] || die "Test failures: $failures"
3443 - einfo "Tests successfully completed"
3444 -}
3445 -
3446 -src_install() {
3447 - cmake_src_install
3448 -
3449 - # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used
3450 - if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then
3451 - rm "${ED}/usr/include/mysql/server/private/config.h" || die
3452 - fi
3453 -
3454 - # Make sure the vars are correctly initialized
3455 - mysql_init_vars
3456 -
3457 - # Convenience links
3458 - einfo "Making Convenience links for mysqlcheck multi-call binary"
3459 - dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
3460 - dosym "mysqlcheck" "/usr/bin/mysqlrepair"
3461 - dosym "mysqlcheck" "/usr/bin/mysqloptimize"
3462 -
3463 - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
3464 - if [[ -d "${ED}/usr/data" ]] ; then
3465 - rm -Rf "${ED}/usr/data" || die
3466 - fi
3467 -
3468 - # Unless they explicitly specific USE=test, then do not install the
3469 - # testsuite. It DOES have a use to be installed, esp. when you want to do a
3470 - # validation of your database configuration after tuning it.
3471 - if ! use test ; then
3472 - rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
3473 - fi
3474 -
3475 - # Configuration stuff
3476 - einfo "Building default configuration ..."
3477 - insinto "${MY_SYSCONFDIR#${EPREFIX}}"
3478 - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
3479 - cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die
3480 - eprefixify "${TMPDIR}/my.cnf"
3481 - doins "${TMPDIR}/my.cnf"
3482 - insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d"
3483 - cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
3484 - eprefixify "${TMPDIR}/50-distro-client.cnf"
3485 - doins "${TMPDIR}/50-distro-client.cnf"
3486 -
3487 - if use server ; then
3488 - mycnf_src="my.cnf.distro-server"
3489 - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
3490 - "${FILESDIR}/${mycnf_src}" \
3491 - > "${TMPDIR}/my.cnf.ok" || die
3492 - if use prefix ; then
3493 - sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
3494 - "${TMPDIR}/my.cnf.ok" || die
3495 - fi
3496 - if use latin1 ; then
3497 - sed -i \
3498 - -e "/character-set/s|utf8|latin1|g" \
3499 - "${TMPDIR}/my.cnf.ok" || die
3500 - fi
3501 - eprefixify "${TMPDIR}/my.cnf.ok"
3502 - newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
3503 -
3504 - einfo "Including support files and sample configurations"
3505 - docinto "support-files"
3506 - local script
3507 - for script in \
3508 - "${S}"/support-files/magic
3509 - do
3510 - [[ -f "$script" ]] && dodoc "${script}"
3511 - done
3512 -
3513 - docinto "scripts"
3514 - for script in "${S}"/scripts/mysql* ; do
3515 - [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
3516 - done
3517 - # Manually install supporting files that conflict with other packages
3518 - # but are needed for galera and initial installation
3519 - exeinto /usr/libexec/mariadb
3520 - doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror"
3521 - fi
3522 -
3523 - # Remove mytop if perl is not selected
3524 - if [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl ; then
3525 - rm -f "${ED}/usr/bin/mytop" || die
3526 - fi
3527 -
3528 - # Fix a dangling symlink when galera is not built
3529 - if [[ -L "${ED}/usr/bin/wsrep_sst_rsync_wan" ]] && ! use galera ; then
3530 - rm "${ED}/usr/bin/wsrep_sst_rsync_wan" || die
3531 - fi
3532 -}
3533 -
3534 -pkg_preinst() {
3535 - java-pkg-opt-2_pkg_preinst
3536 -
3537 - # Here we need to see if the implementation switched client libraries
3538 - # We check if this is a new instance of the package and a client library already exists
3539 - local SHOW_ABI_MESSAGE libpath
3540 - if [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}/usr/$(get_libdir)/libmysqlclient.so" ]] ; then
3541 - libpath=$(readlink "${EROOT}/usr/$(get_libdir)/libmysqlclient.so")
3542 - elog "Due to ABI changes when switching between different client libraries,"
3543 - elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient."
3544 - elog "Please run: revdep-rebuild --library ${libpath}"
3545 - ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries"
3546 - fi
3547 -}
3548 -
3549 -pkg_postinst() {
3550 - # Make sure the vars are correctly initialized
3551 - mysql_init_vars
3552 -
3553 - # Create log directory securely if it does not exist
3554 - [[ -d "${ROOT}/${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}/${MY_LOGDIR}"
3555 -
3556 - if use server ; then
3557 - if use pam; then
3558 - einfo
3559 - elog "This install includes the PAM authentication plugin."
3560 - elog "To activate and configure the PAM plugin, please read:"
3561 - elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/"
3562 - einfo
3563 - fi
3564 -
3565 - if [[ -z "${REPLACING_VERSIONS}" ]] ; then
3566 - einfo
3567 - elog "You might want to run:"
3568 - elog "\"emerge --config =${CATEGORY}/${PF}\""
3569 - elog "if this is a new install."
3570 - elog
3571 - elog "If you are switching server implentations, you should run the"
3572 - elog "mysql_upgrade tool."
3573 - einfo
3574 - else
3575 - einfo
3576 - elog "If you are upgrading major versions, you should run the"
3577 - elog "mysql_upgrade tool."
3578 - einfo
3579 - fi
3580 -
3581 - if use galera ; then
3582 - einfo
3583 - elog "Be sure to edit the my.cnf file to activate your cluster settings."
3584 - elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
3585 - elog "The first time the cluster is activated, you should add"
3586 - elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
3587 - elog "This option should then be removed for subsequent starts."
3588 - einfo
3589 - if use sst-xtrabackup ; then
3590 - ewarn "As per https://mariadb.com/kb/en/meta/xtrabackup_warning/, XtraBackup"
3591 - ewarn "as an SST is broken by default beginning with 10.2.19 with the setting"
3592 - ewarn "innodb_safe_truncate=ON. Please migrate to sst-mariabackup instead."
3593 - ewarn "sst-xtrabackup is being removed in 10.3 and higher."
3594 - fi
3595 - fi
3596 - fi
3597 -
3598 - # Note about configuration change
3599 - einfo
3600 - elog "This version of mariadb reorganizes the configuration from a single my.cnf"
3601 - elog "to several files in /etc/mysql/${PN}.d."
3602 - elog "Please backup any changes you made to /etc/mysql/my.cnf"
3603 - elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension."
3604 - elog "You may have as many files as needed and they are read alphabetically."
3605 - elog "Be sure the options have the appropriate section headers, i.e. [mysqld]."
3606 - einfo
3607 -}
3608 -
3609 -pkg_config() {
3610 - _getoptval() {
3611 - local mypd="${EROOT}"/usr/libexec/mariadb/my_print_defaults
3612 - local section="$1"
3613 - local flag="--${2}="
3614 - local extra_options="${3}"
3615 - "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp"
3616 - }
3617 - local old_MY_DATADIR="${MY_DATADIR}"
3618 - local old_HOME="${HOME}"
3619 - # my_print_defaults needs to read stuff in $HOME/.my.cnf
3620 - export HOME=${EPREFIX}/root
3621 -
3622 - # Make sure the vars are correctly initialized
3623 - mysql_init_vars
3624 -
3625 - [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
3626 - if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then
3627 - die "Minimal builds do NOT include the MySQL server"
3628 - fi
3629 -
3630 - if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then
3631 - local MY_DATADIR_s="${ROOT}/${MY_DATADIR}"
3632 - MY_DATADIR_s="${MY_DATADIR_s%%/}"
3633 - local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}"
3634 - old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
3635 -
3636 - if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then
3637 - if [[ -d "${MY_DATADIR_s}" ]]; then
3638 - ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
3639 - ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
3640 - else
3641 - elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
3642 - mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
3643 - || die "Moving MY_DATADIR failed"
3644 - fi
3645 - else
3646 - ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
3647 - if [[ -d "${MY_DATADIR_s}" ]]; then
3648 - ewarn "Attempting to use ${MY_DATADIR_s}"
3649 - else
3650 - eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
3651 - die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
3652 - fi
3653 - fi
3654 - fi
3655 -
3656 - local pwd1="a"
3657 - local pwd2="b"
3658 - local maxtry=15
3659 -
3660 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
3661 - local tmp_mysqld_password_source=
3662 -
3663 - for tmp_mysqld_password_source in mysql client; do
3664 - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
3665 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
3666 - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then
3667 - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then
3668 - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
3669 - MYSQL_ROOT_PASSWORD=
3670 - continue
3671 - fi
3672 -
3673 - einfo "Found password in '${tmp_mysqld_password_source}' section!"
3674 - break
3675 - fi
3676 - done
3677 -
3678 - # Sometimes --show is required to display passwords in some implementations of my_print_defaults
3679 - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then
3680 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
3681 - fi
3682 -
3683 - unset tmp_mysqld_password_source
3684 - fi
3685 - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir | tail -n1)"
3686 - # These are dir+prefix
3687 - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log | tail -n1)"
3688 - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
3689 - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin | tail -n1)"
3690 - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
3691 -
3692 - if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then
3693 - einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
3694 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR"
3695 - fi
3696 - if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then
3697 - einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
3698 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN"
3699 - fi
3700 - if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then
3701 - einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
3702 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG"
3703 - fi
3704 -
3705 - if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then
3706 - ewarn "You have already a MySQL database in place."
3707 - ewarn "(${ROOT}/${MY_DATADIR}/*)"
3708 - ewarn "Please rename or delete it if you wish to replace it."
3709 - die "MySQL database already exists!"
3710 - fi
3711 -
3712 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
3713 - # localhost. Also causes weird failures.
3714 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
3715 -
3716 - if [[ -z "${MYSQL_ROOT_PASSWORD}" ]]; then
3717 -
3718 - einfo "Please provide a password for the mysql 'root'@'localhost' user now"
3719 - einfo "or through the ${HOME}/.my.cnf file."
3720 - ewarn "Avoid [\"'\\_%] characters in the password"
3721 - read -rsp " >" pwd1 ; echo
3722 -
3723 - einfo "Retype the password"
3724 - read -rsp " >" pwd2 ; echo
3725 -
3726 - if [[ "x$pwd1" != "x$pwd2" ]] ; then
3727 - die "Passwords are not the same"
3728 - fi
3729 -
3730 - MYSQL_ROOT_PASSWORD="${pwd1}"
3731 - unset pwd1 pwd2
3732 - fi
3733 -
3734 - local options
3735 - local sqltmp="$(emktemp)"
3736 -
3737 - # Fix bug 446200. Don't reference host my.cnf, needs to come first,
3738 - # see https://bugs.mysql.com/bug.php?id=31312
3739 - use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
3740 -
3741 - # Figure out which options we need to disable to do the setup
3742 - local helpfile="${TMPDIR}/mysqld-help"
3743 - "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
3744 - for opt in grant-tables host-cache name-resolve networking slave-start \
3745 - federated ssl log-bin relay-log slow-query-log external-locking \
3746 - log-slave-updates \
3747 - ; do
3748 - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
3749 - egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
3750 - done
3751 -
3752 - einfo "Creating the mysql database and setting proper permissions on it ..."
3753 -
3754 - # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
3755 - PID_DIR="${EROOT}/var/run/mysqld"
3756 - if [[ ! -d "${PID_DIR}" ]]; then
3757 - install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
3758 - fi
3759 -
3760 - if [[ ! -d "${MY_DATADIR}" ]]; then
3761 - install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory"
3762 - fi
3763 -
3764 - pushd "${TMPDIR}" &>/dev/null || die
3765 -
3766 - # Filling timezones, see
3767 - # https://dev.mysql.com/doc/mysql/en/time-zone-support.html
3768 - "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null
3769 -
3770 - local cmd=( "${EROOT}/usr/share/mariadb/scripts/mysql_install_db" )
3771 - [[ -f "${cmd}" ]] || cmd=( "${EROOT}/usr/bin/mysql_install_db" )
3772 - cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" )
3773 - einfo "Command: ${cmd[*]}"
3774 - su -s /bin/sh -c "${cmd[*]}" mysql \
3775 - >"${TMPDIR}"/mysql_install_db.log 2>&1
3776 - if [[ $? -ne 0 ]]; then
3777 - grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2
3778 - die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log"
3779 - fi
3780 - popd &>/dev/null || die
3781 - [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \
3782 - || die "MySQL databases not installed"
3783 -
3784 - use prefix || options="${options} --user=mysql"
3785 -
3786 - local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock"
3787 - local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid"
3788 - local mysqld="${EROOT}/usr/sbin/mysqld \
3789 - ${options} \
3790 - --log-warnings=0 \
3791 - --basedir=${EROOT}/usr \
3792 - --datadir=${ROOT}/${MY_DATADIR} \
3793 - --max_allowed_packet=8M \
3794 - --net_buffer_length=16K \
3795 - --socket=${socket} \
3796 - --pid-file=${pidfile} \
3797 - --tmpdir=${ROOT}/${MYSQL_TMPDIR}"
3798 - #einfo "About to start mysqld: ${mysqld}"
3799 - ebegin "Starting mysqld"
3800 - einfo "Command ${mysqld}"
3801 - ${mysqld} &
3802 - rc=$?
3803 - while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
3804 - maxtry=$((${maxtry}-1))
3805 - echo -n "."
3806 - sleep 1
3807 - done
3808 - eend $rc
3809 -
3810 - if ! [[ -S "${socket}" ]]; then
3811 - die "Completely failed to start up mysqld with: ${mysqld}"
3812 - fi
3813 -
3814 - ebegin "Setting root password"
3815 - # Do this from memory, as we don't want clear text passwords in temp files
3816 - local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES"
3817 - "${EROOT}/usr/bin/mysql" \
3818 - "--socket=${socket}" \
3819 - -hlocalhost \
3820 - -e "${sql}"
3821 - eend $?
3822 -
3823 - if [[ -n "${sqltmp}" ]] ; then
3824 - ebegin "Loading \"zoneinfo\", this step may require a few seconds"
3825 - "${EROOT}/usr/bin/mysql" \
3826 - "--socket=${socket}" \
3827 - -hlocalhost \
3828 - -uroot \
3829 - --password="${MYSQL_ROOT_PASSWORD}" \
3830 - mysql < "${sqltmp}"
3831 - rc=$?
3832 - eend $?
3833 - [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!"
3834 - fi
3835 -
3836 - # Stop the server and cleanup
3837 - einfo "Stopping the server ..."
3838 - kill $(< "${pidfile}" )
3839 - rm -f "${sqltmp}"
3840 - wait %1
3841 - einfo "Done"
3842 -}
3843
3844 diff --git a/dev-db/mariadb/mariadb-10.3.24.ebuild b/dev-db/mariadb/mariadb-10.3.24.ebuild
3845 deleted file mode 100644
3846 index d32933c9d72..00000000000
3847 --- a/dev-db/mariadb/mariadb-10.3.24.ebuild
3848 +++ /dev/null
3849 @@ -1,1008 +0,0 @@
3850 -# Copyright 1999-2020 Gentoo Authors
3851 -# Distributed under the terms of the GNU General Public License v2
3852 -
3853 -EAPI="7"
3854 -SUBSLOT="18"
3855 -
3856 -JAVA_PKG_OPT_USE="jdbc"
3857 -
3858 -inherit eutils systemd flag-o-matic prefix toolchain-funcs \
3859 - multiprocessing java-pkg-opt-2 cmake
3860 -
3861 -# Patch version
3862 -PATCH_SET="https://dev.gentoo.org/~whissi/dist/${PN}/${PN}-10.3.24-patches-01.tar.xz"
3863 -
3864 -SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz
3865 - ${PATCH_SET}"
3866 -
3867 -HOMEPAGE="https://mariadb.org/"
3868 -DESCRIPTION="An enhanced, drop-in replacement for MySQL"
3869 -LICENSE="GPL-2 LGPL-2.1+"
3870 -SLOT="10.3/${SUBSLOT:-0}"
3871 -IUSE="+backup bindist client-libs cracklib debug extraengine galera innodb-lz4
3872 - innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 libressl mroonga
3873 - numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx
3874 - sst-rsync sst-mariabackup static systemd systemtap tcmalloc
3875 - test tokudb xml yassl"
3876 -
3877 -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
3878 -RESTRICT="!bindist? ( bindist ) libressl? ( test ) !test? ( test )"
3879 -
3880 -REQUIRED_USE="jdbc? ( extraengine server !static )
3881 - server? ( tokudb? ( jemalloc !tcmalloc ) )
3882 - ?? ( tcmalloc jemalloc )
3883 - static? ( yassl !pam )"
3884 -
3885 -KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
3886 -
3887 -# Shorten the path because the socket path length must be shorter than 107 chars
3888 -# and we will run a mysql server during test phase
3889 -S="${WORKDIR}/mysql"
3890 -
3891 -# Be warned, *DEPEND are version-dependant
3892 -# These are used for both runtime and compiletime
3893 -COMMON_DEPEND="
3894 - kernel_linux? (
3895 - sys-process/procps:0=
3896 - dev-libs/libaio:0=
3897 - )
3898 - >=sys-apps/sed-4
3899 - >=sys-apps/texinfo-4.7-r1
3900 - jemalloc? ( dev-libs/jemalloc:0= )
3901 - tcmalloc? ( dev-util/google-perftools:0= )
3902 - systemtap? ( >=dev-util/systemtap-1.3:0= )
3903 - >=sys-libs/zlib-1.2.3:0=
3904 - kerberos? ( virtual/krb5 )
3905 - yassl? ( net-libs/gnutls:0= )
3906 - !yassl? (
3907 - !libressl? ( >=dev-libs/openssl-1.0.0:0= )
3908 - libressl? ( dev-libs/libressl:0= )
3909 - )
3910 - sys-libs/ncurses:0=
3911 - !bindist? (
3912 - sys-libs/binutils-libs:0=
3913 - >=sys-libs/readline-4.1:0=
3914 - )
3915 - server? (
3916 - backup? ( app-arch/libarchive:0= )
3917 - cracklib? ( sys-libs/cracklib:0= )
3918 - extraengine? (
3919 - odbc? ( dev-db/unixODBC:0= )
3920 - xml? ( dev-libs/libxml2:2= )
3921 - )
3922 - innodb-lz4? ( app-arch/lz4 )
3923 - innodb-lzo? ( dev-libs/lzo )
3924 - innodb-snappy? ( app-arch/snappy )
3925 - mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 )
3926 - numa? ( sys-process/numactl )
3927 - oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= )
3928 - pam? ( sys-libs/pam:0= )
3929 - systemd? ( sys-apps/systemd:= )
3930 - tokudb? ( app-arch/snappy )
3931 - )
3932 - >=dev-libs/libpcre-8.41-r1:3=
3933 -"
3934 -BDEPEND="virtual/yacc
3935 - || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
3936 -"
3937 -DEPEND="static? ( sys-libs/ncurses[static-libs] )
3938 - server? (
3939 - extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) )
3940 - test? ( acct-group/mysql acct-user/mysql )
3941 - )
3942 - ${COMMON_DEPEND}"
3943 -RDEPEND="selinux? ( sec-policy/selinux-mysql )
3944 - !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
3945 - !dev-db/mariadb:0
3946 - !dev-db/mariadb:5.5
3947 - !dev-db/mariadb:10.1
3948 - !dev-db/mariadb:10.2
3949 - !dev-db/mariadb:10.4
3950 - !dev-db/mariadb:10.5
3951 - !<virtual/mysql-5.6-r11
3952 - ${COMMON_DEPEND}
3953 - server? (
3954 - galera? (
3955 - sys-apps/iproute2
3956 - =sys-cluster/galera-25*
3957 - sst-rsync? ( sys-process/lsof )
3958 - sst-mariabackup? ( net-misc/socat[ssl] )
3959 - )
3960 - !prefix? ( dev-db/mysql-init-scripts acct-group/mysql acct-user/mysql )
3961 - extraengine? ( jdbc? ( >=virtual/jre-1.6 ) )
3962 - )
3963 - perl? (
3964 - !dev-db/mytop
3965 - virtual/perl-Getopt-Long
3966 - dev-perl/TermReadKey
3967 - virtual/perl-Term-ANSIColor
3968 - virtual/perl-Time-HiRes
3969 - )
3970 -"
3971 -# For other stuff to bring us in
3972 -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
3973 -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
3974 -
3975 -mysql_init_vars() {
3976 - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"}
3977 - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
3978 - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
3979 - MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
3980 -
3981 - if [[ -z "${MY_DATADIR}" ]] ; then
3982 - MY_DATADIR=""
3983 - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
3984 - MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \
3985 - | sed -ne '/datadir/s|^--datadir=||p' \
3986 - | tail -n1)
3987 - if [[ -z "${MY_DATADIR}" ]] ; then
3988 - MY_DATADIR=$(grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
3989 - | sed -e 's/.*=\s*//' \
3990 - | tail -n1)
3991 - fi
3992 - fi
3993 - if [[ -z "${MY_DATADIR}" ]] ; then
3994 - MY_DATADIR="${MY_LOCALSTATEDIR}"
3995 - einfo "Using default MY_DATADIR"
3996 - fi
3997 - elog "MySQL MY_DATADIR is ${MY_DATADIR}"
3998 -
3999 - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
4000 - if [[ -e "${MY_DATADIR}" ]] ; then
4001 - # If you get this and you're wondering about it, see bug #207636
4002 - elog "MySQL datadir found in ${MY_DATADIR}"
4003 - elog "A new one will not be created."
4004 - PREVIOUS_DATADIR="yes"
4005 - else
4006 - PREVIOUS_DATADIR="no"
4007 - fi
4008 - export PREVIOUS_DATADIR
4009 - fi
4010 - else
4011 - if [[ ${EBUILD_PHASE} == "config" ]]; then
4012 - local new_MY_DATADIR
4013 - new_MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \
4014 - | sed -ne '/datadir/s|^--datadir=||p' \
4015 - | tail -n1)
4016 -
4017 - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
4018 - ewarn "MySQL MY_DATADIR has changed"
4019 - ewarn "from ${MY_DATADIR}"
4020 - ewarn "to ${new_MY_DATADIR}"
4021 - MY_DATADIR="${new_MY_DATADIR}"
4022 - fi
4023 - fi
4024 - fi
4025 -
4026 - export MY_SHAREDSTATEDIR MY_SYSCONFDIR
4027 - export MY_LOCALSTATEDIR MY_LOGDIR
4028 - export MY_DATADIR
4029 -}
4030 -
4031 -pkg_setup() {
4032 - if [[ ${MERGE_TYPE} != binary ]] ; then
4033 - local GCC_MAJOR_SET=$(gcc-major-version)
4034 - local GCC_MINOR_SET=$(gcc-minor-version)
4035 -
4036 - if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \
4037 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
4038 - eerror "${PN} with tokudb needs to be built with gcc-4.7 or later."
4039 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
4040 - die
4041 - fi
4042 -
4043 - # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
4044 - # non x86{,_64} arches
4045 - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
4046 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
4047 - eerror "${PN} needs to be built with gcc-4.7 or later."
4048 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
4049 - die
4050 - fi
4051 -
4052 - if has test ${FEATURES} ; then
4053 - # Bug #213475 - MySQL _will_ object strenuously if your machine is named
4054 - # localhost. Also causes weird failures.
4055 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
4056 -
4057 - if ! has userpriv ${FEATURES} ; then
4058 - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
4059 - fi
4060 - fi
4061 - fi
4062 -
4063 - java-pkg-opt-2_pkg_setup
4064 -}
4065 -
4066 -src_unpack() {
4067 - unpack ${A}
4068 -
4069 - mv -f "${WORKDIR}/${P/_rc/}" "${S}" || die
4070 -}
4071 -
4072 -src_prepare() {
4073 - eapply "${WORKDIR}"/mariadb-patches
4074 -
4075 - eapply_user
4076 -
4077 - _disable_plugin() {
4078 - echo > "${S}/plugin/${1}/CMakeLists.txt" || die
4079 - }
4080 - _disable_engine() {
4081 - echo > "${S}/storage/${1}/CMakeLists.txt" || die
4082 - }
4083 -
4084 - if use jemalloc; then
4085 - echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt"
4086 - elif use tcmalloc; then
4087 - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt"
4088 - fi
4089 -
4090 - # Don't build bundled xz-utils for tokudb
4091 - echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die
4092 - sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die
4093 - sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die
4094 -
4095 - local plugin
4096 - local server_plugins=( handler_socket auth_socket feedback metadata_lock_info
4097 - locale_info qc_info server_audit sql_errlog auth_ed25519 )
4098 - local test_plugins=( audit_null auth_examples daemon_example fulltext
4099 - debug_key_management example_key_management versioning )
4100 - if ! use server; then # These plugins are for the server
4101 - for plugin in "${server_plugins[@]}" ; do
4102 - _disable_plugin "${plugin}"
4103 - done
4104 - fi
4105 -
4106 - if ! use test; then # These plugins are only used during testing
4107 - for plugin in "${test_plugins[@]}" ; do
4108 - _disable_plugin "${plugin}"
4109 - done
4110 - _disable_engine test_sql_discovery
4111 - fi
4112 -
4113 - _disable_engine example
4114 -
4115 - if ! use oqgraph ; then # avoids extra library checks
4116 - _disable_engine oqgraph
4117 - fi
4118 -
4119 - if use mroonga ; then
4120 - # Remove the bundled groonga
4121 - # There is no CMake flag, it simply checks for existance
4122 - rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga"
4123 - else
4124 - _disable_engine mroonga
4125 - fi
4126 -
4127 - # Fix galera_recovery.sh script
4128 - sed -i -e "s~@bindir@/my_print_defaults~${EPREFIX}/usr/libexec/mariadb/my_print_defaults~" \
4129 - scripts/galera_recovery.sh || die
4130 -
4131 - cmake_src_prepare
4132 - java-pkg-opt-2_src_prepare
4133 -}
4134 -
4135 -src_configure() {
4136 - # bug 508724 mariadb cannot use ld.gold
4137 - tc-ld-disable-gold
4138 - # Bug #114895, bug #110149
4139 - filter-flags "-O" "-O[01]"
4140 -
4141 - append-cxxflags -felide-constructors
4142 -
4143 - # bug #283926, with GCC4.4, this is required to get correct behavior.
4144 - append-flags -fno-strict-aliasing
4145 -
4146 - CMAKE_BUILD_TYPE="RelWithDebInfo"
4147 -
4148 - # debug hack wrt #497532
4149 - mycmakeargs=(
4150 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
4151 - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
4152 - -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql"
4153 - -DSYSCONFDIR="${EPREFIX}/etc/mysql"
4154 - -DINSTALL_BINDIR=bin
4155 - -DINSTALL_DOCDIR=share/doc/${PF}
4156 - -DINSTALL_DOCREADMEDIR=share/doc/${PF}
4157 - -DINSTALL_INCLUDEDIR=include/mysql
4158 - -DINSTALL_INFODIR=share/info
4159 - -DINSTALL_LIBDIR=$(get_libdir)
4160 - -DINSTALL_MANDIR=share/man
4161 - -DINSTALL_MYSQLSHAREDIR=share/mariadb
4162 - -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin
4163 - -DINSTALL_SCRIPTDIR=share/mariadb/scripts
4164 - -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql"
4165 - -DINSTALL_SBINDIR=sbin
4166 - -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb"
4167 - -DWITH_COMMENT="Gentoo Linux ${PF}"
4168 - -DWITH_UNIT_TESTS=$(usex test ON OFF)
4169 - -DWITH_LIBEDIT=0
4170 - -DWITH_ZLIB=system
4171 - -DWITHOUT_LIBWRAP=1
4172 - -DENABLED_LOCAL_INFILE=1
4173 - -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock"
4174 - -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock"
4175 - -DWITH_DEFAULT_COMPILER_OPTIONS=0
4176 - -DWITH_DEFAULT_FEATURE_SET=0
4177 - -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)"
4178 - # The build forces this to be defined when cross-compiling. We pass it
4179 - # all the time for simplicity and to make sure it is actually correct.
4180 - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
4181 - -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)"
4182 - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
4183 - -DAUTH_GSSAPI_PLUGIN_TYPE=$(usex kerberos DYNAMIC OFF)
4184 - -DCONC_WITH_EXTERNAL_ZLIB=YES
4185 - -DWITH_EXTERNAL_ZLIB=YES
4186 - -DSUFFIX_INSTALL_DIR=""
4187 - -DWITH_UNITTEST=OFF
4188 - -DWITHOUT_CLIENTLIBS=YES
4189 - -DCLIENT_PLUGIN_DIALOG=OFF
4190 - -DCLIENT_PLUGIN_AUTH_GSSAPI_CLIENT=OFF
4191 - -DCLIENT_PLUGIN_CLIENT_ED25519=OFF
4192 - -DCLIENT_PLUGIN_MYSQL_CLEAR_PASSWORD=STATIC
4193 - -DCLIENT_PLUGIN_CACHING_SHA2_PASSWORD=OFF
4194 - )
4195 - if use test ; then
4196 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test )
4197 - else
4198 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
4199 - fi
4200 -
4201 - if ! use yassl ; then
4202 - mycmakeargs+=( -DWITH_SSL=system -DCLIENT_PLUGIN_SHA256_PASSWORD=STATIC )
4203 - else
4204 - mycmakeargs+=( -DWITH_SSL=bundled )
4205 - fi
4206 -
4207 - # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION
4208 - mycmakeargs+=(
4209 - -DWITH_READLINE=$(usex bindist 1 0)
4210 - -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1)
4211 - -DENABLE_DTRACE=$(usex systemtap)
4212 - )
4213 -
4214 - if use server ; then
4215 -
4216 - # Federated{,X} must be treated special otherwise they will not be built as plugins
4217 - if ! use extraengine ; then
4218 - mycmakeargs+=(
4219 - -DPLUGIN_FEDERATED=NO
4220 - -DPLUGIN_FEDERATEDX=NO )
4221 - fi
4222 -
4223 - mycmakeargs+=(
4224 - -DWITH_PCRE=system
4225 - -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO)
4226 - -DPLUGIN_SPHINX=$(usex sphinx YES NO)
4227 - -DPLUGIN_TOKUDB=$(usex tokudb YES NO)
4228 - -DPLUGIN_AUTH_PAM=$(usex pam YES NO)
4229 - -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO)
4230 - -DPLUGIN_CASSANDRA=NO
4231 - -DPLUGIN_SEQUENCE=$(usex extraengine YES NO)
4232 - -DPLUGIN_SPIDER=$(usex extraengine YES NO)
4233 - -DPLUGIN_CONNECT=$(usex extraengine YES NO)
4234 - -DCONNECT_WITH_MYSQL=1
4235 - -DCONNECT_WITH_LIBXML2=$(usex xml)
4236 - -DCONNECT_WITH_ODBC=$(usex odbc)
4237 - -DCONNECT_WITH_JDBC=$(usex jdbc)
4238 - # Build failure and autodep wrt bug 639144
4239 - -DCONNECT_WITH_MONGO=OFF
4240 - -DWITH_WSREP=$(usex galera)
4241 - -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF)
4242 - -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF)
4243 - -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF)
4244 - -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO)
4245 - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
4246 - -DWITH_MARIABACKUP=$(usex backup ON OFF)
4247 - -DWITH_LIBARCHIVE=$(usex backup ON OFF)
4248 - -DINSTALL_SQLBENCHDIR=""
4249 - -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO)
4250 - # systemd is only linked to for server notification
4251 - -DWITH_SYSTEMD=$(usex systemd yes no)
4252 - -DWITH_NUMA=$(usex numa ON OFF)
4253 - )
4254 -
4255 - # Workaround for MDEV-14524
4256 - use tokudb && mycmakeargs+=( -DTOKUDB_OK=1 )
4257 -
4258 - if use test ; then
4259 - # This is needed for the new client lib which tests a real, open server
4260 - mycmakeargs+=( -DSKIP_TESTS=ON )
4261 - fi
4262 -
4263 - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
4264 - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
4265 - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
4266 - ewarn "You MUST file bugs without these variables set."
4267 -
4268 - mycmakeargs+=(
4269 - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
4270 - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
4271 - )
4272 -
4273 - elif ! use latin1 ; then
4274 - mycmakeargs+=(
4275 - -DDEFAULT_CHARSET=utf8
4276 - -DDEFAULT_COLLATION=utf8_general_ci
4277 - )
4278 - else
4279 - mycmakeargs+=(
4280 - -DDEFAULT_CHARSET=latin1
4281 - -DDEFAULT_COLLATION=latin1_swedish_ci
4282 - )
4283 - fi
4284 - mycmakeargs+=(
4285 - -DEXTRA_CHARSETS=all
4286 - -DMYSQL_USER=mysql
4287 - -DDISABLE_SHARED=$(usex static YES NO)
4288 - -DWITH_DEBUG=$(usex debug)
4289 - -DWITH_EMBEDDED_SERVER=OFF
4290 - -DWITH_PROFILING=$(usex profiling)
4291 - )
4292 -
4293 - if use static; then
4294 - mycmakeargs+=( -DWITH_PIC=1 )
4295 - fi
4296 -
4297 - if use jemalloc || use tcmalloc ; then
4298 - mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
4299 - fi
4300 -
4301 - # Storage engines
4302 - mycmakeargs+=(
4303 - -DWITH_ARCHIVE_STORAGE_ENGINE=1
4304 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1
4305 - -DWITH_CSV_STORAGE_ENGINE=1
4306 - -DWITH_HEAP_STORAGE_ENGINE=1
4307 - -DWITH_INNOBASE_STORAGE_ENGINE=1
4308 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1
4309 - -DWITH_MYISAM_STORAGE_ENGINE=1
4310 - -DWITH_PARTITION_STORAGE_ENGINE=1
4311 - )
4312 -
4313 - else
4314 - mycmakeargs+=(
4315 - -DWITHOUT_SERVER=1
4316 - -DWITH_EMBEDDED_SERVER=OFF
4317 - -DEXTRA_CHARSETS=none
4318 - -DINSTALL_SQLBENCHDIR=
4319 - -DWITH_SYSTEMD=no
4320 - )
4321 - fi
4322 -
4323 - cmake_src_configure
4324 -}
4325 -
4326 -src_compile() {
4327 - cmake_src_compile
4328 -}
4329 -
4330 -# Official test instructions:
4331 -# USE='extraengine perl server' \
4332 -# FEATURES='test userpriv' \
4333 -# ebuild mariadb-X.X.XX.ebuild \
4334 -# digest clean package
4335 -src_test() {
4336 - _disable_test() {
4337 - local rawtestname bug reason
4338 - rawtestname="${1}" ; shift
4339 - bug="${1}" ; shift
4340 - reason="${@}"
4341 - ewarn "test '${rawtestname}' disabled: '${reason}' (BUG#${bug})"
4342 - echo "${rawtestname} : BUG#${bug} ${reason}" >> "${T}/disabled.def"
4343 - }
4344 -
4345 - local TESTDIR="${BUILD_DIR}/mysql-test"
4346 - local retstatus_unit
4347 - local retstatus_tests
4348 -
4349 - if ! use server ; then
4350 - einfo "Skipping server tests due to minimal build."
4351 - return 0
4352 - fi
4353 -
4354 - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
4355 -
4356 - # Run CTest (test-units)
4357 - cmake_src_test
4358 - retstatus_unit=$?
4359 -
4360 - # Ensure that parallel runs don't die
4361 - export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
4362 -
4363 - if [[ -z "${MTR_PARALLEL}" ]] ; then
4364 - local -x MTR_PARALLEL=$(makeopts_jobs)
4365 -
4366 - if [[ ${MTR_PARALLEL} -gt 4 ]] ; then
4367 - # Running multiple tests in parallel usually require higher ulimit
4368 - # and fs.aio-max-nr setting. In addition, tests like main.multi_update
4369 - # are known to hit timeout when system is busy.
4370 - # To avoid test failure we will limit MTR_PARALLEL to 4 instead of
4371 - # using "auto".
4372 - local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})"
4373 - info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!"
4374 - einfo "${info_msg}"
4375 - unset info_msg
4376 - MTR_PARALLEL=4
4377 - fi
4378 - else
4379 - einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'"
4380 - fi
4381 -
4382 - # Try to increase file limits to increase test coverage
4383 - if ! ulimit -n 16500 1>/dev/null 2>&1 ; then
4384 - # Upper limit comes from parts.partition_* tests
4385 - ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager."
4386 -
4387 - if ! ulimit -n 4162 1>/dev/null 2>&1 ; then
4388 - # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)'
4389 - ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager."
4390 -
4391 - if ! ulimit -n 3000 1>/dev/null 2>&1 ; then
4392 - ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager."
4393 - else
4394 - einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)."
4395 - fi
4396 - else
4397 - einfo "Will run test suite with open file limit set to 4162 (medium test coverage)."
4398 - fi
4399 - else
4400 - einfo "Will run test suite with open file limit set to 16500 (best test coverage)."
4401 - fi
4402 -
4403 - # create directories because mysqladmin might run out of order
4404 - mkdir -p "${T}"/var-tests{,/log} || die
4405 -
4406 - cp "${S}"/mysql-test/unstable-tests "${T}/disabled.def" || die
4407 -
4408 - local -a disabled_tests
4409 - disabled_tests+=( "compat/oracle.plugin;0;Needs example plugin which Gentoo disables" )
4410 - disabled_tests+=( "main.explain_non_select;0;Sporadically failing test" )
4411 - disabled_tests+=( "main.func_time;0;Dependent on time test was written" )
4412 - disabled_tests+=( "main.grant;0;Sporadically failing test" )
4413 - disabled_tests+=( "main.plugin_auth;0;Needs client libraries built" )
4414 - disabled_tests+=( "main.stat_tables;0;Sporadically failing test" )
4415 - disabled_tests+=( "main.stat_tables_innodb;0;Sporadically failing test" )
4416 - disabled_tests+=( "mariabackup.*;0;Broken test suite" )
4417 - disabled_tests+=( "plugins.auth_ed25519;0;Needs client libraries built" )
4418 - disabled_tests+=( "plugins.cracklib_password_check;0;False positive due to varying policies" )
4419 - disabled_tests+=( "plugins.two_password_validations;0;False positive due to varying policies" )
4420 - disabled_tests+=( "roles.acl_statistics;0;False positive due to a user count mismatch caused by previous test" )
4421 -
4422 - if ! use latin1 ; then
4423 - disabled_tests+=( "funcs_1.is_columns_mysql;0;Requires USE=latin1" )
4424 - disabled_tests+=( "main.information_schema;0;Requires USE=latin1" )
4425 - disabled_tests+=( "main.system_mysql_db;0;Requires USE=latin1" )
4426 - fi
4427 -
4428 - local test_infos_str test_infos_arr
4429 - for test_infos_str in "${disabled_tests[@]}" ; do
4430 - IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}"
4431 -
4432 - if [[ ${#test_infos_arr[@]} != 3 ]] ; then
4433 - die "Invalid test data set, not matching format: ${test_infos_str}"
4434 - fi
4435 -
4436 - _disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}"
4437 - done
4438 - unset test_infos_str test_infos_arr
4439 -
4440 - # run mysql-test tests
4441 - pushd "${TESTDIR}" &>/dev/null || die
4442 - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def"
4443 - retstatus_tests=$?
4444 -
4445 - popd &>/dev/null || die
4446 -
4447 - # Cleanup is important for these testcases.
4448 - pkill -9 -f "${S}/ndb" 2>/dev/null
4449 - pkill -9 -f "${S}/sql" 2>/dev/null
4450 -
4451 - local failures=""
4452 - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
4453 - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
4454 -
4455 - [[ -z "$failures" ]] || die "Test failures: $failures"
4456 - einfo "Tests successfully completed"
4457 -}
4458 -
4459 -src_install() {
4460 - cmake_src_install
4461 -
4462 - # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used
4463 - if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then
4464 - rm "${ED}/usr/include/mysql/server/private/config.h" || die
4465 - fi
4466 -
4467 - # Make sure the vars are correctly initialized
4468 - mysql_init_vars
4469 -
4470 - # Convenience links
4471 - einfo "Making Convenience links for mysqlcheck multi-call binary"
4472 - dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
4473 - dosym "mysqlcheck" "/usr/bin/mysqlrepair"
4474 - dosym "mysqlcheck" "/usr/bin/mysqloptimize"
4475 -
4476 - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
4477 - if [[ -d "${ED}/usr/data" ]] ; then
4478 - rm -Rf "${ED}/usr/data" || die
4479 - fi
4480 -
4481 - # Unless they explicitly specific USE=test, then do not install the
4482 - # testsuite. It DOES have a use to be installed, esp. when you want to do a
4483 - # validation of your database configuration after tuning it.
4484 - if ! use test ; then
4485 - rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
4486 - fi
4487 -
4488 - # Configuration stuff
4489 - einfo "Building default configuration ..."
4490 - insinto "${MY_SYSCONFDIR#${EPREFIX}}"
4491 - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
4492 - cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die
4493 - eprefixify "${TMPDIR}/my.cnf"
4494 - doins "${TMPDIR}/my.cnf"
4495 - insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d"
4496 - cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
4497 - eprefixify "${TMPDIR}/50-distro-client.cnf"
4498 - doins "${TMPDIR}/50-distro-client.cnf"
4499 -
4500 - if use server ; then
4501 - mycnf_src="my.cnf.distro-server"
4502 - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
4503 - "${FILESDIR}/${mycnf_src}" \
4504 - > "${TMPDIR}/my.cnf.ok" || die
4505 - if use prefix ; then
4506 - sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
4507 - "${TMPDIR}/my.cnf.ok" || die
4508 - fi
4509 - if use latin1 ; then
4510 - sed -i \
4511 - -e "/character-set/s|utf8|latin1|g" \
4512 - "${TMPDIR}/my.cnf.ok" || die
4513 - fi
4514 - eprefixify "${TMPDIR}/my.cnf.ok"
4515 - newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
4516 -
4517 - einfo "Including support files and sample configurations"
4518 - docinto "support-files"
4519 - local script
4520 - for script in \
4521 - "${S}"/support-files/magic
4522 - do
4523 - [[ -f "$script" ]] && dodoc "${script}"
4524 - done
4525 -
4526 - docinto "scripts"
4527 - for script in "${S}"/scripts/mysql* ; do
4528 - [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
4529 - done
4530 - # Manually install supporting files that conflict with other packages
4531 - # but are needed for galera and initial installation
4532 - exeinto /usr/libexec/mariadb
4533 - doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror"
4534 - fi
4535 -
4536 - # Remove mytop if perl is not selected
4537 - if [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl ; then
4538 - rm -f "${ED}/usr/bin/mytop" || die
4539 - fi
4540 -
4541 - # Fix a dangling symlink when galera is not built
4542 - if [[ -L "${ED}/usr/bin/wsrep_sst_rsync_wan" ]] && ! use galera ; then
4543 - rm "${ED}/usr/bin/wsrep_sst_rsync_wan" || die
4544 - fi
4545 -
4546 - # Remove broken SST scripts that are incompatible
4547 - local scriptremove
4548 - for scriptremove in wsrep_sst_xtrabackup wsrep_sst_xtrabackup-v2 ; do
4549 - if [[ -e "${ED}/usr/bin/${scriptremove}" ]] ; then
4550 - rm "${ED}/usr/bin/${scriptremove}" || die
4551 - fi
4552 - done
4553 -}
4554 -
4555 -pkg_preinst() {
4556 - java-pkg-opt-2_pkg_preinst
4557 -
4558 - # Here we need to see if the implementation switched client libraries
4559 - # We check if this is a new instance of the package and a client library already exists
4560 - local SHOW_ABI_MESSAGE libpath
4561 - if [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}/usr/$(get_libdir)/libmysqlclient.so" ]] ; then
4562 - libpath=$(readlink "${EROOT}/usr/$(get_libdir)/libmysqlclient.so")
4563 - elog "Due to ABI changes when switching between different client libraries,"
4564 - elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient."
4565 - elog "Please run: revdep-rebuild --library ${libpath}"
4566 - ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries"
4567 - fi
4568 -}
4569 -
4570 -pkg_postinst() {
4571 - # Make sure the vars are correctly initialized
4572 - mysql_init_vars
4573 -
4574 - # Create log directory securely if it does not exist
4575 - [[ -d "${ROOT}/${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}/${MY_LOGDIR}"
4576 -
4577 - if use server ; then
4578 - if use pam; then
4579 - einfo
4580 - elog "This install includes the PAM authentication plugin."
4581 - elog "To activate and configure the PAM plugin, please read:"
4582 - elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/"
4583 - einfo
4584 - fi
4585 -
4586 - if [[ -z "${REPLACING_VERSIONS}" ]] ; then
4587 - einfo
4588 - elog "You might want to run:"
4589 - elog "\"emerge --config =${CATEGORY}/${PF}\""
4590 - elog "if this is a new install."
4591 - elog
4592 - elog "If you are switching server implentations, you should run the"
4593 - elog "mysql_upgrade tool."
4594 - einfo
4595 - else
4596 - einfo
4597 - elog "If you are upgrading major versions, you should run the"
4598 - elog "mysql_upgrade tool."
4599 - einfo
4600 - fi
4601 -
4602 - if use galera ; then
4603 - einfo
4604 - elog "Be sure to edit the my.cnf file to activate your cluster settings."
4605 - elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
4606 - elog "The first time the cluster is activated, you should add"
4607 - elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
4608 - elog "This option should then be removed for subsequent starts."
4609 - einfo
4610 - fi
4611 - fi
4612 -
4613 - # Note about configuration change
4614 - einfo
4615 - elog "This version of mariadb reorganizes the configuration from a single my.cnf"
4616 - elog "to several files in /etc/mysql/${PN}.d."
4617 - elog "Please backup any changes you made to /etc/mysql/my.cnf"
4618 - elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension."
4619 - elog "You may have as many files as needed and they are read alphabetically."
4620 - elog "Be sure the options have the appropriate section headers, i.e. [mysqld]."
4621 - einfo
4622 -}
4623 -
4624 -pkg_config() {
4625 - _getoptval() {
4626 - local mypd="${EROOT}"/usr/libexec/mariadb/my_print_defaults
4627 - local section="$1"
4628 - local flag="--${2}="
4629 - local extra_options="${3}"
4630 - "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp"
4631 - }
4632 - local old_MY_DATADIR="${MY_DATADIR}"
4633 - local old_HOME="${HOME}"
4634 - # my_print_defaults needs to read stuff in $HOME/.my.cnf
4635 - export HOME=${EPREFIX}/root
4636 -
4637 - # Make sure the vars are correctly initialized
4638 - mysql_init_vars
4639 -
4640 - [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
4641 - if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then
4642 - die "Minimal builds do NOT include the MySQL server"
4643 - fi
4644 -
4645 - if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then
4646 - local MY_DATADIR_s="${ROOT}/${MY_DATADIR}"
4647 - MY_DATADIR_s="${MY_DATADIR_s%%/}"
4648 - local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}"
4649 - old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
4650 -
4651 - if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then
4652 - if [[ -d "${MY_DATADIR_s}" ]]; then
4653 - ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
4654 - ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
4655 - else
4656 - elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
4657 - mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
4658 - || die "Moving MY_DATADIR failed"
4659 - fi
4660 - else
4661 - ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
4662 - if [[ -d "${MY_DATADIR_s}" ]]; then
4663 - ewarn "Attempting to use ${MY_DATADIR_s}"
4664 - else
4665 - eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
4666 - die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
4667 - fi
4668 - fi
4669 - fi
4670 -
4671 - local pwd1="a"
4672 - local pwd2="b"
4673 - local maxtry=15
4674 -
4675 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
4676 - local tmp_mysqld_password_source=
4677 -
4678 - for tmp_mysqld_password_source in mysql client; do
4679 - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
4680 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
4681 - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then
4682 - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then
4683 - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
4684 - MYSQL_ROOT_PASSWORD=
4685 - continue
4686 - fi
4687 -
4688 - einfo "Found password in '${tmp_mysqld_password_source}' section!"
4689 - break
4690 - fi
4691 - done
4692 -
4693 - # Sometimes --show is required to display passwords in some implementations of my_print_defaults
4694 - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then
4695 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
4696 - fi
4697 -
4698 - unset tmp_mysqld_password_source
4699 - fi
4700 - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir | tail -n1)"
4701 - # These are dir+prefix
4702 - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log | tail -n1)"
4703 - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
4704 - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin | tail -n1)"
4705 - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
4706 -
4707 - if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then
4708 - einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
4709 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR"
4710 - fi
4711 - if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then
4712 - einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
4713 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN"
4714 - fi
4715 - if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then
4716 - einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
4717 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG"
4718 - fi
4719 -
4720 - if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then
4721 - ewarn "You have already a MySQL database in place."
4722 - ewarn "(${ROOT}/${MY_DATADIR}/*)"
4723 - ewarn "Please rename or delete it if you wish to replace it."
4724 - die "MySQL database already exists!"
4725 - fi
4726 -
4727 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
4728 - # localhost. Also causes weird failures.
4729 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
4730 -
4731 - if [[ -z "${MYSQL_ROOT_PASSWORD}" ]]; then
4732 -
4733 - einfo "Please provide a password for the mysql 'root'@'localhost' user now"
4734 - einfo "or through the ${HOME}/.my.cnf file."
4735 - ewarn "Avoid [\"'\\_%] characters in the password"
4736 - read -rsp " >" pwd1 ; echo
4737 -
4738 - einfo "Retype the password"
4739 - read -rsp " >" pwd2 ; echo
4740 -
4741 - if [[ "x$pwd1" != "x$pwd2" ]] ; then
4742 - die "Passwords are not the same"
4743 - fi
4744 -
4745 - MYSQL_ROOT_PASSWORD="${pwd1}"
4746 - unset pwd1 pwd2
4747 - fi
4748 -
4749 - local options
4750 - local sqltmp="$(emktemp)"
4751 -
4752 - # Fix bug 446200. Don't reference host my.cnf, needs to come first,
4753 - # see https://bugs.mysql.com/bug.php?id=31312
4754 - use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
4755 -
4756 - # Figure out which options we need to disable to do the setup
4757 - local helpfile="${TMPDIR}/mysqld-help"
4758 - "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
4759 - for opt in grant-tables host-cache name-resolve networking slave-start \
4760 - federated ssl log-bin relay-log slow-query-log external-locking \
4761 - log-slave-updates \
4762 - ; do
4763 - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
4764 - egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
4765 - done
4766 -
4767 - einfo "Creating the mysql database and setting proper permissions on it ..."
4768 -
4769 - # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
4770 - PID_DIR="${EROOT}/var/run/mysqld"
4771 - if [[ ! -d "${PID_DIR}" ]]; then
4772 - install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
4773 - fi
4774 -
4775 - if [[ ! -d "${MY_DATADIR}" ]]; then
4776 - install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory"
4777 - fi
4778 -
4779 - pushd "${TMPDIR}" &>/dev/null || die
4780 -
4781 - # Filling timezones, see
4782 - # https://dev.mysql.com/doc/mysql/en/time-zone-support.html
4783 - "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null
4784 -
4785 - local cmd=( "${EROOT}/usr/share/mariadb/scripts/mysql_install_db" )
4786 - [[ -f "${cmd}" ]] || cmd=( "${EROOT}/usr/bin/mysql_install_db" )
4787 - cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" )
4788 - einfo "Command: ${cmd[*]}"
4789 - su -s /bin/sh -c "${cmd[*]}" mysql \
4790 - >"${TMPDIR}"/mysql_install_db.log 2>&1
4791 - if [[ $? -ne 0 ]]; then
4792 - grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2
4793 - die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log"
4794 - fi
4795 - popd &>/dev/null || die
4796 - [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \
4797 - || die "MySQL databases not installed"
4798 -
4799 - use prefix || options="${options} --user=mysql"
4800 -
4801 - local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock"
4802 - local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid"
4803 - local mysqld="${EROOT}/usr/sbin/mysqld \
4804 - ${options} \
4805 - --log-warnings=0 \
4806 - --basedir=${EROOT}/usr \
4807 - --datadir=${ROOT}/${MY_DATADIR} \
4808 - --max_allowed_packet=8M \
4809 - --net_buffer_length=16K \
4810 - --socket=${socket} \
4811 - --pid-file=${pidfile} \
4812 - --tmpdir=${ROOT}/${MYSQL_TMPDIR}"
4813 - #einfo "About to start mysqld: ${mysqld}"
4814 - ebegin "Starting mysqld"
4815 - einfo "Command ${mysqld}"
4816 - ${mysqld} &
4817 - rc=$?
4818 - while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
4819 - maxtry=$((${maxtry}-1))
4820 - echo -n "."
4821 - sleep 1
4822 - done
4823 - eend $rc
4824 -
4825 - if ! [[ -S "${socket}" ]]; then
4826 - die "Completely failed to start up mysqld with: ${mysqld}"
4827 - fi
4828 -
4829 - ebegin "Setting root password"
4830 - # Do this from memory, as we don't want clear text passwords in temp files
4831 - local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES"
4832 - "${EROOT}/usr/bin/mysql" \
4833 - "--socket=${socket}" \
4834 - -hlocalhost \
4835 - -e "${sql}"
4836 - eend $?
4837 -
4838 - if [[ -n "${sqltmp}" ]] ; then
4839 - ebegin "Loading \"zoneinfo\", this step may require a few seconds"
4840 - "${EROOT}/usr/bin/mysql" \
4841 - "--socket=${socket}" \
4842 - -hlocalhost \
4843 - -uroot \
4844 - --password="${MYSQL_ROOT_PASSWORD}" \
4845 - mysql < "${sqltmp}"
4846 - rc=$?
4847 - eend $?
4848 - [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!"
4849 - fi
4850 -
4851 - # Stop the server and cleanup
4852 - einfo "Stopping the server ..."
4853 - kill $(< "${pidfile}" )
4854 - rm -f "${sqltmp}"
4855 - wait %1
4856 - einfo "Done"
4857 -}
4858
4859 diff --git a/dev-db/mariadb/mariadb-10.4.14.ebuild b/dev-db/mariadb/mariadb-10.4.14.ebuild
4860 deleted file mode 100644
4861 index 2f7ec2673f4..00000000000
4862 --- a/dev-db/mariadb/mariadb-10.4.14.ebuild
4863 +++ /dev/null
4864 @@ -1,1038 +0,0 @@
4865 -# Copyright 1999-2020 Gentoo Authors
4866 -# Distributed under the terms of the GNU General Public License v2
4867 -
4868 -EAPI="7"
4869 -SUBSLOT="18"
4870 -
4871 -JAVA_PKG_OPT_USE="jdbc"
4872 -
4873 -inherit eutils systemd flag-o-matic prefix toolchain-funcs \
4874 - multiprocessing java-pkg-opt-2 cmake
4875 -
4876 -# Patch version
4877 -PATCH_SET="https://dev.gentoo.org/~whissi/dist/${PN}/${PN}-10.4.14-patches-01.tar.xz"
4878 -
4879 -SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz
4880 - ${PATCH_SET}"
4881 -
4882 -HOMEPAGE="https://mariadb.org/"
4883 -DESCRIPTION="An enhanced, drop-in replacement for MySQL"
4884 -LICENSE="GPL-2 LGPL-2.1+"
4885 -SLOT="10.4/${SUBSLOT:-0}"
4886 -IUSE="+backup bindist cracklib debug extraengine galera innodb-lz4
4887 - innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 libressl mroonga
4888 - numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx
4889 - sst-rsync sst-mariabackup static systemd systemtap tcmalloc
4890 - test tokudb xml yassl"
4891 -
4892 -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
4893 -RESTRICT="!bindist? ( bindist ) libressl? ( test ) !test? ( test )"
4894 -
4895 -REQUIRED_USE="jdbc? ( extraengine server !static )
4896 - server? ( tokudb? ( jemalloc !tcmalloc ) )
4897 - ?? ( tcmalloc jemalloc )
4898 - static? ( yassl !pam )"
4899 -
4900 -KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
4901 -
4902 -# Shorten the path because the socket path length must be shorter than 107 chars
4903 -# and we will run a mysql server during test phase
4904 -S="${WORKDIR}/mysql"
4905 -
4906 -# Be warned, *DEPEND are version-dependant
4907 -# These are used for both runtime and compiletime
4908 -COMMON_DEPEND="
4909 - kernel_linux? (
4910 - sys-process/procps:0=
4911 - dev-libs/libaio:0=
4912 - )
4913 - >=sys-apps/sed-4
4914 - >=sys-apps/texinfo-4.7-r1
4915 - jemalloc? ( dev-libs/jemalloc:0= )
4916 - tcmalloc? ( dev-util/google-perftools:0= )
4917 - systemtap? ( >=dev-util/systemtap-1.3:0= )
4918 - >=sys-libs/zlib-1.2.3:0=
4919 - kerberos? ( virtual/krb5 )
4920 - yassl? ( net-libs/gnutls:0= )
4921 - !yassl? (
4922 - !libressl? ( >=dev-libs/openssl-1.0.0:0= )
4923 - libressl? ( dev-libs/libressl:0= )
4924 - )
4925 - sys-libs/ncurses:0=
4926 - !bindist? (
4927 - sys-libs/binutils-libs:0=
4928 - >=sys-libs/readline-4.1:0=
4929 - )
4930 - server? (
4931 - backup? ( app-arch/libarchive:0= )
4932 - cracklib? ( sys-libs/cracklib:0= )
4933 - extraengine? (
4934 - odbc? ( dev-db/unixODBC:0= )
4935 - xml? ( dev-libs/libxml2:2= )
4936 - )
4937 - innodb-lz4? ( app-arch/lz4 )
4938 - innodb-lzo? ( dev-libs/lzo )
4939 - innodb-snappy? ( app-arch/snappy )
4940 - mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 )
4941 - numa? ( sys-process/numactl )
4942 - oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= )
4943 - pam? ( sys-libs/pam:0= )
4944 - systemd? ( sys-apps/systemd:= )
4945 - tokudb? ( app-arch/snappy )
4946 - )
4947 - >=dev-libs/libpcre-8.41-r1:3=
4948 -"
4949 -BDEPEND="virtual/yacc
4950 - || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
4951 -"
4952 -DEPEND="static? ( sys-libs/ncurses[static-libs] )
4953 - server? (
4954 - extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) )
4955 - test? ( acct-group/mysql acct-user/mysql )
4956 - )
4957 - ${COMMON_DEPEND}"
4958 -RDEPEND="selinux? ( sec-policy/selinux-mysql )
4959 - !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
4960 - !dev-db/mariadb:0
4961 - !dev-db/mariadb:5.5
4962 - !dev-db/mariadb:10.1
4963 - !dev-db/mariadb:10.2
4964 - !dev-db/mariadb:10.3
4965 - !dev-db/mariadb:10.5
4966 - !<virtual/mysql-5.6-r11
4967 - !<virtual/libmysqlclient-18-r1
4968 - ${COMMON_DEPEND}
4969 - server? (
4970 - galera? (
4971 - sys-apps/iproute2
4972 - =sys-cluster/galera-26*
4973 - sst-rsync? ( sys-process/lsof )
4974 - sst-mariabackup? ( net-misc/socat[ssl] )
4975 - )
4976 - !prefix? ( dev-db/mysql-init-scripts acct-group/mysql acct-user/mysql )
4977 - extraengine? ( jdbc? ( >=virtual/jre-1.6 ) )
4978 - )
4979 - perl? (
4980 - !dev-db/mytop
4981 - virtual/perl-Getopt-Long
4982 - dev-perl/TermReadKey
4983 - virtual/perl-Term-ANSIColor
4984 - virtual/perl-Time-HiRes
4985 - )
4986 -"
4987 -# For other stuff to bring us in
4988 -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
4989 -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
4990 -
4991 -mysql_init_vars() {
4992 - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"}
4993 - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
4994 - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
4995 - MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
4996 -
4997 - if [[ -z "${MY_DATADIR}" ]] ; then
4998 - MY_DATADIR=""
4999 - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
5000 - MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \
5001 - | sed -ne '/datadir/s|^--datadir=||p' \
5002 - | tail -n1)
5003 - if [[ -z "${MY_DATADIR}" ]] ; then
5004 - MY_DATADIR=$(grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
5005 - | sed -e 's/.*=\s*//' \
5006 - | tail -n1)
5007 - fi
5008 - fi
5009 - if [[ -z "${MY_DATADIR}" ]] ; then
5010 - MY_DATADIR="${MY_LOCALSTATEDIR}"
5011 - einfo "Using default MY_DATADIR"
5012 - fi
5013 - elog "MySQL MY_DATADIR is ${MY_DATADIR}"
5014 -
5015 - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
5016 - if [[ -e "${MY_DATADIR}" ]] ; then
5017 - # If you get this and you're wondering about it, see bug #207636
5018 - elog "MySQL datadir found in ${MY_DATADIR}"
5019 - elog "A new one will not be created."
5020 - PREVIOUS_DATADIR="yes"
5021 - else
5022 - PREVIOUS_DATADIR="no"
5023 - fi
5024 - export PREVIOUS_DATADIR
5025 - fi
5026 - else
5027 - if [[ ${EBUILD_PHASE} == "config" ]]; then
5028 - local new_MY_DATADIR
5029 - new_MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \
5030 - | sed -ne '/datadir/s|^--datadir=||p' \
5031 - | tail -n1)
5032 -
5033 - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
5034 - ewarn "MySQL MY_DATADIR has changed"
5035 - ewarn "from ${MY_DATADIR}"
5036 - ewarn "to ${new_MY_DATADIR}"
5037 - MY_DATADIR="${new_MY_DATADIR}"
5038 - fi
5039 - fi
5040 - fi
5041 -
5042 - export MY_SHAREDSTATEDIR MY_SYSCONFDIR
5043 - export MY_LOCALSTATEDIR MY_LOGDIR
5044 - export MY_DATADIR
5045 -}
5046 -
5047 -pkg_setup() {
5048 - if [[ ${MERGE_TYPE} != binary ]] ; then
5049 - local GCC_MAJOR_SET=$(gcc-major-version)
5050 - local GCC_MINOR_SET=$(gcc-minor-version)
5051 -
5052 - if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \
5053 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
5054 - eerror "${PN} with tokudb needs to be built with gcc-4.7 or later."
5055 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
5056 - die
5057 - fi
5058 -
5059 - # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
5060 - # non x86{,_64} arches
5061 - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
5062 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
5063 - eerror "${PN} needs to be built with gcc-4.7 or later."
5064 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
5065 - die
5066 - fi
5067 -
5068 - if has test ${FEATURES} ; then
5069 - # Bug #213475 - MySQL _will_ object strenuously if your machine is named
5070 - # localhost. Also causes weird failures.
5071 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
5072 -
5073 - if ! has userpriv ${FEATURES} ; then
5074 - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
5075 - fi
5076 - fi
5077 - fi
5078 -
5079 - java-pkg-opt-2_pkg_setup
5080 -}
5081 -
5082 -src_unpack() {
5083 - unpack ${A}
5084 -
5085 - mv -f "${WORKDIR}/${P/_rc/}" "${S}" || die
5086 -}
5087 -
5088 -src_prepare() {
5089 - eapply "${WORKDIR}"/mariadb-patches
5090 -
5091 - eapply_user
5092 -
5093 - _disable_plugin() {
5094 - echo > "${S}/plugin/${1}/CMakeLists.txt" || die
5095 - }
5096 - _disable_engine() {
5097 - echo > "${S}/storage/${1}/CMakeLists.txt" || die
5098 - }
5099 -
5100 - if use jemalloc; then
5101 - echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt"
5102 - elif use tcmalloc; then
5103 - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt"
5104 - fi
5105 -
5106 - # Don't build bundled xz-utils for tokudb
5107 - echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die
5108 - sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die
5109 - sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die
5110 -
5111 - local plugin
5112 - local server_plugins=( handler_socket auth_socket feedback metadata_lock_info
5113 - locale_info qc_info server_audit sql_errlog auth_ed25519 )
5114 - local test_plugins=( audit_null auth_examples daemon_example fulltext
5115 - debug_key_management example_key_management versioning )
5116 - if ! use server; then # These plugins are for the server
5117 - for plugin in "${server_plugins[@]}" ; do
5118 - _disable_plugin "${plugin}"
5119 - done
5120 - fi
5121 -
5122 - if ! use test; then # These plugins are only used during testing
5123 - for plugin in "${test_plugins[@]}" ; do
5124 - _disable_plugin "${plugin}"
5125 - done
5126 - _disable_engine test_sql_discovery
5127 - echo > "${S}/plugin/auth_pam/testing/CMakeLists.txt" || die
5128 - fi
5129 -
5130 - _disable_engine example
5131 -
5132 - if ! use oqgraph ; then # avoids extra library checks
5133 - _disable_engine oqgraph
5134 - fi
5135 -
5136 - if use mroonga ; then
5137 - # Remove the bundled groonga
5138 - # There is no CMake flag, it simply checks for existance
5139 - rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga"
5140 - else
5141 - _disable_engine mroonga
5142 - fi
5143 -
5144 - # Fix static bindings in galera replication
5145 - sed -i -e 's~add_library(wsrep_api_v26$~add_library(wsrep_api_v26 STATIC~' \
5146 - "${S}"/wsrep-lib/wsrep-API/CMakeLists.txt || die
5147 - sed -i -e 's~add_library(wsrep-lib$~add_library(wsrep-lib STATIC~' \
5148 - "${S}"/wsrep-lib/src/CMakeLists.txt || die
5149 -
5150 - # Fix galera_recovery.sh script
5151 - sed -i -e "s~@bindir@/my_print_defaults~${EPREFIX}/usr/libexec/mariadb/my_print_defaults~" \
5152 - scripts/galera_recovery.sh || die
5153 -
5154 - sed -i -e 's~ \$basedir/lib/\*/mariadb19/plugin~~' \
5155 - "${S}"/scripts/mysql_install_db.sh || die
5156 -
5157 - cmake_src_prepare
5158 - java-pkg-opt-2_src_prepare
5159 -}
5160 -
5161 -src_configure() {
5162 - # bug 508724 mariadb cannot use ld.gold
5163 - tc-ld-disable-gold
5164 - # Bug #114895, bug #110149
5165 - filter-flags "-O" "-O[01]"
5166 -
5167 - # It fails on alpha without this
5168 - use alpha && append-ldflags "-Wl,--no-relax"
5169 -
5170 - append-cxxflags -felide-constructors
5171 -
5172 - # bug #283926, with GCC4.4, this is required to get correct behavior.
5173 - append-flags -fno-strict-aliasing
5174 -
5175 - CMAKE_BUILD_TYPE="RelWithDebInfo"
5176 -
5177 - # debug hack wrt #497532
5178 - mycmakeargs=(
5179 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
5180 - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
5181 - -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql"
5182 - -DSYSCONFDIR="${EPREFIX}/etc/mysql"
5183 - -DINSTALL_BINDIR=bin
5184 - -DINSTALL_DOCDIR=share/doc/${PF}
5185 - -DINSTALL_DOCREADMEDIR=share/doc/${PF}
5186 - -DINSTALL_INCLUDEDIR=include/mysql
5187 - -DINSTALL_INFODIR=share/info
5188 - -DINSTALL_LIBDIR=$(get_libdir)
5189 - -DINSTALL_MANDIR=share/man
5190 - -DINSTALL_MYSQLSHAREDIR=share/mariadb
5191 - -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin
5192 - -DINSTALL_SCRIPTDIR=share/mariadb/scripts
5193 - -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql"
5194 - -DINSTALL_SBINDIR=sbin
5195 - -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb"
5196 - -DWITH_COMMENT="Gentoo Linux ${PF}"
5197 - -DWITH_UNIT_TESTS=$(usex test ON OFF)
5198 - -DWITH_LIBEDIT=0
5199 - -DWITH_ZLIB=system
5200 - -DWITHOUT_LIBWRAP=1
5201 - -DENABLED_LOCAL_INFILE=1
5202 - -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock"
5203 - -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock"
5204 - -DWITH_DEFAULT_COMPILER_OPTIONS=0
5205 - -DWITH_DEFAULT_FEATURE_SET=0
5206 - -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)"
5207 - # The build forces this to be defined when cross-compiling. We pass it
5208 - # all the time for simplicity and to make sure it is actually correct.
5209 - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
5210 - -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)"
5211 - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
5212 - -DAUTH_GSSAPI_PLUGIN_TYPE=$(usex kerberos DYNAMIC OFF)
5213 - -DCONC_WITH_EXTERNAL_ZLIB=YES
5214 - -DWITH_EXTERNAL_ZLIB=YES
5215 - -DSUFFIX_INSTALL_DIR=""
5216 - -DWITH_UNITTEST=OFF
5217 - -DWITHOUT_CLIENTLIBS=YES
5218 - -DCLIENT_PLUGIN_DIALOG=OFF
5219 - -DCLIENT_PLUGIN_AUTH_GSSAPI_CLIENT=OFF
5220 - -DCLIENT_PLUGIN_CLIENT_ED25519=OFF
5221 - -DCLIENT_PLUGIN_MYSQL_CLEAR_PASSWORD=STATIC
5222 - -DCLIENT_PLUGIN_CACHING_SHA2_PASSWORD=OFF
5223 - )
5224 - if use test ; then
5225 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test )
5226 - else
5227 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
5228 - fi
5229 -
5230 - if ! use yassl ; then
5231 - mycmakeargs+=( -DWITH_SSL=system -DCLIENT_PLUGIN_SHA256_PASSWORD=STATIC )
5232 - else
5233 - mycmakeargs+=( -DWITH_SSL=bundled )
5234 - fi
5235 -
5236 - # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION
5237 - mycmakeargs+=(
5238 - -DWITH_READLINE=$(usex bindist 1 0)
5239 - -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1)
5240 - -DENABLE_DTRACE=$(usex systemtap)
5241 - )
5242 -
5243 - if use server ; then
5244 -
5245 - # Federated{,X} must be treated special otherwise they will not be built as plugins
5246 - if ! use extraengine ; then
5247 - mycmakeargs+=(
5248 - -DPLUGIN_FEDERATED=NO
5249 - -DPLUGIN_FEDERATEDX=NO )
5250 - fi
5251 -
5252 - mycmakeargs+=(
5253 - -DWITH_PCRE=system
5254 - -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO)
5255 - -DPLUGIN_SPHINX=$(usex sphinx YES NO)
5256 - -DPLUGIN_TOKUDB=$(usex tokudb YES NO)
5257 - -DPLUGIN_AUTH_PAM=$(usex pam YES NO)
5258 - -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO)
5259 - -DPLUGIN_CASSANDRA=NO
5260 - -DPLUGIN_SEQUENCE=$(usex extraengine YES NO)
5261 - -DPLUGIN_SPIDER=$(usex extraengine YES NO)
5262 - -DPLUGIN_CONNECT=$(usex extraengine YES NO)
5263 - -DCONNECT_WITH_MYSQL=1
5264 - -DCONNECT_WITH_LIBXML2=$(usex xml)
5265 - -DCONNECT_WITH_ODBC=$(usex odbc)
5266 - -DCONNECT_WITH_JDBC=$(usex jdbc)
5267 - # Build failure and autodep wrt bug 639144
5268 - -DCONNECT_WITH_MONGO=OFF
5269 - -DWITH_WSREP=$(usex galera)
5270 - -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF)
5271 - -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF)
5272 - -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF)
5273 - -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO)
5274 - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
5275 - -DWITH_MARIABACKUP=$(usex backup ON OFF)
5276 - -DWITH_LIBARCHIVE=$(usex backup ON OFF)
5277 - -DINSTALL_SQLBENCHDIR=""
5278 - -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO)
5279 - # systemd is only linked to for server notification
5280 - -DWITH_SYSTEMD=$(usex systemd yes no)
5281 - -DWITH_NUMA=$(usex numa ON OFF)
5282 - )
5283 -
5284 - # Workaround for MDEV-14524
5285 - use tokudb && mycmakeargs+=( -DTOKUDB_OK=1 )
5286 -
5287 - if use test ; then
5288 - # This is needed for the new client lib which tests a real, open server
5289 - mycmakeargs+=( -DSKIP_TESTS=ON )
5290 - fi
5291 -
5292 - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
5293 - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
5294 - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
5295 - ewarn "You MUST file bugs without these variables set."
5296 -
5297 - mycmakeargs+=(
5298 - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
5299 - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
5300 - )
5301 -
5302 - elif ! use latin1 ; then
5303 - mycmakeargs+=(
5304 - -DDEFAULT_CHARSET=utf8
5305 - -DDEFAULT_COLLATION=utf8_general_ci
5306 - )
5307 - else
5308 - mycmakeargs+=(
5309 - -DDEFAULT_CHARSET=latin1
5310 - -DDEFAULT_COLLATION=latin1_swedish_ci
5311 - )
5312 - fi
5313 - mycmakeargs+=(
5314 - -DEXTRA_CHARSETS=all
5315 - -DMYSQL_USER=mysql
5316 - -DDISABLE_SHARED=$(usex static YES NO)
5317 - -DWITH_DEBUG=$(usex debug)
5318 - -DWITH_EMBEDDED_SERVER=OFF
5319 - -DWITH_PROFILING=$(usex profiling)
5320 - )
5321 -
5322 - if use static; then
5323 - mycmakeargs+=( -DWITH_PIC=1 )
5324 - fi
5325 -
5326 - if use jemalloc || use tcmalloc ; then
5327 - mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
5328 - fi
5329 -
5330 - # Storage engines
5331 - mycmakeargs+=(
5332 - -DWITH_ARCHIVE_STORAGE_ENGINE=1
5333 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1
5334 - -DWITH_CSV_STORAGE_ENGINE=1
5335 - -DWITH_HEAP_STORAGE_ENGINE=1
5336 - -DWITH_INNOBASE_STORAGE_ENGINE=1
5337 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1
5338 - -DWITH_MYISAM_STORAGE_ENGINE=1
5339 - -DWITH_PARTITION_STORAGE_ENGINE=1
5340 - )
5341 -
5342 - else
5343 - mycmakeargs+=(
5344 - -DWITHOUT_SERVER=1
5345 - -DWITH_EMBEDDED_SERVER=OFF
5346 - -DEXTRA_CHARSETS=none
5347 - -DINSTALL_SQLBENCHDIR=
5348 - -DWITH_SYSTEMD=no
5349 - )
5350 - fi
5351 -
5352 - cmake_src_configure
5353 -}
5354 -
5355 -src_compile() {
5356 - cmake_src_compile
5357 -}
5358 -
5359 -# Official test instructions:
5360 -# USE='extraengine perl server' \
5361 -# FEATURES='test userpriv' \
5362 -# ebuild mariadb-X.X.XX.ebuild \
5363 -# digest clean package
5364 -src_test() {
5365 - _disable_test() {
5366 - local rawtestname bug reason
5367 - rawtestname="${1}" ; shift
5368 - bug="${1}" ; shift
5369 - reason="${@}"
5370 - ewarn "test '${rawtestname}' disabled: '${reason}' (BUG#${bug})"
5371 - echo "${rawtestname} : BUG#${bug} ${reason}" >> "${T}/disabled.def"
5372 - }
5373 -
5374 - local TESTDIR="${BUILD_DIR}/mysql-test"
5375 - local retstatus_unit
5376 - local retstatus_tests
5377 -
5378 - if ! use server ; then
5379 - einfo "Skipping server tests due to minimal build."
5380 - return 0
5381 - fi
5382 -
5383 - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
5384 -
5385 - # Run CTest (test-units)
5386 - cmake_src_test
5387 - retstatus_unit=$?
5388 -
5389 - # Ensure that parallel runs don't die
5390 - export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
5391 -
5392 - if [[ -z "${MTR_PARALLEL}" ]] ; then
5393 - local -x MTR_PARALLEL=$(makeopts_jobs)
5394 -
5395 - if [[ ${MTR_PARALLEL} -gt 4 ]] ; then
5396 - # Running multiple tests in parallel usually require higher ulimit
5397 - # and fs.aio-max-nr setting. In addition, tests like main.multi_update
5398 - # are known to hit timeout when system is busy.
5399 - # To avoid test failure we will limit MTR_PARALLEL to 4 instead of
5400 - # using "auto".
5401 - local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})"
5402 - info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!"
5403 - einfo "${info_msg}"
5404 - unset info_msg
5405 - MTR_PARALLEL=4
5406 - fi
5407 - else
5408 - einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'"
5409 - fi
5410 -
5411 - # Try to increase file limits to increase test coverage
5412 - if ! ulimit -n 16500 1>/dev/null 2>&1 ; then
5413 - # Upper limit comes from parts.partition_* tests
5414 - ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager."
5415 -
5416 - if ! ulimit -n 4162 1>/dev/null 2>&1 ; then
5417 - # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)'
5418 - ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager."
5419 -
5420 - if ! ulimit -n 3000 1>/dev/null 2>&1 ; then
5421 - ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager."
5422 - else
5423 - einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)."
5424 - fi
5425 - else
5426 - einfo "Will run test suite with open file limit set to 4162 (medium test coverage)."
5427 - fi
5428 - else
5429 - einfo "Will run test suite with open file limit set to 16500 (best test coverage)."
5430 - fi
5431 -
5432 - # create directories because mysqladmin might run out of order
5433 - mkdir -p "${T}"/var-tests{,/log} || die
5434 -
5435 - cp "${S}"/mysql-test/unstable-tests "${T}/disabled.def" || die
5436 -
5437 - local -a disabled_tests
5438 - disabled_tests+=( "compat/oracle.plugin;0;Needs example plugin which Gentoo disables" )
5439 - disabled_tests+=( "main.explain_non_select;0;Sporadically failing test" )
5440 - disabled_tests+=( "main.func_time;0;Dependent on time test was written" )
5441 - disabled_tests+=( "main.plugin_auth;0;Needs client libraries built" )
5442 - disabled_tests+=( "main.stat_tables;0;Sporadically failing test" )
5443 - disabled_tests+=( "main.stat_tables_innodb;0;Sporadically failing test" )
5444 - disabled_tests+=( "mariabackup.*;0;Broken test suite" )
5445 - disabled_tests+=( "perfschema.nesting;23458;Known to be broken" )
5446 - disabled_tests+=( "plugins.auth_ed25519;0;Needs client libraries built" )
5447 - disabled_tests+=( "plugins.cracklib_password_check;0;False positive due to varying policies" )
5448 - disabled_tests+=( "plugins.two_password_validations;0;False positive due to varying policies" )
5449 - disabled_tests+=( "roles.acl_statistics;0;False positive due to a user count mismatch caused by previous test" )
5450 -
5451 - if ! use latin1 ; then
5452 - disabled_tests+=( "funcs_1.is_columns_mysql;0;Requires USE=latin1" )
5453 - disabled_tests+=( "main.information_schema;0;Requires USE=latin1" )
5454 - disabled_tests+=( "main.system_mysql_db;0;Requires USE=latin1" )
5455 - fi
5456 -
5457 - local test_infos_str test_infos_arr
5458 - for test_infos_str in "${disabled_tests[@]}" ; do
5459 - IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}"
5460 -
5461 - if [[ ${#test_infos_arr[@]} != 3 ]] ; then
5462 - die "Invalid test data set, not matching format: ${test_infos_str}"
5463 - fi
5464 -
5465 - _disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}"
5466 - done
5467 - unset test_infos_str test_infos_arr
5468 -
5469 - # run mysql-test tests
5470 - pushd "${TESTDIR}" &>/dev/null || die
5471 - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def"
5472 - retstatus_tests=$?
5473 -
5474 - popd &>/dev/null || die
5475 -
5476 - # Cleanup is important for these testcases.
5477 - pkill -9 -f "${S}/ndb" 2>/dev/null
5478 - pkill -9 -f "${S}/sql" 2>/dev/null
5479 -
5480 - local failures=""
5481 - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
5482 - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
5483 -
5484 - [[ -z "$failures" ]] || die "Test failures: $failures"
5485 - einfo "Tests successfully completed"
5486 -}
5487 -
5488 -src_install() {
5489 - cmake_src_install
5490 -
5491 - # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used
5492 - if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then
5493 - rm "${ED}/usr/include/mysql/server/private/config.h" || die
5494 - fi
5495 -
5496 - # Make sure the vars are correctly initialized
5497 - mysql_init_vars
5498 -
5499 - # Convenience links
5500 - einfo "Making Convenience links for mysqlcheck multi-call binary"
5501 - dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
5502 - dosym "mysqlcheck" "/usr/bin/mysqlrepair"
5503 - dosym "mysqlcheck" "/usr/bin/mysqloptimize"
5504 -
5505 - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
5506 - if [[ -d "${ED}/usr/data" ]] ; then
5507 - rm -Rf "${ED}/usr/data" || die
5508 - fi
5509 -
5510 - # Unless they explicitly specific USE=test, then do not install the
5511 - # testsuite. It DOES have a use to be installed, esp. when you want to do a
5512 - # validation of your database configuration after tuning it.
5513 - if ! use test ; then
5514 - rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
5515 - fi
5516 -
5517 - # Configuration stuff
5518 - einfo "Building default configuration ..."
5519 - insinto "${MY_SYSCONFDIR#${EPREFIX}}"
5520 - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
5521 - cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die
5522 - eprefixify "${TMPDIR}/my.cnf"
5523 - doins "${TMPDIR}/my.cnf"
5524 - insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d"
5525 - cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
5526 - eprefixify "${TMPDIR}/50-distro-client.cnf"
5527 - doins "${TMPDIR}/50-distro-client.cnf"
5528 -
5529 - if use server ; then
5530 - mycnf_src="my.cnf.distro-server"
5531 - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
5532 - "${FILESDIR}/${mycnf_src}" \
5533 - > "${TMPDIR}/my.cnf.ok" || die
5534 - if use prefix ; then
5535 - sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
5536 - "${TMPDIR}/my.cnf.ok" || die
5537 - fi
5538 - if use latin1 ; then
5539 - sed -i \
5540 - -e "/character-set/s|utf8|latin1|g" \
5541 - "${TMPDIR}/my.cnf.ok" || die
5542 - fi
5543 - eprefixify "${TMPDIR}/my.cnf.ok"
5544 - newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
5545 -
5546 - einfo "Including support files and sample configurations"
5547 - docinto "support-files"
5548 - local script
5549 - for script in \
5550 - "${S}"/support-files/magic
5551 - do
5552 - [[ -f "$script" ]] && dodoc "${script}"
5553 - done
5554 -
5555 - docinto "scripts"
5556 - for script in "${S}"/scripts/mysql* ; do
5557 - [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
5558 - done
5559 - # Manually install supporting files that conflict with other packages
5560 - # but are needed for galera and initial installation
5561 - exeinto /usr/libexec/mariadb
5562 - doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror"
5563 -
5564 - if use pam ; then
5565 - keepdir /usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir
5566 - fi
5567 - fi
5568 -
5569 - # Remove mytop if perl is not selected
5570 - if [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl ; then
5571 - rm -f "${ED}/usr/bin/mytop" || die
5572 - fi
5573 -
5574 - # Fix a dangling symlink when galera is not built
5575 - if [[ -L "${ED}/usr/bin/wsrep_sst_rsync_wan" ]] && ! use galera ; then
5576 - rm "${ED}/usr/bin/wsrep_sst_rsync_wan" || die
5577 - fi
5578 -
5579 - # Remove broken SST scripts that are incompatible
5580 - local scriptremove
5581 - for scriptremove in wsrep_sst_xtrabackup wsrep_sst_xtrabackup-v2 ; do
5582 - if [[ -e "${ED}/usr/bin/${scriptremove}" ]] ; then
5583 - rm "${ED}/usr/bin/${scriptremove}" || die
5584 - fi
5585 - done
5586 -}
5587 -
5588 -pkg_preinst() {
5589 - java-pkg-opt-2_pkg_preinst
5590 -}
5591 -
5592 -pkg_postinst() {
5593 - # Make sure the vars are correctly initialized
5594 - mysql_init_vars
5595 -
5596 - # Create log directory securely if it does not exist
5597 - [[ -d "${ROOT}/${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}/${MY_LOGDIR}"
5598 -
5599 - if use server ; then
5600 - if use pam; then
5601 - einfo
5602 - elog "This install includes the PAM authentication plugin."
5603 - elog "To activate and configure the PAM plugin, please read:"
5604 - elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/"
5605 - einfo
5606 - chown mysql:mysql "${EROOT}/usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir" || die
5607 - fi
5608 -
5609 - if [[ -z "${REPLACING_VERSIONS}" ]] ; then
5610 - einfo
5611 - elog "You might want to run:"
5612 - elog "\"emerge --config =${CATEGORY}/${PF}\""
5613 - elog "if this is a new install."
5614 - elog
5615 - elog "If you are switching server implentations, you should run the"
5616 - elog "mysql_upgrade tool."
5617 - einfo
5618 - else
5619 - einfo
5620 - elog "If you are upgrading major versions, you should run the"
5621 - elog "mysql_upgrade tool."
5622 - einfo
5623 - fi
5624 -
5625 - if use galera ; then
5626 - einfo
5627 - elog "Be sure to edit the my.cnf file to activate your cluster settings."
5628 - elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
5629 - elog "The first time the cluster is activated, you should add"
5630 - elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
5631 - elog "This option should then be removed for subsequent starts."
5632 - einfo
5633 - if [[ -n "${REPLACING_VERSIONS}" ]] ; then
5634 - local rver
5635 - for rver in ${REPLACING_VERSIONS} ; do
5636 - if ver_test "${rver}" -lt "10.4.0" ; then
5637 - ewarn "Upgrading galera from a previous version requires admin restart of the entire cluster."
5638 - ewarn "Please refer to https://mariadb.com/kb/en/library/changes-improvements-in-mariadb-104/#galera-4"
5639 - ewarn "for more information"
5640 - fi
5641 - done
5642 - fi
5643 - fi
5644 - fi
5645 -
5646 - # Note about configuration change
5647 - einfo
5648 - elog "This version of mariadb reorganizes the configuration from a single my.cnf"
5649 - elog "to several files in /etc/mysql/${PN}.d."
5650 - elog "Please backup any changes you made to /etc/mysql/my.cnf"
5651 - elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension."
5652 - elog "You may have as many files as needed and they are read alphabetically."
5653 - elog "Be sure the options have the appropriate section headers, i.e. [mysqld]."
5654 - einfo
5655 -}
5656 -
5657 -pkg_config() {
5658 - _getoptval() {
5659 - local mypd="${EROOT}"/usr/libexec/mariadb/my_print_defaults
5660 - local section="$1"
5661 - local flag="--${2}="
5662 - local extra_options="${3}"
5663 - "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp"
5664 - }
5665 - local old_MY_DATADIR="${MY_DATADIR}"
5666 - local old_HOME="${HOME}"
5667 - # my_print_defaults needs to read stuff in $HOME/.my.cnf
5668 - export HOME=${EPREFIX}/root
5669 -
5670 - # Make sure the vars are correctly initialized
5671 - mysql_init_vars
5672 -
5673 - [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
5674 - if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then
5675 - die "Minimal builds do NOT include the MySQL server"
5676 - fi
5677 -
5678 - if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then
5679 - local MY_DATADIR_s="${ROOT}/${MY_DATADIR}"
5680 - MY_DATADIR_s="${MY_DATADIR_s%%/}"
5681 - local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}"
5682 - old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
5683 -
5684 - if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then
5685 - if [[ -d "${MY_DATADIR_s}" ]]; then
5686 - ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
5687 - ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
5688 - else
5689 - elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
5690 - mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
5691 - || die "Moving MY_DATADIR failed"
5692 - fi
5693 - else
5694 - ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
5695 - if [[ -d "${MY_DATADIR_s}" ]]; then
5696 - ewarn "Attempting to use ${MY_DATADIR_s}"
5697 - else
5698 - eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
5699 - die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
5700 - fi
5701 - fi
5702 - fi
5703 -
5704 - local pwd1="a"
5705 - local pwd2="b"
5706 - local maxtry=15
5707 -
5708 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
5709 - local tmp_mysqld_password_source=
5710 -
5711 - for tmp_mysqld_password_source in mysql client; do
5712 - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
5713 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
5714 - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then
5715 - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then
5716 - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
5717 - MYSQL_ROOT_PASSWORD=
5718 - continue
5719 - fi
5720 -
5721 - einfo "Found password in '${tmp_mysqld_password_source}' section!"
5722 - break
5723 - fi
5724 - done
5725 -
5726 - # Sometimes --show is required to display passwords in some implementations of my_print_defaults
5727 - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then
5728 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
5729 - fi
5730 -
5731 - unset tmp_mysqld_password_source
5732 - fi
5733 - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir | tail -n1)"
5734 - # These are dir+prefix
5735 - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log | tail -n1)"
5736 - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
5737 - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin | tail -n1)"
5738 - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
5739 -
5740 - if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then
5741 - einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
5742 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR"
5743 - fi
5744 - if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then
5745 - einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
5746 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN"
5747 - fi
5748 - if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then
5749 - einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
5750 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG"
5751 - fi
5752 -
5753 - if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then
5754 - ewarn "You have already a MySQL database in place."
5755 - ewarn "(${ROOT}/${MY_DATADIR}/*)"
5756 - ewarn "Please rename or delete it if you wish to replace it."
5757 - die "MySQL database already exists!"
5758 - fi
5759 -
5760 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
5761 - # localhost. Also causes weird failures.
5762 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
5763 -
5764 - if [[ -z "${MYSQL_ROOT_PASSWORD}" ]]; then
5765 -
5766 - einfo "Please provide a password for the mysql 'root'@'localhost' user now"
5767 - einfo "or through the ${HOME}/.my.cnf file."
5768 - ewarn "Avoid [\"'\\_%] characters in the password"
5769 - einfo "Not entering a password defaults to UNIX authentication"
5770 - read -rsp " >" pwd1 ; echo
5771 -
5772 - if [[ -n "${pwd1}" ]] ; then
5773 - einfo "Retype the password"
5774 - read -rsp " >" pwd2 ; echo
5775 -
5776 - if [[ "x$pwd1" != "x$pwd2" ]] ; then
5777 - die "Passwords are not the same"
5778 - fi
5779 -
5780 - MYSQL_ROOT_PASSWORD="${pwd1}"
5781 - fi
5782 -
5783 - unset pwd1 pwd2
5784 - fi
5785 -
5786 - local options
5787 - local sqltmp="$(emktemp)"
5788 -
5789 - # Fix bug 446200. Don't reference host my.cnf, needs to come first,
5790 - # see https://bugs.mysql.com/bug.php?id=31312
5791 - use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
5792 -
5793 - # Figure out which options we need to disable to do the setup
5794 - local helpfile="${TMPDIR}/mysqld-help"
5795 - "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
5796 - for opt in host-cache name-resolve networking slave-start \
5797 - federated ssl log-bin relay-log slow-query-log external-locking \
5798 - log-slave-updates \
5799 - ; do
5800 - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
5801 - egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
5802 - done
5803 -
5804 - einfo "Creating the mysql database and setting proper permissions on it ..."
5805 -
5806 - # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
5807 - PID_DIR="${EROOT}/var/run/mysqld"
5808 - if [[ ! -d "${PID_DIR}" ]]; then
5809 - install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
5810 - fi
5811 -
5812 - if [[ ! -d "${MY_DATADIR}" ]]; then
5813 - install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory"
5814 - fi
5815 -
5816 - pushd "${TMPDIR}" &>/dev/null || die
5817 -
5818 - # Filling timezones, see
5819 - # https://dev.mysql.com/doc/mysql/en/time-zone-support.html
5820 - "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null
5821 -
5822 - local cmd=( "${EROOT}/usr/share/mariadb/scripts/mysql_install_db" )
5823 - [[ -f "${cmd}" ]] || cmd=( "${EROOT}/usr/bin/mysql_install_db" )
5824 - cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" )
5825 - einfo "Command: ${cmd[*]}"
5826 - su -s /bin/sh -c "${cmd[*]}" mysql \
5827 - >"${TMPDIR}"/mysql_install_db.log 2>&1
5828 - if [[ $? -ne 0 ]]; then
5829 - grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2
5830 - die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log"
5831 - fi
5832 - popd &>/dev/null || die
5833 - [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \
5834 - || die "MySQL databases not installed"
5835 -
5836 - if [[ -z ${sqltmp} && -z ${MYSQL_ROOT_PASSWORD} ]] ; then
5837 - einfo "Done"
5838 - exit 0
5839 - fi
5840 -
5841 - use prefix || options="${options} --user=mysql"
5842 -
5843 - local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock"
5844 - local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid"
5845 - local mysqld="${EROOT}/usr/sbin/mysqld \
5846 - ${options} \
5847 - --log-warnings=0 \
5848 - --basedir=${EROOT}/usr \
5849 - --datadir=${ROOT}/${MY_DATADIR} \
5850 - --max_allowed_packet=8M \
5851 - --net_buffer_length=16K \
5852 - --socket=${socket} \
5853 - --pid-file=${pidfile} \
5854 - --tmpdir=${ROOT}/${MYSQL_TMPDIR}"
5855 - #einfo "About to start mysqld: ${mysqld}"
5856 - ebegin "Starting mysqld"
5857 - einfo "Command ${mysqld}"
5858 - ${mysqld} &
5859 - rc=$?
5860 - while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
5861 - maxtry=$((${maxtry}-1))
5862 - echo -n "."
5863 - sleep 1
5864 - done
5865 - eend $rc
5866 -
5867 - if ! [[ -S "${socket}" ]]; then
5868 - die "Completely failed to start up mysqld with: ${mysqld}"
5869 - fi
5870 -
5871 - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then
5872 - ebegin "Setting root password"
5873 - # Do this from memory, as we don't want clear text passwords in temp files
5874 - local sql="SET PASSWORD FOR 'root'@'localhost' = PASSWORD('${MYSQL_ROOT_PASSWORD}')"
5875 - "${EROOT}/usr/bin/mysql" \
5876 - "--socket=${socket}" \
5877 - -hlocalhost \
5878 - -e "${sql}"
5879 - unset sql
5880 - eend $?
5881 - fi
5882 -
5883 - if [[ -n "${sqltmp}" ]] ; then
5884 - ebegin "Loading \"zoneinfo\", this step may require a few seconds"
5885 - "${EROOT}/usr/bin/mysql" \
5886 - "--socket=${socket}" \
5887 - -hlocalhost \
5888 - -uroot \
5889 - --password="${MYSQL_ROOT_PASSWORD}" \
5890 - mysql < "${sqltmp}"
5891 - rc=$?
5892 - eend $?
5893 - [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!"
5894 - fi
5895 -
5896 - # Stop the server and cleanup
5897 - einfo "Stopping the server ..."
5898 - kill $(< "${pidfile}" )
5899 - rm -f "${sqltmp}"
5900 - wait %1
5901 - einfo "Done"
5902 -}
5903
5904 diff --git a/dev-db/mariadb/mariadb-10.5.5.ebuild b/dev-db/mariadb/mariadb-10.5.5.ebuild
5905 deleted file mode 100644
5906 index 4e750646088..00000000000
5907 --- a/dev-db/mariadb/mariadb-10.5.5.ebuild
5908 +++ /dev/null
5909 @@ -1,1033 +0,0 @@
5910 -# Copyright 1999-2020 Gentoo Authors
5911 -# Distributed under the terms of the GNU General Public License v2
5912 -
5913 -EAPI="7"
5914 -SUBSLOT="18"
5915 -
5916 -JAVA_PKG_OPT_USE="jdbc"
5917 -
5918 -inherit eutils systemd flag-o-matic prefix toolchain-funcs \
5919 - multiprocessing java-pkg-opt-2 cmake
5920 -
5921 -# Patch version
5922 -PATCH_SET="https://dev.gentoo.org/~whissi/dist/${PN}/${PN}-10.5.5-patches-02.tar.xz"
5923 -
5924 -SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz
5925 - ${PATCH_SET}"
5926 -
5927 -HOMEPAGE="https://mariadb.org/"
5928 -DESCRIPTION="An enhanced, drop-in replacement for MySQL"
5929 -LICENSE="GPL-2 LGPL-2.1+"
5930 -SLOT="10.5/${SUBSLOT:-0}"
5931 -IUSE="+backup bindist columnstore cracklib debug extraengine galera innodb-lz4
5932 - innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 libressl mroonga
5933 - numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx
5934 - sst-rsync sst-mariabackup static systemd systemtap s3 tcmalloc
5935 - test xml yassl"
5936 -
5937 -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
5938 -RESTRICT="!bindist? ( bindist ) libressl? ( test ) !test? ( test )"
5939 -
5940 -REQUIRED_USE="jdbc? ( extraengine server !static )
5941 - ?? ( tcmalloc jemalloc )
5942 - static? ( yassl !pam )"
5943 -
5944 -KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
5945 -
5946 -# Shorten the path because the socket path length must be shorter than 107 chars
5947 -# and we will run a mysql server during test phase
5948 -S="${WORKDIR}/mysql"
5949 -
5950 -# Be warned, *DEPEND are version-dependant
5951 -# These are used for both runtime and compiletime
5952 -COMMON_DEPEND="
5953 - >=dev-libs/libpcre-8.41-r1:3=
5954 - >=sys-apps/sed-4
5955 - >=sys-apps/texinfo-4.7-r1
5956 - sys-libs/ncurses:0=
5957 - >=sys-libs/zlib-1.2.3:0=
5958 - !bindist? (
5959 - sys-libs/binutils-libs:0=
5960 - >=sys-libs/readline-4.1:0=
5961 - )
5962 - jemalloc? ( dev-libs/jemalloc:0= )
5963 - kerberos? ( virtual/krb5 )
5964 - kernel_linux? (
5965 - sys-process/procps:0=
5966 - dev-libs/libaio:0=
5967 - )
5968 - server? (
5969 - app-arch/bzip2
5970 - app-arch/xz-utils
5971 - backup? ( app-arch/libarchive:0= )
5972 - columnstore? (
5973 - app-arch/snappy
5974 - dev-libs/boost:0=
5975 - dev-libs/libxml2:2=
5976 - )
5977 - cracklib? ( sys-libs/cracklib:0= )
5978 - extraengine? (
5979 - odbc? ( dev-db/unixODBC:0= )
5980 - xml? ( dev-libs/libxml2:2= )
5981 - )
5982 - innodb-lz4? ( app-arch/lz4 )
5983 - innodb-lzo? ( dev-libs/lzo )
5984 - innodb-snappy? ( app-arch/snappy )
5985 - mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 )
5986 - numa? ( sys-process/numactl )
5987 - oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= )
5988 - pam? ( sys-libs/pam:0= )
5989 - s3? ( net-misc/curl )
5990 - systemd? ( sys-apps/systemd:= )
5991 - )
5992 - systemtap? ( >=dev-util/systemtap-1.3:0= )
5993 - tcmalloc? ( dev-util/google-perftools:0= )
5994 - yassl? ( net-libs/gnutls:0= )
5995 - !yassl? (
5996 - !libressl? ( >=dev-libs/openssl-1.0.0:0= )
5997 - libressl? ( dev-libs/libressl:0= )
5998 - )
5999 -"
6000 -BDEPEND="virtual/yacc
6001 - || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
6002 -"
6003 -DEPEND="${COMMON_DEPEND}
6004 - server? (
6005 - extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) )
6006 - test? ( acct-group/mysql acct-user/mysql )
6007 - )
6008 - static? ( sys-libs/ncurses[static-libs] )
6009 -"
6010 -RDEPEND="${COMMON_DEPEND}
6011 - !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
6012 - !dev-db/mariadb:0
6013 - !dev-db/mariadb:5.5
6014 - !dev-db/mariadb:10.1
6015 - !dev-db/mariadb:10.2
6016 - !dev-db/mariadb:10.3
6017 - !dev-db/mariadb:10.4
6018 - !<virtual/mysql-5.6-r11
6019 - !<virtual/libmysqlclient-18-r1
6020 - selinux? ( sec-policy/selinux-mysql )
6021 - server? (
6022 - columnstore? ( dev-db/mariadb-connector-c )
6023 - extraengine? ( jdbc? ( >=virtual/jre-1.6 ) )
6024 - galera? (
6025 - sys-apps/iproute2
6026 - =sys-cluster/galera-26*
6027 - sst-rsync? ( sys-process/lsof )
6028 - sst-mariabackup? ( net-misc/socat[ssl] )
6029 - )
6030 - !prefix? ( dev-db/mysql-init-scripts acct-group/mysql acct-user/mysql )
6031 - )
6032 - perl? (
6033 - !dev-db/mytop
6034 - virtual/perl-Getopt-Long
6035 - dev-perl/TermReadKey
6036 - virtual/perl-Term-ANSIColor
6037 - virtual/perl-Time-HiRes
6038 - )
6039 -"
6040 -# For other stuff to bring us in
6041 -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
6042 -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
6043 -
6044 -mysql_init_vars() {
6045 - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"}
6046 - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
6047 - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
6048 - MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
6049 -
6050 - if [[ -z "${MY_DATADIR}" ]] ; then
6051 - MY_DATADIR=""
6052 - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
6053 - MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \
6054 - | sed -ne '/datadir/s|^--datadir=||p' \
6055 - | tail -n1)
6056 - if [[ -z "${MY_DATADIR}" ]] ; then
6057 - MY_DATADIR=$(grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
6058 - | sed -e 's/.*=\s*//' \
6059 - | tail -n1)
6060 - fi
6061 - fi
6062 - if [[ -z "${MY_DATADIR}" ]] ; then
6063 - MY_DATADIR="${MY_LOCALSTATEDIR}"
6064 - einfo "Using default MY_DATADIR"
6065 - fi
6066 - elog "MySQL MY_DATADIR is ${MY_DATADIR}"
6067 -
6068 - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
6069 - if [[ -e "${MY_DATADIR}" ]] ; then
6070 - # If you get this and you're wondering about it, see bug #207636
6071 - elog "MySQL datadir found in ${MY_DATADIR}"
6072 - elog "A new one will not be created."
6073 - PREVIOUS_DATADIR="yes"
6074 - else
6075 - PREVIOUS_DATADIR="no"
6076 - fi
6077 - export PREVIOUS_DATADIR
6078 - fi
6079 - else
6080 - if [[ ${EBUILD_PHASE} == "config" ]]; then
6081 - local new_MY_DATADIR
6082 - new_MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \
6083 - | sed -ne '/datadir/s|^--datadir=||p' \
6084 - | tail -n1)
6085 -
6086 - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
6087 - ewarn "MySQL MY_DATADIR has changed"
6088 - ewarn "from ${MY_DATADIR}"
6089 - ewarn "to ${new_MY_DATADIR}"
6090 - MY_DATADIR="${new_MY_DATADIR}"
6091 - fi
6092 - fi
6093 - fi
6094 -
6095 - export MY_SHAREDSTATEDIR MY_SYSCONFDIR
6096 - export MY_LOCALSTATEDIR MY_LOGDIR
6097 - export MY_DATADIR
6098 -}
6099 -
6100 -pkg_setup() {
6101 - if [[ ${MERGE_TYPE} != binary ]] ; then
6102 - local GCC_MAJOR_SET=$(gcc-major-version)
6103 - local GCC_MINOR_SET=$(gcc-minor-version)
6104 -
6105 - # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
6106 - # non x86{,_64} arches
6107 - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
6108 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
6109 - eerror "${PN} needs to be built with gcc-4.7 or later."
6110 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
6111 - die
6112 - fi
6113 -
6114 - if has test ${FEATURES} ; then
6115 - # Bug #213475 - MySQL _will_ object strenuously if your machine is named
6116 - # localhost. Also causes weird failures.
6117 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
6118 -
6119 - if ! has userpriv ${FEATURES} ; then
6120 - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
6121 - fi
6122 - fi
6123 - fi
6124 -
6125 - java-pkg-opt-2_pkg_setup
6126 -}
6127 -
6128 -src_unpack() {
6129 - unpack ${A}
6130 -
6131 - mv -f "${WORKDIR}/${P/_rc/}" "${S}" || die
6132 -}
6133 -
6134 -src_prepare() {
6135 - eapply "${WORKDIR}"/mariadb-patches
6136 -
6137 - eapply_user
6138 -
6139 - _disable_plugin() {
6140 - echo > "${S}/plugin/${1}/CMakeLists.txt" || die
6141 - }
6142 - _disable_engine() {
6143 - echo > "${S}/storage/${1}/CMakeLists.txt" || die
6144 - }
6145 -
6146 - if use jemalloc; then
6147 - echo "TARGET_LINK_LIBRARIES(mariadbd jemalloc)" >> "${S}/sql/CMakeLists.txt"
6148 - elif use tcmalloc; then
6149 - echo "TARGET_LINK_LIBRARIES(mariadbd tcmalloc)" >> "${S}/sql/CMakeLists.txt"
6150 - fi
6151 -
6152 - local plugin
6153 - local server_plugins=( handler_socket auth_socket feedback metadata_lock_info
6154 - locale_info qc_info server_audit sql_errlog auth_ed25519 )
6155 - local test_plugins=( audit_null auth_examples daemon_example fulltext
6156 - debug_key_management example_key_management versioning )
6157 - if ! use server; then # These plugins are for the server
6158 - for plugin in "${server_plugins[@]}" ; do
6159 - _disable_plugin "${plugin}"
6160 - done
6161 - fi
6162 -
6163 - if ! use test; then # These plugins are only used during testing
6164 - for plugin in "${test_plugins[@]}" ; do
6165 - _disable_plugin "${plugin}"
6166 - done
6167 - _disable_engine test_sql_discovery
6168 - echo > "${S}/plugin/auth_pam/testing/CMakeLists.txt" || die
6169 - fi
6170 -
6171 - _disable_engine example
6172 -
6173 - if ! use oqgraph ; then # avoids extra library checks
6174 - _disable_engine oqgraph
6175 - fi
6176 -
6177 - if use mroonga ; then
6178 - # Remove the bundled groonga
6179 - # There is no CMake flag, it simply checks for existance
6180 - rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga"
6181 - else
6182 - _disable_engine mroonga
6183 - fi
6184 -
6185 - # Fix static bindings in galera replication
6186 - sed -i -e 's~add_library(wsrep_api_v26$~add_library(wsrep_api_v26 STATIC~' \
6187 - "${S}"/wsrep-lib/wsrep-API/CMakeLists.txt || die
6188 - sed -i -e 's~add_library(wsrep-lib$~add_library(wsrep-lib STATIC~' \
6189 - "${S}"/wsrep-lib/src/CMakeLists.txt || die
6190 -
6191 - # Fix galera_recovery.sh script
6192 - sed -i -e "s~@bindir@/my_print_defaults~${EPREFIX}/usr/libexec/mariadb/my_print_defaults~" \
6193 - scripts/galera_recovery.sh || die
6194 -
6195 - sed -i -e 's~ \$basedir/lib/\*/mariadb19/plugin~~' \
6196 - "${S}"/scripts/mysql_install_db.sh || die
6197 -
6198 - cmake_src_prepare
6199 - java-pkg-opt-2_src_prepare
6200 -}
6201 -
6202 -src_configure() {
6203 - # bug 508724 mariadb cannot use ld.gold
6204 - tc-ld-disable-gold
6205 - # Bug #114895, bug #110149
6206 - filter-flags "-O" "-O[01]"
6207 -
6208 - # It fails on alpha without this
6209 - use alpha && append-ldflags "-Wl,--no-relax"
6210 -
6211 - append-cxxflags -felide-constructors
6212 -
6213 - # bug #283926, with GCC4.4, this is required to get correct behavior.
6214 - append-flags -fno-strict-aliasing
6215 -
6216 - CMAKE_BUILD_TYPE="RelWithDebInfo"
6217 -
6218 - # debug hack wrt #497532
6219 - mycmakeargs=(
6220 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
6221 - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
6222 - -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql"
6223 - -DSYSCONFDIR="${EPREFIX}/etc/mysql"
6224 - -DINSTALL_BINDIR=bin
6225 - -DINSTALL_DOCDIR=share/doc/${PF}
6226 - -DINSTALL_DOCREADMEDIR=share/doc/${PF}
6227 - -DINSTALL_INCLUDEDIR=include/mysql
6228 - -DINSTALL_INFODIR=share/info
6229 - -DINSTALL_LIBDIR=$(get_libdir)
6230 - -DINSTALL_MANDIR=share/man
6231 - -DINSTALL_MYSQLSHAREDIR=share/mariadb
6232 - -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin
6233 - -DINSTALL_SCRIPTDIR=share/mariadb/scripts
6234 - -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql"
6235 - -DINSTALL_SBINDIR=sbin
6236 - -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb"
6237 - -DWITH_COMMENT="Gentoo Linux ${PF}"
6238 - -DWITH_UNIT_TESTS=$(usex test ON OFF)
6239 - -DWITH_LIBEDIT=0
6240 - -DWITH_ZLIB=system
6241 - -DWITHOUT_LIBWRAP=1
6242 - -DENABLED_LOCAL_INFILE=1
6243 - -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock"
6244 - -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock"
6245 - -DWITH_DEFAULT_COMPILER_OPTIONS=0
6246 - -DWITH_DEFAULT_FEATURE_SET=0
6247 - -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)"
6248 - # The build forces this to be defined when cross-compiling. We pass it
6249 - # all the time for simplicity and to make sure it is actually correct.
6250 - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
6251 - -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)"
6252 - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
6253 - -DAUTH_GSSAPI_PLUGIN_TYPE=$(usex kerberos DYNAMIC OFF)
6254 - -DCONC_WITH_EXTERNAL_ZLIB=YES
6255 - -DWITH_EXTERNAL_ZLIB=YES
6256 - -DSUFFIX_INSTALL_DIR=""
6257 - -DWITH_UNITTEST=OFF
6258 - -DWITHOUT_CLIENTLIBS=YES
6259 - -DCLIENT_PLUGIN_DIALOG=OFF
6260 - -DCLIENT_PLUGIN_AUTH_GSSAPI_CLIENT=OFF
6261 - -DCLIENT_PLUGIN_CLIENT_ED25519=OFF
6262 - -DCLIENT_PLUGIN_MYSQL_CLEAR_PASSWORD=STATIC
6263 - -DCLIENT_PLUGIN_CACHING_SHA2_PASSWORD=OFF
6264 - )
6265 - if use test ; then
6266 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test )
6267 - else
6268 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
6269 - fi
6270 -
6271 - if ! use yassl ; then
6272 - mycmakeargs+=( -DWITH_SSL=system -DCLIENT_PLUGIN_SHA256_PASSWORD=STATIC )
6273 - else
6274 - mycmakeargs+=( -DWITH_SSL=bundled )
6275 - fi
6276 -
6277 - # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION
6278 - mycmakeargs+=(
6279 - -DWITH_READLINE=$(usex bindist 1 0)
6280 - -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1)
6281 - -DENABLE_DTRACE=$(usex systemtap)
6282 - )
6283 -
6284 - if use server ; then
6285 -
6286 - # Federated{,X} must be treated special otherwise they will not be built as plugins
6287 - if ! use extraengine ; then
6288 - mycmakeargs+=(
6289 - -DPLUGIN_FEDERATED=NO
6290 - -DPLUGIN_FEDERATEDX=NO
6291 - )
6292 - fi
6293 -
6294 - mycmakeargs+=(
6295 - -DWITH_PCRE=system
6296 - -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO)
6297 - -DPLUGIN_SPHINX=$(usex sphinx YES NO)
6298 - -DPLUGIN_AUTH_PAM=$(usex pam YES NO)
6299 - -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO)
6300 - -DPLUGIN_CASSANDRA=NO
6301 - -DPLUGIN_SEQUENCE=$(usex extraengine YES NO)
6302 - -DPLUGIN_SPIDER=$(usex extraengine YES NO)
6303 - -DPLUGIN_S3=$(usex s3 YES NO)
6304 - -DPLUGIN_COLUMNSTORE=$(usex columnstore YES NO)
6305 - -DPLUGIN_CONNECT=$(usex extraengine YES NO)
6306 - -DCONNECT_WITH_MYSQL=1
6307 - -DCONNECT_WITH_LIBXML2=$(usex xml)
6308 - -DCONNECT_WITH_ODBC=$(usex odbc)
6309 - -DCONNECT_WITH_JDBC=$(usex jdbc)
6310 - # Build failure and autodep wrt bug 639144
6311 - -DCONNECT_WITH_MONGO=OFF
6312 - -DWITH_WSREP=$(usex galera)
6313 - -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF)
6314 - -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF)
6315 - -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF)
6316 - -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO)
6317 - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
6318 - -DWITH_MARIABACKUP=$(usex backup ON OFF)
6319 - -DWITH_LIBARCHIVE=$(usex backup ON OFF)
6320 - -DINSTALL_SQLBENCHDIR=""
6321 - -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO)
6322 - # systemd is only linked to for server notification
6323 - -DWITH_SYSTEMD=$(usex systemd yes no)
6324 - -DWITH_NUMA=$(usex numa ON OFF)
6325 - )
6326 -
6327 - if use test ; then
6328 - # This is needed for the new client lib which tests a real, open server
6329 - mycmakeargs+=( -DSKIP_TESTS=ON )
6330 - fi
6331 -
6332 - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
6333 - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
6334 - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
6335 - ewarn "You MUST file bugs without these variables set."
6336 -
6337 - mycmakeargs+=(
6338 - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
6339 - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
6340 - )
6341 -
6342 - elif ! use latin1 ; then
6343 - mycmakeargs+=(
6344 - -DDEFAULT_CHARSET=utf8
6345 - -DDEFAULT_COLLATION=utf8_general_ci
6346 - )
6347 - else
6348 - mycmakeargs+=(
6349 - -DDEFAULT_CHARSET=latin1
6350 - -DDEFAULT_COLLATION=latin1_swedish_ci
6351 - )
6352 - fi
6353 - mycmakeargs+=(
6354 - -DEXTRA_CHARSETS=all
6355 - -DMYSQL_USER=mysql
6356 - -DDISABLE_SHARED=$(usex static YES NO)
6357 - -DWITH_DEBUG=$(usex debug)
6358 - -DWITH_EMBEDDED_SERVER=OFF
6359 - -DWITH_PROFILING=$(usex profiling)
6360 - )
6361 -
6362 - if use static; then
6363 - mycmakeargs+=( -DWITH_PIC=1 )
6364 - fi
6365 -
6366 - if use jemalloc || use tcmalloc ; then
6367 - mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
6368 - fi
6369 -
6370 - # Storage engines
6371 - mycmakeargs+=(
6372 - -DWITH_ARCHIVE_STORAGE_ENGINE=1
6373 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1
6374 - -DWITH_CSV_STORAGE_ENGINE=1
6375 - -DWITH_HEAP_STORAGE_ENGINE=1
6376 - -DWITH_INNOBASE_STORAGE_ENGINE=1
6377 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1
6378 - -DWITH_MYISAM_STORAGE_ENGINE=1
6379 - -DWITH_PARTITION_STORAGE_ENGINE=1
6380 - )
6381 -
6382 - else
6383 - mycmakeargs+=(
6384 - -DWITHOUT_SERVER=1
6385 - -DWITH_EMBEDDED_SERVER=OFF
6386 - -DEXTRA_CHARSETS=none
6387 - -DINSTALL_SQLBENCHDIR=
6388 - -DWITH_SYSTEMD=no
6389 - )
6390 - fi
6391 -
6392 - cmake_src_configure
6393 -}
6394 -
6395 -src_compile() {
6396 - cmake_src_compile
6397 -}
6398 -
6399 -# Official test instructions:
6400 -# USE='extraengine perl server' \
6401 -# FEATURES='test userpriv' \
6402 -# ebuild mariadb-X.X.XX.ebuild \
6403 -# digest clean package
6404 -src_test() {
6405 - _disable_test() {
6406 - local rawtestname bug reason
6407 - rawtestname="${1}" ; shift
6408 - bug="${1}" ; shift
6409 - reason="${@}"
6410 - ewarn "test '${rawtestname}' disabled: '${reason}' (BUG#${bug})"
6411 - echo "${rawtestname} : BUG#${bug} ${reason}" >> "${T}/disabled.def"
6412 - }
6413 -
6414 - local TESTDIR="${BUILD_DIR}/mysql-test"
6415 - local retstatus_unit
6416 - local retstatus_tests
6417 -
6418 - if ! use server ; then
6419 - einfo "Skipping server tests due to minimal build."
6420 - return 0
6421 - fi
6422 -
6423 - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
6424 -
6425 - # Run CTest (test-units)
6426 - cmake_src_test
6427 - retstatus_unit=$?
6428 -
6429 - # Ensure that parallel runs don't die
6430 - export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
6431 -
6432 - if [[ -z "${MTR_PARALLEL}" ]] ; then
6433 - local -x MTR_PARALLEL=$(makeopts_jobs)
6434 -
6435 - if [[ ${MTR_PARALLEL} -gt 4 ]] ; then
6436 - # Running multiple tests in parallel usually require higher ulimit
6437 - # and fs.aio-max-nr setting. In addition, tests like main.multi_update
6438 - # are known to hit timeout when system is busy.
6439 - # To avoid test failure we will limit MTR_PARALLEL to 4 instead of
6440 - # using "auto".
6441 - local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})"
6442 - info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!"
6443 - einfo "${info_msg}"
6444 - unset info_msg
6445 - MTR_PARALLEL=4
6446 - fi
6447 - else
6448 - einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'"
6449 - fi
6450 -
6451 - # Try to increase file limits to increase test coverage
6452 - if ! ulimit -n 16500 1>/dev/null 2>&1 ; then
6453 - # Upper limit comes from parts.partition_* tests
6454 - ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager."
6455 -
6456 - if ! ulimit -n 4162 1>/dev/null 2>&1 ; then
6457 - # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)'
6458 - ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager."
6459 -
6460 - if ! ulimit -n 3000 1>/dev/null 2>&1 ; then
6461 - ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager."
6462 - else
6463 - einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)."
6464 - fi
6465 - else
6466 - einfo "Will run test suite with open file limit set to 4162 (medium test coverage)."
6467 - fi
6468 - else
6469 - einfo "Will run test suite with open file limit set to 16500 (best test coverage)."
6470 - fi
6471 -
6472 - # create directories because mysqladmin might run out of order
6473 - mkdir -p "${T}"/var-tests{,/log} || die
6474 -
6475 - cp "${S}"/mysql-test/unstable-tests "${T}/disabled.def" || die
6476 -
6477 - local -a disabled_tests
6478 - disabled_tests+=( "compat/oracle.plugin;0;Needs example plugin which Gentoo disables" )
6479 - disabled_tests+=( "main.explain_non_select;0;Sporadically failing test" )
6480 - disabled_tests+=( "main.func_time;0;Dependent on time test was written" )
6481 - disabled_tests+=( "main.plugin_auth;0;Needs client libraries built" )
6482 - disabled_tests+=( "main.stat_tables;0;Sporadically failing test" )
6483 - disabled_tests+=( "main.stat_tables_innodb;0;Sporadically failing test" )
6484 - disabled_tests+=( "mariabackup.*;0;Broken test suite" )
6485 - disabled_tests+=( "perfschema.nesting;23458;Known to be broken" )
6486 - disabled_tests+=( "plugins.auth_ed25519;0;Needs client libraries built" )
6487 - disabled_tests+=( "plugins.cracklib_password_check;0;False positive due to varying policies" )
6488 - disabled_tests+=( "plugins.two_password_validations;0;False positive due to varying policies" )
6489 - disabled_tests+=( "roles.acl_statistics;0;False positive due to a user count mismatch caused by previous test" )
6490 -
6491 - if ! use latin1 ; then
6492 - disabled_tests+=( "funcs_1.is_columns_mysql;0;Requires USE=latin1" )
6493 - disabled_tests+=( "main.information_schema;0;Requires USE=latin1" )
6494 - disabled_tests+=( "main.system_mysql_db;0;Requires USE=latin1" )
6495 - fi
6496 -
6497 - local test_infos_str test_infos_arr
6498 - for test_infos_str in "${disabled_tests[@]}" ; do
6499 - IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}"
6500 -
6501 - if [[ ${#test_infos_arr[@]} != 3 ]] ; then
6502 - die "Invalid test data set, not matching format: ${test_infos_str}"
6503 - fi
6504 -
6505 - _disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}"
6506 - done
6507 - unset test_infos_str test_infos_arr
6508 -
6509 - # run mysql-test tests
6510 - pushd "${TESTDIR}" &>/dev/null || die
6511 - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test-list="${T}/disabled.def"
6512 - retstatus_tests=$?
6513 -
6514 - popd &>/dev/null || die
6515 -
6516 - # Cleanup is important for these testcases.
6517 - pkill -9 -f "${S}/ndb" 2>/dev/null
6518 - pkill -9 -f "${S}/sql" 2>/dev/null
6519 -
6520 - local failures=""
6521 - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
6522 - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
6523 -
6524 - [[ -z "$failures" ]] || die "Test failures: $failures"
6525 - einfo "Tests successfully completed"
6526 -}
6527 -
6528 -src_install() {
6529 - cmake_src_install
6530 -
6531 - # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used
6532 - if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then
6533 - rm "${ED}/usr/include/mysql/server/private/config.h" || die
6534 - fi
6535 -
6536 - # Make sure the vars are correctly initialized
6537 - mysql_init_vars
6538 -
6539 - # Convenience links
6540 - einfo "Making Convenience links for mysqlcheck multi-call binary"
6541 - dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
6542 - dosym "mysqlcheck" "/usr/bin/mysqlrepair"
6543 - dosym "mysqlcheck" "/usr/bin/mysqloptimize"
6544 -
6545 - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
6546 - if [[ -d "${ED}/usr/data" ]] ; then
6547 - rm -Rf "${ED}/usr/data" || die
6548 - fi
6549 -
6550 - # Unless they explicitly specific USE=test, then do not install the
6551 - # testsuite. It DOES have a use to be installed, esp. when you want to do a
6552 - # validation of your database configuration after tuning it.
6553 - if ! use test ; then
6554 - rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
6555 - fi
6556 -
6557 - # Configuration stuff
6558 - einfo "Building default configuration ..."
6559 - insinto "${MY_SYSCONFDIR#${EPREFIX}}"
6560 - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
6561 - cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die
6562 - eprefixify "${TMPDIR}/my.cnf"
6563 - doins "${TMPDIR}/my.cnf"
6564 - insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d"
6565 - cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
6566 - eprefixify "${TMPDIR}/50-distro-client.cnf"
6567 - doins "${TMPDIR}/50-distro-client.cnf"
6568 -
6569 - if use server ; then
6570 - mycnf_src="my.cnf.distro-server"
6571 - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
6572 - "${FILESDIR}/${mycnf_src}" \
6573 - > "${TMPDIR}/my.cnf.ok" || die
6574 - if use prefix ; then
6575 - sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
6576 - "${TMPDIR}/my.cnf.ok" || die
6577 - fi
6578 - if use latin1 ; then
6579 - sed -i \
6580 - -e "/character-set/s|utf8|latin1|g" \
6581 - "${TMPDIR}/my.cnf.ok" || die
6582 - fi
6583 - eprefixify "${TMPDIR}/my.cnf.ok"
6584 - newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
6585 -
6586 - einfo "Including support files and sample configurations"
6587 - docinto "support-files"
6588 - local script
6589 - for script in \
6590 - "${S}"/support-files/magic
6591 - do
6592 - [[ -f "$script" ]] && dodoc "${script}"
6593 - done
6594 -
6595 - docinto "scripts"
6596 - for script in "${S}"/scripts/mysql* ; do
6597 - [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
6598 - done
6599 - # Manually install supporting files that conflict with other packages
6600 - # but are needed for galera and initial installation
6601 - exeinto /usr/libexec/mariadb
6602 - doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror"
6603 -
6604 - if use pam ; then
6605 - keepdir /usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir
6606 - fi
6607 - fi
6608 -
6609 - # Remove mytop if perl is not selected
6610 - if [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl ; then
6611 - rm -f "${ED}/usr/bin/mytop" || die
6612 - fi
6613 -
6614 - # Fix a dangling symlink when galera is not built
6615 - if [[ -L "${ED}/usr/bin/wsrep_sst_rsync_wan" ]] && ! use galera ; then
6616 - rm "${ED}/usr/bin/wsrep_sst_rsync_wan" || die
6617 - fi
6618 -
6619 - # Remove broken SST scripts that are incompatible
6620 - local scriptremove
6621 - for scriptremove in wsrep_sst_xtrabackup wsrep_sst_xtrabackup-v2 ; do
6622 - if [[ -e "${ED}/usr/bin/${scriptremove}" ]] ; then
6623 - rm "${ED}/usr/bin/${scriptremove}" || die
6624 - fi
6625 - done
6626 -}
6627 -
6628 -pkg_preinst() {
6629 - java-pkg-opt-2_pkg_preinst
6630 -}
6631 -
6632 -pkg_postinst() {
6633 - # Make sure the vars are correctly initialized
6634 - mysql_init_vars
6635 -
6636 - # Create log directory securely if it does not exist
6637 - [[ -d "${ROOT}/${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}/${MY_LOGDIR}"
6638 -
6639 - if use server ; then
6640 - if use pam; then
6641 - einfo
6642 - elog "This install includes the PAM authentication plugin."
6643 - elog "To activate and configure the PAM plugin, please read:"
6644 - elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/"
6645 - einfo
6646 - chown mysql:mysql "${EROOT}/usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir" || die
6647 - fi
6648 -
6649 - if [[ -z "${REPLACING_VERSIONS}" ]] ; then
6650 - einfo
6651 - elog "You might want to run:"
6652 - elog "\"emerge --config =${CATEGORY}/${PF}\""
6653 - elog "if this is a new install."
6654 - elog
6655 - elog "If you are switching server implentations, you should run the"
6656 - elog "mysql_upgrade tool."
6657 - einfo
6658 - else
6659 - einfo
6660 - elog "If you are upgrading major versions, you should run the"
6661 - elog "mysql_upgrade tool."
6662 - einfo
6663 - fi
6664 -
6665 - if use galera ; then
6666 - einfo
6667 - elog "Be sure to edit the my.cnf file to activate your cluster settings."
6668 - elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
6669 - elog "The first time the cluster is activated, you should add"
6670 - elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
6671 - elog "This option should then be removed for subsequent starts."
6672 - einfo
6673 - if [[ -n "${REPLACING_VERSIONS}" ]] ; then
6674 - local rver
6675 - for rver in ${REPLACING_VERSIONS} ; do
6676 - if ver_test "${rver}" -lt "10.4.0" ; then
6677 - ewarn "Upgrading galera from a previous version requires admin restart of the entire cluster."
6678 - ewarn "Please refer to https://mariadb.com/kb/en/library/changes-improvements-in-mariadb-104/#galera-4"
6679 - ewarn "for more information"
6680 - fi
6681 - done
6682 - fi
6683 - fi
6684 - fi
6685 -
6686 - # Note about configuration change
6687 - einfo
6688 - elog "This version of mariadb reorganizes the configuration from a single my.cnf"
6689 - elog "to several files in /etc/mysql/${PN}.d."
6690 - elog "Please backup any changes you made to /etc/mysql/my.cnf"
6691 - elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension."
6692 - elog "You may have as many files as needed and they are read alphabetically."
6693 - elog "Be sure the options have the appropriate section headers, i.e. [mysqld]."
6694 - einfo
6695 -}
6696 -
6697 -pkg_config() {
6698 - _getoptval() {
6699 - local mypd="${EROOT}"/usr/libexec/mariadb/my_print_defaults
6700 - local section="$1"
6701 - local flag="--${2}="
6702 - local extra_options="${3}"
6703 - "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp"
6704 - }
6705 - local old_MY_DATADIR="${MY_DATADIR}"
6706 - local old_HOME="${HOME}"
6707 - # my_print_defaults needs to read stuff in $HOME/.my.cnf
6708 - export HOME=${EPREFIX}/root
6709 -
6710 - # Make sure the vars are correctly initialized
6711 - mysql_init_vars
6712 -
6713 - [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
6714 - if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then
6715 - die "Minimal builds do NOT include the MySQL server"
6716 - fi
6717 -
6718 - if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then
6719 - local MY_DATADIR_s="${ROOT}/${MY_DATADIR}"
6720 - MY_DATADIR_s="${MY_DATADIR_s%%/}"
6721 - local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}"
6722 - old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
6723 -
6724 - if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then
6725 - if [[ -d "${MY_DATADIR_s}" ]]; then
6726 - ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
6727 - ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
6728 - else
6729 - elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
6730 - mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
6731 - || die "Moving MY_DATADIR failed"
6732 - fi
6733 - else
6734 - ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
6735 - if [[ -d "${MY_DATADIR_s}" ]]; then
6736 - ewarn "Attempting to use ${MY_DATADIR_s}"
6737 - else
6738 - eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
6739 - die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
6740 - fi
6741 - fi
6742 - fi
6743 -
6744 - local pwd1="a"
6745 - local pwd2="b"
6746 - local maxtry=15
6747 -
6748 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
6749 - local tmp_mysqld_password_source=
6750 -
6751 - for tmp_mysqld_password_source in mysql client; do
6752 - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
6753 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
6754 - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then
6755 - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then
6756 - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
6757 - MYSQL_ROOT_PASSWORD=
6758 - continue
6759 - fi
6760 -
6761 - einfo "Found password in '${tmp_mysqld_password_source}' section!"
6762 - break
6763 - fi
6764 - done
6765 -
6766 - # Sometimes --show is required to display passwords in some implementations of my_print_defaults
6767 - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then
6768 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
6769 - fi
6770 -
6771 - unset tmp_mysqld_password_source
6772 - fi
6773 - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir | tail -n1)"
6774 - # These are dir+prefix
6775 - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log | tail -n1)"
6776 - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
6777 - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin | tail -n1)"
6778 - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
6779 -
6780 - if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then
6781 - einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
6782 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR"
6783 - fi
6784 - if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then
6785 - einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
6786 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN"
6787 - fi
6788 - if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then
6789 - einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
6790 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG"
6791 - fi
6792 -
6793 - if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then
6794 - ewarn "You have already a MySQL database in place."
6795 - ewarn "(${ROOT}/${MY_DATADIR}/*)"
6796 - ewarn "Please rename or delete it if you wish to replace it."
6797 - die "MySQL database already exists!"
6798 - fi
6799 -
6800 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
6801 - # localhost. Also causes weird failures.
6802 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
6803 -
6804 - if [[ -z "${MYSQL_ROOT_PASSWORD}" ]]; then
6805 -
6806 - einfo "Please provide a password for the mysql 'root'@'localhost' user now"
6807 - einfo "or through the ${HOME}/.my.cnf file."
6808 - ewarn "Avoid [\"'\\_%] characters in the password"
6809 - einfo "Not entering a password defaults to UNIX authentication"
6810 - read -rsp " >" pwd1 ; echo
6811 -
6812 - if [[ -n "${pwd1}" ]] ; then
6813 - einfo "Retype the password"
6814 - read -rsp " >" pwd2 ; echo
6815 -
6816 - if [[ "x$pwd1" != "x$pwd2" ]] ; then
6817 - die "Passwords are not the same"
6818 - fi
6819 -
6820 - MYSQL_ROOT_PASSWORD="${pwd1}"
6821 - fi
6822 -
6823 - unset pwd1 pwd2
6824 - fi
6825 -
6826 - local options
6827 - local sqltmp="$(emktemp)"
6828 -
6829 - # Fix bug 446200. Don't reference host my.cnf, needs to come first,
6830 - # see https://bugs.mysql.com/bug.php?id=31312
6831 - use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
6832 -
6833 - # Figure out which options we need to disable to do the setup
6834 - local helpfile="${TMPDIR}/mysqld-help"
6835 - "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
6836 - for opt in host-cache name-resolve networking slave-start \
6837 - federated ssl log-bin relay-log slow-query-log external-locking \
6838 - log-slave-updates \
6839 - ; do
6840 - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
6841 - egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
6842 - done
6843 -
6844 - einfo "Creating the mysql database and setting proper permissions on it ..."
6845 -
6846 - # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
6847 - PID_DIR="${EROOT}/var/run/mysqld"
6848 - if [[ ! -d "${PID_DIR}" ]]; then
6849 - install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
6850 - fi
6851 -
6852 - if [[ ! -d "${MY_DATADIR}" ]]; then
6853 - install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory"
6854 - fi
6855 -
6856 - pushd "${TMPDIR}" &>/dev/null || die
6857 -
6858 - # Filling timezones, see
6859 - # https://dev.mysql.com/doc/mysql/en/time-zone-support.html
6860 - "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null
6861 -
6862 - local cmd=( "${EROOT}/usr/share/mariadb/scripts/mysql_install_db" )
6863 - [[ -f "${cmd}" ]] || cmd=( "${EROOT}/usr/bin/mysql_install_db" )
6864 - cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" )
6865 - einfo "Command: ${cmd[*]}"
6866 - su -s /bin/sh -c "${cmd[*]}" mysql \
6867 - >"${TMPDIR}"/mysql_install_db.log 2>&1
6868 - if [[ $? -ne 0 ]]; then
6869 - grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2
6870 - die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log"
6871 - fi
6872 - popd &>/dev/null || die
6873 - [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \
6874 - || die "MySQL databases not installed"
6875 -
6876 - if [[ -z ${sqltmp} && -z ${MYSQL_ROOT_PASSWORD} ]] ; then
6877 - einfo "Done"
6878 - exit 0
6879 - fi
6880 -
6881 - use prefix || options="${options} --user=mysql"
6882 -
6883 - local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock"
6884 - local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid"
6885 - local mysqld="${EROOT}/usr/sbin/mysqld \
6886 - ${options} \
6887 - --log-warnings=0 \
6888 - --basedir=${EROOT}/usr \
6889 - --datadir=${ROOT}/${MY_DATADIR} \
6890 - --max_allowed_packet=8M \
6891 - --net_buffer_length=16K \
6892 - --socket=${socket} \
6893 - --pid-file=${pidfile} \
6894 - --tmpdir=${ROOT}/${MYSQL_TMPDIR}"
6895 - #einfo "About to start mysqld: ${mysqld}"
6896 - ebegin "Starting mysqld"
6897 - einfo "Command ${mysqld}"
6898 - ${mysqld} &
6899 - rc=$?
6900 - while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
6901 - maxtry=$((${maxtry}-1))
6902 - echo -n "."
6903 - sleep 1
6904 - done
6905 - eend $rc
6906 -
6907 - if ! [[ -S "${socket}" ]]; then
6908 - die "Completely failed to start up mysqld with: ${mysqld}"
6909 - fi
6910 -
6911 - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then
6912 - ebegin "Setting root password"
6913 - # Do this from memory, as we don't want clear text passwords in temp files
6914 - local sql="SET PASSWORD FOR 'root'@'localhost' = PASSWORD('${MYSQL_ROOT_PASSWORD}')"
6915 - "${EROOT}/usr/bin/mysql" \
6916 - "--socket=${socket}" \
6917 - -hlocalhost \
6918 - -e "${sql}"
6919 - unset sql
6920 - eend $?
6921 - fi
6922 -
6923 - if [[ -n "${sqltmp}" ]] ; then
6924 - ebegin "Loading \"zoneinfo\", this step may require a few seconds"
6925 - "${EROOT}/usr/bin/mysql" \
6926 - "--socket=${socket}" \
6927 - -hlocalhost \
6928 - -uroot \
6929 - --password="${MYSQL_ROOT_PASSWORD}" \
6930 - mysql < "${sqltmp}"
6931 - rc=$?
6932 - eend $?
6933 - [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!"
6934 - fi
6935 -
6936 - # Stop the server and cleanup
6937 - einfo "Stopping the server ..."
6938 - kill $(< "${pidfile}" )
6939 - rm -f "${sqltmp}"
6940 - wait %1
6941 - einfo "Done"
6942 -}