1 |
commit: 6404593eeed8f9d42ab557edcbf2a391fabac056 |
2 |
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat May 23 10:09:14 2020 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat May 23 12:25:19 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6404593e |
7 |
|
8 |
dev-db/mariadb: bump to v10.4.13 |
9 |
|
10 |
Closes: https://bugs.gentoo.org/722766 |
11 |
Package-Manager: Portage-2.3.99, Repoman-2.3.22 |
12 |
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org> |
13 |
|
14 |
dev-db/mariadb/Manifest | 2 + |
15 |
dev-db/mariadb/mariadb-10.4.13.ebuild | 1035 +++++++++++++++++++++++++++++++++ |
16 |
2 files changed, 1037 insertions(+) |
17 |
|
18 |
diff --git a/dev-db/mariadb/Manifest b/dev-db/mariadb/Manifest |
19 |
index 8f98e9801a8..ab8322b064d 100644 |
20 |
--- a/dev-db/mariadb/Manifest |
21 |
+++ b/dev-db/mariadb/Manifest |
22 |
@@ -8,6 +8,8 @@ DIST mariadb-10.3.20.tar.gz 71990355 BLAKE2B f950f0eb836751d0eebb9ae561fe3b5aefa |
23 |
DIST mariadb-10.3.22.tar.gz 72050820 BLAKE2B 9e08f1360f8db2c5f466d4f6f967145286412a5598c7de8828eb8f8f3dd113b38f039c38335f9251f3bba19c67c5f62d57808eabc57480338b64dae0c5588774 SHA512 57a6551b8939f54742963202d50a537e69e8ab9b2dca42ce3d2a09c0f7af368fded71f36af26f6cbd956d54fe43853981ba8fe28b7a3ba97c7d52ea4a0d233f6 |
24 |
DIST mariadb-10.4.10.tar.gz 78352896 BLAKE2B c0e448fba455feb9385b7d57e1a727e84eaf4cfa52ce0dbd6ff062aa0b5abc42005680fb185416d04fbd7bb62d9bbd6c93e4cb77b145418cf6be92747f8b1c2a SHA512 4a9b9a37bc3a273de4bd781dac3636256364dae6efbba45765d6b28995da3d64e180422cd10418d1c7acd7fd8843fe2a2638c07e0f56b0c09170c58812cc6b71 |
25 |
DIST mariadb-10.4.12.tar.gz 79120835 BLAKE2B 1c511e788f8ddc9b9d2e580b29c380ada85d7cc46febe6a6bec626fd6239e4f50480b7a31dcd7e1a9474c6ed9626a910e996257ac8366646a22decc0226c45f0 SHA512 518dae18c04a1f7fcc6fd4d2dfbfbfbdf5e83e72ca41e66e1074328df8d92ab41b458e6a9973771419ac09a7348f264f158916cd198c335085d6e823e707bbc6 |
26 |
+DIST mariadb-10.4.13-patches-01.tar.xz 5140 BLAKE2B 76bec85715d03cf17d54994205f0a5e452c5bad0353c2a14d6bdad92f0771b54b54753856709b8379fe91efbff48a610414b54b891dd17eabda043a5059e60e7 SHA512 923c54850b1e55ed60988133d615b80aecce3e73c7914b8b02aeea1c61c154ba5ff2ae3575f24d7341b6bf6de9aae2f5751fb951a5a88eafbea7db254da2d4fe |
27 |
+DIST mariadb-10.4.13.tar.gz 80608459 BLAKE2B e9ada14da6ec7492311068549a5b6e5a66e1177312013b25472c084a21fbace543ec43b47f2e12190d45432648d508f311198521f42359561f8d75ea60f98205 SHA512 68919ceffb3d4afdd0d94daa77439a954c82ce4e08fbe06044fc397940eeb88a39ec75932cbd08ff26ef3cf7636fdb779947cda5b2764aa1fd888be19c44b566 |
28 |
DIST mariadb-5.5.66.tar.gz 45962591 BLAKE2B 41befba24abec2af876168a11fc205d328c137baa49e5e521787898e4b973d1dc548ef459228811caa99fa3c2b7a9fe96f3eb7a04bf62f0bb20966e4ffd2ea9b SHA512 403f3bc67018e01eb2277a88d3a7ac673d50df8f7a67607f9d14e3167d1bdd4ca202983df69c97688ff51edbd6d6b43af3541c75e968d1d01713a7b6495e4c8c |
29 |
DIST mariadb-5.5.67.tar.gz 45971908 BLAKE2B 494fdc5d13c3560b074514f30a828e6689b820a1eefc0d0ec67f00a9dced6f4d3c305ed81ad39dddbb07659ccfbab418900f822baf502067d706ba84d2e7fd78 SHA512 494b2b0d863e2fed6f02f8d61134a645aa113bb0e17ba08b304350dfa974f6fce2a2fcc231fb413872156f70f08fbd2604f58d642fffe085f3b093176a3e68c9 |
30 |
DIST mysql-extras-20180809-1700Z.tar.bz2 322999 BLAKE2B 8b5feb32085dc35b2f68dae985b2d266c4eaa0e956b490050a2df04bbff99bf8623b67e75af9326d84e3ad625c4d86b0d21d23c9a96df5a0c9cd5ed730958970 SHA512 fbd7af9284bbf09d55f128361e7cc52d94f24ac491aac800cd6d61f2e444aeca66a4d5e6ae94c2fb4044e00cec9b232bae9a76a229f87f19d90b7aecf70792ec |
31 |
|
32 |
diff --git a/dev-db/mariadb/mariadb-10.4.13.ebuild b/dev-db/mariadb/mariadb-10.4.13.ebuild |
33 |
new file mode 100644 |
34 |
index 00000000000..ac886d21e77 |
35 |
--- /dev/null |
36 |
+++ b/dev-db/mariadb/mariadb-10.4.13.ebuild |
37 |
@@ -0,0 +1,1035 @@ |
38 |
+# Copyright 1999-2020 Gentoo Authors |
39 |
+# Distributed under the terms of the GNU General Public License v2 |
40 |
+ |
41 |
+EAPI="7" |
42 |
+SUBSLOT="18" |
43 |
+ |
44 |
+JAVA_PKG_OPT_USE="jdbc" |
45 |
+ |
46 |
+inherit eutils systemd flag-o-matic prefix toolchain-funcs \ |
47 |
+ multiprocessing java-pkg-opt-2 cmake |
48 |
+ |
49 |
+# Patch version |
50 |
+PATCH_SET="https://dev.gentoo.org/~whissi/dist/${PN}/${PN}-10.4.13-patches-01.tar.xz" |
51 |
+ |
52 |
+SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz |
53 |
+ ${PATCH_SET}" |
54 |
+ |
55 |
+HOMEPAGE="https://mariadb.org/" |
56 |
+DESCRIPTION="An enhanced, drop-in replacement for MySQL" |
57 |
+LICENSE="GPL-2 LGPL-2.1+" |
58 |
+SLOT="0/${SUBSLOT:-0}" |
59 |
+IUSE="+backup bindist cracklib debug extraengine galera innodb-lz4 |
60 |
+ innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 libressl mroonga |
61 |
+ numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx |
62 |
+ sst-rsync sst-mariabackup static systemd systemtap tcmalloc |
63 |
+ test tokudb xml yassl" |
64 |
+ |
65 |
+# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests |
66 |
+RESTRICT="!bindist? ( bindist ) libressl? ( test ) !test? ( test )" |
67 |
+ |
68 |
+REQUIRED_USE="jdbc? ( extraengine server !static ) |
69 |
+ server? ( tokudb? ( jemalloc !tcmalloc ) ) |
70 |
+ ?? ( tcmalloc jemalloc ) |
71 |
+ static? ( yassl !pam )" |
72 |
+ |
73 |
+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" |
74 |
+ |
75 |
+# Shorten the path because the socket path length must be shorter than 107 chars |
76 |
+# and we will run a mysql server during test phase |
77 |
+S="${WORKDIR}/mysql" |
78 |
+ |
79 |
+# Be warned, *DEPEND are version-dependant |
80 |
+# These are used for both runtime and compiletime |
81 |
+COMMON_DEPEND=" |
82 |
+ kernel_linux? ( |
83 |
+ sys-process/procps:0= |
84 |
+ dev-libs/libaio:0= |
85 |
+ ) |
86 |
+ >=sys-apps/sed-4 |
87 |
+ >=sys-apps/texinfo-4.7-r1 |
88 |
+ jemalloc? ( dev-libs/jemalloc:0= ) |
89 |
+ tcmalloc? ( dev-util/google-perftools:0= ) |
90 |
+ systemtap? ( >=dev-util/systemtap-1.3:0= ) |
91 |
+ >=sys-libs/zlib-1.2.3:0= |
92 |
+ kerberos? ( virtual/krb5 ) |
93 |
+ yassl? ( net-libs/gnutls:0= ) |
94 |
+ !yassl? ( |
95 |
+ !libressl? ( >=dev-libs/openssl-1.0.0:0= ) |
96 |
+ libressl? ( dev-libs/libressl:0= ) |
97 |
+ ) |
98 |
+ sys-libs/ncurses:0= |
99 |
+ !bindist? ( |
100 |
+ sys-libs/binutils-libs:0= |
101 |
+ >=sys-libs/readline-4.1:0= |
102 |
+ ) |
103 |
+ server? ( |
104 |
+ backup? ( app-arch/libarchive:0= ) |
105 |
+ cracklib? ( sys-libs/cracklib:0= ) |
106 |
+ extraengine? ( |
107 |
+ odbc? ( dev-db/unixODBC:0= ) |
108 |
+ xml? ( dev-libs/libxml2:2= ) |
109 |
+ ) |
110 |
+ innodb-lz4? ( app-arch/lz4 ) |
111 |
+ innodb-lzo? ( dev-libs/lzo ) |
112 |
+ innodb-snappy? ( app-arch/snappy ) |
113 |
+ mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 ) |
114 |
+ numa? ( sys-process/numactl ) |
115 |
+ oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= ) |
116 |
+ pam? ( sys-libs/pam:0= ) |
117 |
+ systemd? ( sys-apps/systemd:= ) |
118 |
+ tokudb? ( app-arch/snappy ) |
119 |
+ ) |
120 |
+ >=dev-libs/libpcre-8.41-r1:3= |
121 |
+" |
122 |
+BDEPEND="virtual/yacc |
123 |
+ || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) |
124 |
+" |
125 |
+DEPEND="static? ( sys-libs/ncurses[static-libs] ) |
126 |
+ server? ( |
127 |
+ extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) ) |
128 |
+ test? ( acct-group/mysql acct-user/mysql ) |
129 |
+ ) |
130 |
+ ${COMMON_DEPEND}" |
131 |
+RDEPEND="selinux? ( sec-policy/selinux-mysql ) |
132 |
+ !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster |
133 |
+ !<virtual/mysql-5.6-r11 |
134 |
+ !<virtual/libmysqlclient-18-r1 |
135 |
+ ${COMMON_DEPEND} |
136 |
+ server? ( |
137 |
+ galera? ( |
138 |
+ sys-apps/iproute2 |
139 |
+ =sys-cluster/galera-26* |
140 |
+ sst-rsync? ( sys-process/lsof ) |
141 |
+ sst-mariabackup? ( net-misc/socat[ssl] ) |
142 |
+ ) |
143 |
+ !prefix? ( dev-db/mysql-init-scripts acct-group/mysql acct-user/mysql ) |
144 |
+ extraengine? ( jdbc? ( >=virtual/jre-1.6 ) ) |
145 |
+ ) |
146 |
+ perl? ( |
147 |
+ !dev-db/mytop |
148 |
+ virtual/perl-Getopt-Long |
149 |
+ dev-perl/TermReadKey |
150 |
+ virtual/perl-Term-ANSIColor |
151 |
+ virtual/perl-Time-HiRes |
152 |
+ ) |
153 |
+" |
154 |
+# For other stuff to bring us in |
155 |
+# dev-perl/DBD-mysql is needed by some scripts installed by MySQL |
156 |
+PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 ) |
157 |
+ server? ( ~virtual/mysql-5.6[static=] )" |
158 |
+ |
159 |
+mysql_init_vars() { |
160 |
+ MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"} |
161 |
+ MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} |
162 |
+ MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} |
163 |
+ MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"} |
164 |
+ |
165 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
166 |
+ MY_DATADIR="" |
167 |
+ if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then |
168 |
+ MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \ |
169 |
+ | sed -ne '/datadir/s|^--datadir=||p' \ |
170 |
+ | tail -n1) |
171 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
172 |
+ MY_DATADIR=$(grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ |
173 |
+ | sed -e 's/.*=\s*//' \ |
174 |
+ | tail -n1) |
175 |
+ fi |
176 |
+ fi |
177 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
178 |
+ MY_DATADIR="${MY_LOCALSTATEDIR}" |
179 |
+ einfo "Using default MY_DATADIR" |
180 |
+ fi |
181 |
+ elog "MySQL MY_DATADIR is ${MY_DATADIR}" |
182 |
+ |
183 |
+ if [[ -z "${PREVIOUS_DATADIR}" ]] ; then |
184 |
+ if [[ -e "${MY_DATADIR}" ]] ; then |
185 |
+ # If you get this and you're wondering about it, see bug #207636 |
186 |
+ elog "MySQL datadir found in ${MY_DATADIR}" |
187 |
+ elog "A new one will not be created." |
188 |
+ PREVIOUS_DATADIR="yes" |
189 |
+ else |
190 |
+ PREVIOUS_DATADIR="no" |
191 |
+ fi |
192 |
+ export PREVIOUS_DATADIR |
193 |
+ fi |
194 |
+ else |
195 |
+ if [[ ${EBUILD_PHASE} == "config" ]]; then |
196 |
+ local new_MY_DATADIR |
197 |
+ new_MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \ |
198 |
+ | sed -ne '/datadir/s|^--datadir=||p' \ |
199 |
+ | tail -n1) |
200 |
+ |
201 |
+ if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then |
202 |
+ ewarn "MySQL MY_DATADIR has changed" |
203 |
+ ewarn "from ${MY_DATADIR}" |
204 |
+ ewarn "to ${new_MY_DATADIR}" |
205 |
+ MY_DATADIR="${new_MY_DATADIR}" |
206 |
+ fi |
207 |
+ fi |
208 |
+ fi |
209 |
+ |
210 |
+ export MY_SHAREDSTATEDIR MY_SYSCONFDIR |
211 |
+ export MY_LOCALSTATEDIR MY_LOGDIR |
212 |
+ export MY_DATADIR |
213 |
+} |
214 |
+ |
215 |
+pkg_setup() { |
216 |
+ if [[ ${MERGE_TYPE} != binary ]] ; then |
217 |
+ local GCC_MAJOR_SET=$(gcc-major-version) |
218 |
+ local GCC_MINOR_SET=$(gcc-minor-version) |
219 |
+ |
220 |
+ if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \ |
221 |
+ ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then |
222 |
+ eerror "${PN} with tokudb needs to be built with gcc-4.7 or later." |
223 |
+ eerror "Please use gcc-config to switch to gcc-4.7 or later version." |
224 |
+ die |
225 |
+ fi |
226 |
+ |
227 |
+ # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on |
228 |
+ # non x86{,_64} arches |
229 |
+ if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \ |
230 |
+ ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then |
231 |
+ eerror "${PN} needs to be built with gcc-4.7 or later." |
232 |
+ eerror "Please use gcc-config to switch to gcc-4.7 or later version." |
233 |
+ die |
234 |
+ fi |
235 |
+ |
236 |
+ if has test ${FEATURES} ; then |
237 |
+ # Bug #213475 - MySQL _will_ object strenuously if your machine is named |
238 |
+ # localhost. Also causes weird failures. |
239 |
+ [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
240 |
+ |
241 |
+ if ! has userpriv ${FEATURES} ; then |
242 |
+ die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
243 |
+ fi |
244 |
+ fi |
245 |
+ fi |
246 |
+ |
247 |
+ java-pkg-opt-2_pkg_setup |
248 |
+} |
249 |
+ |
250 |
+src_unpack() { |
251 |
+ unpack ${A} |
252 |
+ |
253 |
+ mv -f "${WORKDIR}/${P/_rc/}" "${S}" || die |
254 |
+} |
255 |
+ |
256 |
+src_prepare() { |
257 |
+ eapply "${WORKDIR}"/mariadb-patches |
258 |
+ |
259 |
+ eapply_user |
260 |
+ |
261 |
+ _disable_plugin() { |
262 |
+ echo > "${S}/plugin/${1}/CMakeLists.txt" || die |
263 |
+ } |
264 |
+ _disable_engine() { |
265 |
+ echo > "${S}/storage/${1}/CMakeLists.txt" || die |
266 |
+ } |
267 |
+ |
268 |
+ if use jemalloc; then |
269 |
+ echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" |
270 |
+ elif use tcmalloc; then |
271 |
+ echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" |
272 |
+ fi |
273 |
+ |
274 |
+ # Don't build bundled xz-utils for tokudb |
275 |
+ echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die |
276 |
+ sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die |
277 |
+ sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die |
278 |
+ |
279 |
+ local plugin |
280 |
+ local server_plugins=( handler_socket auth_socket feedback metadata_lock_info |
281 |
+ locale_info qc_info server_audit sql_errlog auth_ed25519 ) |
282 |
+ local test_plugins=( audit_null auth_examples daemon_example fulltext |
283 |
+ debug_key_management example_key_management versioning ) |
284 |
+ if ! use server; then # These plugins are for the server |
285 |
+ for plugin in "${server_plugins[@]}" ; do |
286 |
+ _disable_plugin "${plugin}" |
287 |
+ done |
288 |
+ fi |
289 |
+ |
290 |
+ if ! use test; then # These plugins are only used during testing |
291 |
+ for plugin in "${test_plugins[@]}" ; do |
292 |
+ _disable_plugin "${plugin}" |
293 |
+ done |
294 |
+ _disable_engine test_sql_discovery |
295 |
+ echo > "${S}/plugin/auth_pam/testing/CMakeLists.txt" || die |
296 |
+ fi |
297 |
+ |
298 |
+ _disable_engine example |
299 |
+ |
300 |
+ if ! use oqgraph ; then # avoids extra library checks |
301 |
+ _disable_engine oqgraph |
302 |
+ fi |
303 |
+ |
304 |
+ if use mroonga ; then |
305 |
+ # Remove the bundled groonga |
306 |
+ # There is no CMake flag, it simply checks for existance |
307 |
+ rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga" |
308 |
+ else |
309 |
+ _disable_engine mroonga |
310 |
+ fi |
311 |
+ |
312 |
+ # Fix static bindings in galera replication |
313 |
+ sed -i -e 's~add_library(wsrep_api_v26$~add_library(wsrep_api_v26 STATIC~' \ |
314 |
+ "${S}"/wsrep-lib/wsrep-API/CMakeLists.txt || die |
315 |
+ sed -i -e 's~add_library(wsrep-lib$~add_library(wsrep-lib STATIC~' \ |
316 |
+ "${S}"/wsrep-lib/src/CMakeLists.txt || die |
317 |
+ |
318 |
+ # Don't clash with dev-db/mysql-connector-c |
319 |
+ sed -i -e 's/ my_print_defaults.1//' \ |
320 |
+ -e 's/ perror.1//' \ |
321 |
+ "${S}"/man/CMakeLists.txt || die |
322 |
+ |
323 |
+ # Fix galera_recovery.sh script |
324 |
+ sed -i -e "s~@bindir@/my_print_defaults~${EPREFIX}/usr/libexec/mariadb/my_print_defaults~" \ |
325 |
+ scripts/galera_recovery.sh || die |
326 |
+ |
327 |
+ sed -i -e 's~ \$basedir/lib/\*/mariadb19/plugin~~' \ |
328 |
+ "${S}"/scripts/mysql_install_db.sh || die |
329 |
+ |
330 |
+ cmake_src_prepare |
331 |
+ java-pkg-opt-2_src_prepare |
332 |
+} |
333 |
+ |
334 |
+src_configure() { |
335 |
+ # bug 508724 mariadb cannot use ld.gold |
336 |
+ tc-ld-disable-gold |
337 |
+ # Bug #114895, bug #110149 |
338 |
+ filter-flags "-O" "-O[01]" |
339 |
+ |
340 |
+ # It fails on alpha without this |
341 |
+ use alpha && append-ldflags "-Wl,--no-relax" |
342 |
+ |
343 |
+ append-cxxflags -felide-constructors |
344 |
+ |
345 |
+ # bug #283926, with GCC4.4, this is required to get correct behavior. |
346 |
+ append-flags -fno-strict-aliasing |
347 |
+ |
348 |
+ CMAKE_BUILD_TYPE="RelWithDebInfo" |
349 |
+ |
350 |
+ # debug hack wrt #497532 |
351 |
+ mycmakeargs=( |
352 |
+ -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
353 |
+ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
354 |
+ -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql" |
355 |
+ -DSYSCONFDIR="${EPREFIX}/etc/mysql" |
356 |
+ -DINSTALL_BINDIR=bin |
357 |
+ -DINSTALL_DOCDIR=share/doc/${PF} |
358 |
+ -DINSTALL_DOCREADMEDIR=share/doc/${PF} |
359 |
+ -DINSTALL_INCLUDEDIR=include/mysql |
360 |
+ -DINSTALL_INFODIR=share/info |
361 |
+ -DINSTALL_LIBDIR=$(get_libdir) |
362 |
+ -DINSTALL_MANDIR=share/man |
363 |
+ -DINSTALL_MYSQLSHAREDIR=share/mariadb |
364 |
+ -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin |
365 |
+ -DINSTALL_SCRIPTDIR=share/mariadb/scripts |
366 |
+ -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql" |
367 |
+ -DINSTALL_SBINDIR=sbin |
368 |
+ -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb" |
369 |
+ -DWITH_COMMENT="Gentoo Linux ${PF}" |
370 |
+ -DWITH_UNIT_TESTS=$(usex test ON OFF) |
371 |
+ -DWITH_LIBEDIT=0 |
372 |
+ -DWITH_ZLIB=system |
373 |
+ -DWITHOUT_LIBWRAP=1 |
374 |
+ -DENABLED_LOCAL_INFILE=1 |
375 |
+ -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock" |
376 |
+ -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock" |
377 |
+ -DWITH_DEFAULT_COMPILER_OPTIONS=0 |
378 |
+ -DWITH_DEFAULT_FEATURE_SET=0 |
379 |
+ -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)" |
380 |
+ # The build forces this to be defined when cross-compiling. We pass it |
381 |
+ # all the time for simplicity and to make sure it is actually correct. |
382 |
+ -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) |
383 |
+ -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)" |
384 |
+ -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) |
385 |
+ -DAUTH_GSSAPI_PLUGIN_TYPE=$(usex kerberos DYNAMIC OFF) |
386 |
+ -DCONC_WITH_EXTERNAL_ZLIB=YES |
387 |
+ -DWITH_EXTERNAL_ZLIB=YES |
388 |
+ -DSUFFIX_INSTALL_DIR="" |
389 |
+ -DWITH_UNITTEST=OFF |
390 |
+ -DWITHOUT_CLIENTLIBS=YES |
391 |
+ -DCLIENT_PLUGIN_DIALOG=OFF |
392 |
+ -DCLIENT_PLUGIN_AUTH_GSSAPI_CLIENT=OFF |
393 |
+ -DCLIENT_PLUGIN_CLIENT_ED25519=OFF |
394 |
+ -DCLIENT_PLUGIN_MYSQL_CLEAR_PASSWORD=STATIC |
395 |
+ -DCLIENT_PLUGIN_CACHING_SHA2_PASSWORD=OFF |
396 |
+ ) |
397 |
+ if use test ; then |
398 |
+ mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test ) |
399 |
+ else |
400 |
+ mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' ) |
401 |
+ fi |
402 |
+ |
403 |
+ if ! use yassl ; then |
404 |
+ mycmakeargs+=( -DWITH_SSL=system -DCLIENT_PLUGIN_SHA256_PASSWORD=STATIC ) |
405 |
+ else |
406 |
+ mycmakeargs+=( -DWITH_SSL=bundled ) |
407 |
+ fi |
408 |
+ |
409 |
+ # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION |
410 |
+ mycmakeargs+=( |
411 |
+ -DWITH_READLINE=$(usex bindist 1 0) |
412 |
+ -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1) |
413 |
+ -DENABLE_DTRACE=$(usex systemtap) |
414 |
+ ) |
415 |
+ |
416 |
+ if use server ; then |
417 |
+ |
418 |
+ # Federated{,X} must be treated special otherwise they will not be built as plugins |
419 |
+ if ! use extraengine ; then |
420 |
+ mycmakeargs+=( |
421 |
+ -DPLUGIN_FEDERATED=NO |
422 |
+ -DPLUGIN_FEDERATEDX=NO ) |
423 |
+ fi |
424 |
+ |
425 |
+ mycmakeargs+=( |
426 |
+ -DWITH_PCRE=system |
427 |
+ -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO) |
428 |
+ -DPLUGIN_SPHINX=$(usex sphinx YES NO) |
429 |
+ -DPLUGIN_TOKUDB=$(usex tokudb YES NO) |
430 |
+ -DPLUGIN_AUTH_PAM=$(usex pam YES NO) |
431 |
+ -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO) |
432 |
+ -DPLUGIN_CASSANDRA=NO |
433 |
+ -DPLUGIN_SEQUENCE=$(usex extraengine YES NO) |
434 |
+ -DPLUGIN_SPIDER=$(usex extraengine YES NO) |
435 |
+ -DPLUGIN_CONNECT=$(usex extraengine YES NO) |
436 |
+ -DCONNECT_WITH_MYSQL=1 |
437 |
+ -DCONNECT_WITH_LIBXML2=$(usex xml) |
438 |
+ -DCONNECT_WITH_ODBC=$(usex odbc) |
439 |
+ -DCONNECT_WITH_JDBC=$(usex jdbc) |
440 |
+ # Build failure and autodep wrt bug 639144 |
441 |
+ -DCONNECT_WITH_MONGO=OFF |
442 |
+ -DWITH_WSREP=$(usex galera) |
443 |
+ -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF) |
444 |
+ -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF) |
445 |
+ -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF) |
446 |
+ -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO) |
447 |
+ -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) |
448 |
+ -DWITH_MARIABACKUP=$(usex backup ON OFF) |
449 |
+ -DWITH_LIBARCHIVE=$(usex backup ON OFF) |
450 |
+ -DINSTALL_SQLBENCHDIR="" |
451 |
+ -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO) |
452 |
+ # systemd is only linked to for server notification |
453 |
+ -DWITH_SYSTEMD=$(usex systemd yes no) |
454 |
+ -DWITH_NUMA=$(usex numa ON OFF) |
455 |
+ ) |
456 |
+ |
457 |
+ # Workaround for MDEV-14524 |
458 |
+ use tokudb && mycmakeargs+=( -DTOKUDB_OK=1 ) |
459 |
+ |
460 |
+ if use test ; then |
461 |
+ # This is needed for the new client lib which tests a real, open server |
462 |
+ mycmakeargs+=( -DSKIP_TESTS=ON ) |
463 |
+ fi |
464 |
+ |
465 |
+ if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then |
466 |
+ ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" |
467 |
+ ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." |
468 |
+ ewarn "You MUST file bugs without these variables set." |
469 |
+ |
470 |
+ mycmakeargs+=( |
471 |
+ -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} |
472 |
+ -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} |
473 |
+ ) |
474 |
+ |
475 |
+ elif ! use latin1 ; then |
476 |
+ mycmakeargs+=( |
477 |
+ -DDEFAULT_CHARSET=utf8 |
478 |
+ -DDEFAULT_COLLATION=utf8_general_ci |
479 |
+ ) |
480 |
+ else |
481 |
+ mycmakeargs+=( |
482 |
+ -DDEFAULT_CHARSET=latin1 |
483 |
+ -DDEFAULT_COLLATION=latin1_swedish_ci |
484 |
+ ) |
485 |
+ fi |
486 |
+ mycmakeargs+=( |
487 |
+ -DEXTRA_CHARSETS=all |
488 |
+ -DMYSQL_USER=mysql |
489 |
+ -DDISABLE_SHARED=$(usex static YES NO) |
490 |
+ -DWITH_DEBUG=$(usex debug) |
491 |
+ -DWITH_EMBEDDED_SERVER=OFF |
492 |
+ -DWITH_PROFILING=$(usex profiling) |
493 |
+ ) |
494 |
+ |
495 |
+ if use static; then |
496 |
+ mycmakeargs+=( -DWITH_PIC=1 ) |
497 |
+ fi |
498 |
+ |
499 |
+ if use jemalloc || use tcmalloc ; then |
500 |
+ mycmakeargs+=( -DWITH_SAFEMALLOC=OFF ) |
501 |
+ fi |
502 |
+ |
503 |
+ # Storage engines |
504 |
+ mycmakeargs+=( |
505 |
+ -DWITH_ARCHIVE_STORAGE_ENGINE=1 |
506 |
+ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 |
507 |
+ -DWITH_CSV_STORAGE_ENGINE=1 |
508 |
+ -DWITH_HEAP_STORAGE_ENGINE=1 |
509 |
+ -DWITH_INNOBASE_STORAGE_ENGINE=1 |
510 |
+ -DWITH_MYISAMMRG_STORAGE_ENGINE=1 |
511 |
+ -DWITH_MYISAM_STORAGE_ENGINE=1 |
512 |
+ -DWITH_PARTITION_STORAGE_ENGINE=1 |
513 |
+ ) |
514 |
+ |
515 |
+ else |
516 |
+ mycmakeargs+=( |
517 |
+ -DWITHOUT_SERVER=1 |
518 |
+ -DWITH_EMBEDDED_SERVER=OFF |
519 |
+ -DEXTRA_CHARSETS=none |
520 |
+ -DINSTALL_SQLBENCHDIR= |
521 |
+ -DWITH_SYSTEMD=no |
522 |
+ ) |
523 |
+ fi |
524 |
+ |
525 |
+ cmake_src_configure |
526 |
+} |
527 |
+ |
528 |
+src_compile() { |
529 |
+ cmake_src_compile |
530 |
+} |
531 |
+ |
532 |
+# Official test instructions: |
533 |
+# USE='extraengine perl server' \ |
534 |
+# FEATURES='test userpriv' \ |
535 |
+# ebuild mariadb-X.X.XX.ebuild \ |
536 |
+# digest clean package |
537 |
+src_test() { |
538 |
+ _disable_test() { |
539 |
+ local rawtestname bug reason |
540 |
+ rawtestname="${1}" ; shift |
541 |
+ bug="${1}" ; shift |
542 |
+ reason="${@}" |
543 |
+ ewarn "test '${rawtestname}' disabled: '${reason}' (BUG#${bug})" |
544 |
+ echo "${rawtestname} : BUG#${bug} ${reason}" >> "${T}/disabled.def" |
545 |
+ } |
546 |
+ |
547 |
+ local TESTDIR="${BUILD_DIR}/mysql-test" |
548 |
+ local retstatus_unit |
549 |
+ local retstatus_tests |
550 |
+ |
551 |
+ if ! use server ; then |
552 |
+ einfo "Skipping server tests due to minimal build." |
553 |
+ return 0 |
554 |
+ fi |
555 |
+ |
556 |
+ einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" |
557 |
+ |
558 |
+ # Run CTest (test-units) |
559 |
+ cmake_src_test |
560 |
+ retstatus_unit=$? |
561 |
+ |
562 |
+ # Ensure that parallel runs don't die |
563 |
+ export MTR_BUILD_THREAD="$((${RANDOM} % 100))" |
564 |
+ |
565 |
+ if [[ -z "${MTR_PARALLEL}" ]] ; then |
566 |
+ local -x MTR_PARALLEL=$(makeopts_jobs) |
567 |
+ |
568 |
+ if [[ ${MTR_PARALLEL} -gt 4 ]] ; then |
569 |
+ # Running multiple tests in parallel usually require higher ulimit |
570 |
+ # and fs.aio-max-nr setting. In addition, tests like main.multi_update |
571 |
+ # are known to hit timeout when system is busy. |
572 |
+ # To avoid test failure we will limit MTR_PARALLEL to 4 instead of |
573 |
+ # using "auto". |
574 |
+ local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})" |
575 |
+ info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!" |
576 |
+ einfo "${info_msg}" |
577 |
+ unset info_msg |
578 |
+ MTR_PARALLEL=4 |
579 |
+ fi |
580 |
+ else |
581 |
+ einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'" |
582 |
+ fi |
583 |
+ |
584 |
+ # Try to increase file limits to increase test coverage |
585 |
+ if ! ulimit -n 16500 1>/dev/null 2>&1 ; then |
586 |
+ # Upper limit comes from parts.partition_* tests |
587 |
+ ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager." |
588 |
+ |
589 |
+ if ! ulimit -n 4162 1>/dev/null 2>&1 ; then |
590 |
+ # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)' |
591 |
+ ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager." |
592 |
+ |
593 |
+ if ! ulimit -n 3000 1>/dev/null 2>&1 ; then |
594 |
+ ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager." |
595 |
+ else |
596 |
+ einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)." |
597 |
+ fi |
598 |
+ else |
599 |
+ einfo "Will run test suite with open file limit set to 4162 (medium test coverage)." |
600 |
+ fi |
601 |
+ else |
602 |
+ einfo "Will run test suite with open file limit set to 16500 (best test coverage)." |
603 |
+ fi |
604 |
+ |
605 |
+ # create directories because mysqladmin might run out of order |
606 |
+ mkdir -p "${T}"/var-tests{,/log} || die |
607 |
+ |
608 |
+ cp "${S}"/mysql-test/unstable-tests "${T}/disabled.def" || die |
609 |
+ |
610 |
+ local -a disabled_tests |
611 |
+ disabled_tests+=( "compat/oracle.plugin;0;Needs example plugin which Gentoo disables" ) |
612 |
+ disabled_tests+=( "main.explain_non_select;0;Sporadically failing test" ) |
613 |
+ disabled_tests+=( "main.func_time;0;Dependent on time test was written" ) |
614 |
+ disabled_tests+=( "main.plugin_auth;0;Needs client libraries built" ) |
615 |
+ disabled_tests+=( "main.stat_tables;0;Sporadically failing test" ) |
616 |
+ disabled_tests+=( "main.stat_tables_innodb;0;Sporadically failing test" ) |
617 |
+ disabled_tests+=( "mariabackup.*;0;Broken test suite" ) |
618 |
+ disabled_tests+=( "plugins.auth_ed25519;0;Needs client libraries built" ) |
619 |
+ disabled_tests+=( "plugins.cracklib_password_check;0;False positive due to varying policies" ) |
620 |
+ disabled_tests+=( "plugins.two_password_validations;0;False positive due to varying policies" ) |
621 |
+ disabled_tests+=( "roles.acl_statistics;0;False positive due to a user count mismatch caused by previous test" ) |
622 |
+ |
623 |
+ if ! use latin1 ; then |
624 |
+ disabled_tests+=( "funcs_1.is_columns_mysql;0;Requires USE=latin1" ) |
625 |
+ disabled_tests+=( "main.information_schema;0;Requires USE=latin1" ) |
626 |
+ disabled_tests+=( "main.system_mysql_db;0;Requires USE=latin1" ) |
627 |
+ fi |
628 |
+ |
629 |
+ local test_infos_str test_infos_arr |
630 |
+ for test_infos_str in "${disabled_tests[@]}" ; do |
631 |
+ IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}" |
632 |
+ |
633 |
+ if [[ ${#test_infos_arr[@]} != 3 ]] ; then |
634 |
+ die "Invalid test data set, not matching format: ${test_infos_str}" |
635 |
+ fi |
636 |
+ |
637 |
+ _disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}" |
638 |
+ done |
639 |
+ unset test_infos_str test_infos_arr |
640 |
+ |
641 |
+ # run mysql-test tests |
642 |
+ pushd "${TESTDIR}" &>/dev/null || die |
643 |
+ perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" |
644 |
+ retstatus_tests=$? |
645 |
+ |
646 |
+ popd &>/dev/null || die |
647 |
+ |
648 |
+ # Cleanup is important for these testcases. |
649 |
+ pkill -9 -f "${S}/ndb" 2>/dev/null |
650 |
+ pkill -9 -f "${S}/sql" 2>/dev/null |
651 |
+ |
652 |
+ local failures="" |
653 |
+ [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" |
654 |
+ [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" |
655 |
+ |
656 |
+ [[ -z "$failures" ]] || die "Test failures: $failures" |
657 |
+ einfo "Tests successfully completed" |
658 |
+} |
659 |
+ |
660 |
+src_install() { |
661 |
+ cmake_src_install |
662 |
+ |
663 |
+ # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used |
664 |
+ if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then |
665 |
+ rm "${ED}/usr/include/mysql/server/private/config.h" || die |
666 |
+ fi |
667 |
+ |
668 |
+ # Make sure the vars are correctly initialized |
669 |
+ mysql_init_vars |
670 |
+ |
671 |
+ # Convenience links |
672 |
+ einfo "Making Convenience links for mysqlcheck multi-call binary" |
673 |
+ dosym "mysqlcheck" "/usr/bin/mysqlanalyze" |
674 |
+ dosym "mysqlcheck" "/usr/bin/mysqlrepair" |
675 |
+ dosym "mysqlcheck" "/usr/bin/mysqloptimize" |
676 |
+ |
677 |
+ # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir |
678 |
+ if [[ -d "${ED}/usr/data" ]] ; then |
679 |
+ rm -Rf "${ED}/usr/data" || die |
680 |
+ fi |
681 |
+ |
682 |
+ # Unless they explicitly specific USE=test, then do not install the |
683 |
+ # testsuite. It DOES have a use to be installed, esp. when you want to do a |
684 |
+ # validation of your database configuration after tuning it. |
685 |
+ if ! use test ; then |
686 |
+ rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test" |
687 |
+ fi |
688 |
+ |
689 |
+ # Configuration stuff |
690 |
+ einfo "Building default configuration ..." |
691 |
+ insinto "${MY_SYSCONFDIR#${EPREFIX}}" |
692 |
+ [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf |
693 |
+ cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die |
694 |
+ eprefixify "${TMPDIR}/my.cnf" |
695 |
+ doins "${TMPDIR}/my.cnf" |
696 |
+ insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d" |
697 |
+ cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die |
698 |
+ eprefixify "${TMPDIR}/50-distro-client.cnf" |
699 |
+ doins "${TMPDIR}/50-distro-client.cnf" |
700 |
+ |
701 |
+ if use server ; then |
702 |
+ mycnf_src="my.cnf.distro-server" |
703 |
+ sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ |
704 |
+ "${FILESDIR}/${mycnf_src}" \ |
705 |
+ > "${TMPDIR}/my.cnf.ok" || die |
706 |
+ if use prefix ; then |
707 |
+ sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \ |
708 |
+ "${TMPDIR}/my.cnf.ok" || die |
709 |
+ fi |
710 |
+ if use latin1 ; then |
711 |
+ sed -i \ |
712 |
+ -e "/character-set/s|utf8|latin1|g" \ |
713 |
+ "${TMPDIR}/my.cnf.ok" || die |
714 |
+ fi |
715 |
+ eprefixify "${TMPDIR}/my.cnf.ok" |
716 |
+ newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf |
717 |
+ |
718 |
+ einfo "Including support files and sample configurations" |
719 |
+ docinto "support-files" |
720 |
+ local script |
721 |
+ for script in \ |
722 |
+ "${S}"/support-files/magic |
723 |
+ do |
724 |
+ [[ -f "$script" ]] && dodoc "${script}" |
725 |
+ done |
726 |
+ |
727 |
+ docinto "scripts" |
728 |
+ for script in "${S}"/scripts/mysql* ; do |
729 |
+ [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}" |
730 |
+ done |
731 |
+ # Manually install supporting files that conflict with other packages |
732 |
+ # but are needed for galera and initial installation |
733 |
+ exeinto /usr/libexec/mariadb |
734 |
+ doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror" |
735 |
+ |
736 |
+ if use pam ; then |
737 |
+ keepdir /usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir |
738 |
+ fi |
739 |
+ fi |
740 |
+ |
741 |
+ # Remove mytop if perl is not selected |
742 |
+ if [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl ; then |
743 |
+ rm -f "${ED}/usr/bin/mytop" || die |
744 |
+ fi |
745 |
+ |
746 |
+ # Fix a dangling symlink when galera is not built |
747 |
+ if [[ -L "${ED}/usr/bin/wsrep_sst_rsync_wan" ]] && ! use galera ; then |
748 |
+ rm "${ED}/usr/bin/wsrep_sst_rsync_wan" || die |
749 |
+ fi |
750 |
+ |
751 |
+ # Remove broken SST scripts that are incompatible |
752 |
+ local scriptremove |
753 |
+ for scriptremove in wsrep_sst_xtrabackup wsrep_sst_xtrabackup-v2 ; do |
754 |
+ if [[ -e "${ED}/usr/bin/${scriptremove}" ]] ; then |
755 |
+ rm "${ED}/usr/bin/${scriptremove}" || die |
756 |
+ fi |
757 |
+ done |
758 |
+} |
759 |
+ |
760 |
+pkg_preinst() { |
761 |
+ java-pkg-opt-2_pkg_preinst |
762 |
+} |
763 |
+ |
764 |
+pkg_postinst() { |
765 |
+ # Make sure the vars are correctly initialized |
766 |
+ mysql_init_vars |
767 |
+ |
768 |
+ # Create log directory securely if it does not exist |
769 |
+ [[ -d "${ROOT}/${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}/${MY_LOGDIR}" |
770 |
+ |
771 |
+ if use server ; then |
772 |
+ if use pam; then |
773 |
+ einfo |
774 |
+ elog "This install includes the PAM authentication plugin." |
775 |
+ elog "To activate and configure the PAM plugin, please read:" |
776 |
+ elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/" |
777 |
+ einfo |
778 |
+ chown mysql:mysql "${EROOT}/usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir" || die |
779 |
+ fi |
780 |
+ |
781 |
+ if [[ -z "${REPLACING_VERSIONS}" ]] ; then |
782 |
+ einfo |
783 |
+ elog "You might want to run:" |
784 |
+ elog "\"emerge --config =${CATEGORY}/${PF}\"" |
785 |
+ elog "if this is a new install." |
786 |
+ elog |
787 |
+ elog "If you are switching server implentations, you should run the" |
788 |
+ elog "mysql_upgrade tool." |
789 |
+ einfo |
790 |
+ else |
791 |
+ einfo |
792 |
+ elog "If you are upgrading major versions, you should run the" |
793 |
+ elog "mysql_upgrade tool." |
794 |
+ einfo |
795 |
+ fi |
796 |
+ |
797 |
+ if use galera ; then |
798 |
+ einfo |
799 |
+ elog "Be sure to edit the my.cnf file to activate your cluster settings." |
800 |
+ elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\"" |
801 |
+ elog "The first time the cluster is activated, you should add" |
802 |
+ elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node." |
803 |
+ elog "This option should then be removed for subsequent starts." |
804 |
+ einfo |
805 |
+ if [[ -n "${REPLACING_VERSIONS}" ]] ; then |
806 |
+ local rver |
807 |
+ for rver in ${REPLACING_VERSIONS} ; do |
808 |
+ if ver_test "${rver}" -lt "10.4.0" ; then |
809 |
+ ewarn "Upgrading galera from a previous version requires admin restart of the entire cluster." |
810 |
+ ewarn "Please refer to https://mariadb.com/kb/en/library/changes-improvements-in-mariadb-104/#galera-4" |
811 |
+ ewarn "for more information" |
812 |
+ fi |
813 |
+ done |
814 |
+ fi |
815 |
+ fi |
816 |
+ fi |
817 |
+ |
818 |
+ # Note about configuration change |
819 |
+ einfo |
820 |
+ elog "This version of mariadb reorganizes the configuration from a single my.cnf" |
821 |
+ elog "to several files in /etc/mysql/${PN}.d." |
822 |
+ elog "Please backup any changes you made to /etc/mysql/my.cnf" |
823 |
+ elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension." |
824 |
+ elog "You may have as many files as needed and they are read alphabetically." |
825 |
+ elog "Be sure the options have the appropriate section headers, i.e. [mysqld]." |
826 |
+ einfo |
827 |
+} |
828 |
+ |
829 |
+pkg_config() { |
830 |
+ _getoptval() { |
831 |
+ local mypd="${EROOT}"/usr/libexec/mariadb/my_print_defaults |
832 |
+ local section="$1" |
833 |
+ local flag="--${2}=" |
834 |
+ local extra_options="${3}" |
835 |
+ "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp" |
836 |
+ } |
837 |
+ local old_MY_DATADIR="${MY_DATADIR}" |
838 |
+ local old_HOME="${HOME}" |
839 |
+ # my_print_defaults needs to read stuff in $HOME/.my.cnf |
840 |
+ export HOME=${EPREFIX}/root |
841 |
+ |
842 |
+ # Make sure the vars are correctly initialized |
843 |
+ mysql_init_vars |
844 |
+ |
845 |
+ [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR" |
846 |
+ if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then |
847 |
+ die "Minimal builds do NOT include the MySQL server" |
848 |
+ fi |
849 |
+ |
850 |
+ if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then |
851 |
+ local MY_DATADIR_s="${ROOT}/${MY_DATADIR}" |
852 |
+ MY_DATADIR_s="${MY_DATADIR_s%%/}" |
853 |
+ local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}" |
854 |
+ old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}" |
855 |
+ |
856 |
+ if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then |
857 |
+ if [[ -d "${MY_DATADIR_s}" ]]; then |
858 |
+ ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist" |
859 |
+ ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}" |
860 |
+ else |
861 |
+ elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}" |
862 |
+ mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \ |
863 |
+ || die "Moving MY_DATADIR failed" |
864 |
+ fi |
865 |
+ else |
866 |
+ ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist" |
867 |
+ if [[ -d "${MY_DATADIR_s}" ]]; then |
868 |
+ ewarn "Attempting to use ${MY_DATADIR_s}" |
869 |
+ else |
870 |
+ eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist" |
871 |
+ die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}" |
872 |
+ fi |
873 |
+ fi |
874 |
+ fi |
875 |
+ |
876 |
+ local pwd1="a" |
877 |
+ local pwd2="b" |
878 |
+ local maxtry=15 |
879 |
+ |
880 |
+ if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then |
881 |
+ local tmp_mysqld_password_source= |
882 |
+ |
883 |
+ for tmp_mysqld_password_source in mysql client; do |
884 |
+ einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." |
885 |
+ MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" |
886 |
+ if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then |
887 |
+ if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then |
888 |
+ ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" |
889 |
+ MYSQL_ROOT_PASSWORD= |
890 |
+ continue |
891 |
+ fi |
892 |
+ |
893 |
+ einfo "Found password in '${tmp_mysqld_password_source}' section!" |
894 |
+ break |
895 |
+ fi |
896 |
+ done |
897 |
+ |
898 |
+ # Sometimes --show is required to display passwords in some implementations of my_print_defaults |
899 |
+ if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then |
900 |
+ MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" |
901 |
+ fi |
902 |
+ |
903 |
+ unset tmp_mysqld_password_source |
904 |
+ fi |
905 |
+ MYSQL_TMPDIR="$(_getoptval mysqld tmpdir | tail -n1)" |
906 |
+ # These are dir+prefix |
907 |
+ MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log | tail -n1)" |
908 |
+ MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} |
909 |
+ MYSQL_LOG_BIN="$(_getoptval mysqld log-bin | tail -n1)" |
910 |
+ MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} |
911 |
+ |
912 |
+ if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then |
913 |
+ einfo "Creating MySQL tmpdir $MYSQL_TMPDIR" |
914 |
+ install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR" |
915 |
+ fi |
916 |
+ if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then |
917 |
+ einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN" |
918 |
+ install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN" |
919 |
+ fi |
920 |
+ if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then |
921 |
+ einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG" |
922 |
+ install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG" |
923 |
+ fi |
924 |
+ |
925 |
+ if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then |
926 |
+ ewarn "You have already a MySQL database in place." |
927 |
+ ewarn "(${ROOT}/${MY_DATADIR}/*)" |
928 |
+ ewarn "Please rename or delete it if you wish to replace it." |
929 |
+ die "MySQL database already exists!" |
930 |
+ fi |
931 |
+ |
932 |
+ # Bug #213475 - MySQL _will_ object strenously if your machine is named |
933 |
+ # localhost. Also causes weird failures. |
934 |
+ [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
935 |
+ |
936 |
+ if [[ -z "${MYSQL_ROOT_PASSWORD}" ]]; then |
937 |
+ |
938 |
+ einfo "Please provide a password for the mysql 'root'@'localhost' user now" |
939 |
+ einfo "or through the ${HOME}/.my.cnf file." |
940 |
+ ewarn "Avoid [\"'\\_%] characters in the password" |
941 |
+ einfo "Not entering a password defaults to UNIX authentication" |
942 |
+ read -rsp " >" pwd1 ; echo |
943 |
+ |
944 |
+ if [[ -n "${pwd1}" ]] ; then |
945 |
+ |
946 |
+ einfo "Retype the password" |
947 |
+ read -rsp " >" pwd2 ; echo |
948 |
+ |
949 |
+ if [[ "x$pwd1" != "x$pwd2" ]] ; then |
950 |
+ die "Passwords are not the same" |
951 |
+ fi |
952 |
+ MYSQL_ROOT_PASSWORD="${pwd1}" |
953 |
+ fi |
954 |
+ unset pwd1 pwd2 |
955 |
+ fi |
956 |
+ |
957 |
+ local options |
958 |
+ local sqltmp="$(emktemp)" |
959 |
+ |
960 |
+ # Fix bug 446200. Don't reference host my.cnf, needs to come first, |
961 |
+ # see https://bugs.mysql.com/bug.php?id=31312 |
962 |
+ use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'" |
963 |
+ |
964 |
+ # Figure out which options we need to disable to do the setup |
965 |
+ local helpfile="${TMPDIR}/mysqld-help" |
966 |
+ "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null |
967 |
+ for opt in host-cache name-resolve networking slave-start \ |
968 |
+ federated ssl log-bin relay-log slow-query-log external-locking \ |
969 |
+ log-slave-updates \ |
970 |
+ ; do |
971 |
+ optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" |
972 |
+ egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}" |
973 |
+ done |
974 |
+ |
975 |
+ einfo "Creating the mysql database and setting proper permissions on it ..." |
976 |
+ |
977 |
+ # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it |
978 |
+ PID_DIR="${EROOT}/var/run/mysqld" |
979 |
+ if [[ ! -d "${PID_DIR}" ]]; then |
980 |
+ install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory" |
981 |
+ fi |
982 |
+ |
983 |
+ if [[ ! -d "${MY_DATADIR}" ]]; then |
984 |
+ install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory" |
985 |
+ fi |
986 |
+ |
987 |
+ pushd "${TMPDIR}" &>/dev/null || die |
988 |
+ |
989 |
+ # Filling timezones, see |
990 |
+ # https://dev.mysql.com/doc/mysql/en/time-zone-support.html |
991 |
+ "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null |
992 |
+ |
993 |
+ local cmd=( "${EROOT}/usr/share/mariadb/scripts/mysql_install_db" ) |
994 |
+ [[ -f "${cmd}" ]] || cmd=( "${EROOT}/usr/bin/mysql_install_db" ) |
995 |
+ cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" ) |
996 |
+ einfo "Command: ${cmd[*]}" |
997 |
+ su -s /bin/sh -c "${cmd[*]}" mysql \ |
998 |
+ >"${TMPDIR}"/mysql_install_db.log 2>&1 |
999 |
+ if [[ $? -ne 0 ]]; then |
1000 |
+ grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2 |
1001 |
+ die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log" |
1002 |
+ fi |
1003 |
+ popd &>/dev/null || die |
1004 |
+ [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \ |
1005 |
+ || die "MySQL databases not installed" |
1006 |
+ |
1007 |
+ if [[ -z ${sqltmp} && -z ${MYSQL_ROOT_PASSWORD} ]] ; then |
1008 |
+ einfo "Done" |
1009 |
+ exit 0 |
1010 |
+ fi |
1011 |
+ |
1012 |
+ use prefix || options="${options} --user=mysql" |
1013 |
+ |
1014 |
+ local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock" |
1015 |
+ local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid" |
1016 |
+ local mysqld="${EROOT}/usr/sbin/mysqld \ |
1017 |
+ ${options} \ |
1018 |
+ --log-warnings=0 \ |
1019 |
+ --basedir=${EROOT}/usr \ |
1020 |
+ --datadir=${ROOT}/${MY_DATADIR} \ |
1021 |
+ --max_allowed_packet=8M \ |
1022 |
+ --net_buffer_length=16K \ |
1023 |
+ --socket=${socket} \ |
1024 |
+ --pid-file=${pidfile} \ |
1025 |
+ --tmpdir=${ROOT}/${MYSQL_TMPDIR}" |
1026 |
+ #einfo "About to start mysqld: ${mysqld}" |
1027 |
+ ebegin "Starting mysqld" |
1028 |
+ einfo "Command ${mysqld}" |
1029 |
+ ${mysqld} & |
1030 |
+ rc=$? |
1031 |
+ while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do |
1032 |
+ maxtry=$((${maxtry}-1)) |
1033 |
+ echo -n "." |
1034 |
+ sleep 1 |
1035 |
+ done |
1036 |
+ eend $rc |
1037 |
+ |
1038 |
+ [[ -S "${socket}" ]] || |
1039 |
+ die "Completely failed to start up mysqld with: ${mysqld}" |
1040 |
+ |
1041 |
+ if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then |
1042 |
+ ebegin "Setting root password" |
1043 |
+ # Do this from memory, as we don't want clear text passwords in temp files |
1044 |
+ local sql="SET PASSWORD FOR 'root'@'localhost' = PASSWORD('${MYSQL_ROOT_PASSWORD}')" |
1045 |
+ "${EROOT}/usr/bin/mysql" \ |
1046 |
+ "--socket=${socket}" \ |
1047 |
+ -hlocalhost \ |
1048 |
+ -e "${sql}" |
1049 |
+ unset sql |
1050 |
+ eend $? |
1051 |
+ fi |
1052 |
+ |
1053 |
+ if [[ -n "${sqltmp}" ]] ; then |
1054 |
+ ebegin "Loading \"zoneinfo\", this step may require a few seconds" |
1055 |
+ "${EROOT}/usr/bin/mysql" \ |
1056 |
+ "--socket=${socket}" \ |
1057 |
+ -hlocalhost \ |
1058 |
+ -uroot \ |
1059 |
+ --password="${MYSQL_ROOT_PASSWORD}" \ |
1060 |
+ mysql < "${sqltmp}" |
1061 |
+ rc=$? |
1062 |
+ eend $? |
1063 |
+ [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!" |
1064 |
+ fi |
1065 |
+ |
1066 |
+ # Stop the server and cleanup |
1067 |
+ einfo "Stopping the server ..." |
1068 |
+ kill $(< "${pidfile}" ) |
1069 |
+ rm -f "${sqltmp}" |
1070 |
+ wait %1 |
1071 |
+ einfo "Done" |
1072 |
+} |