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