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