1 |
commit: d93158106355d38cd61239bff3cf7d3f0865cf9b |
2 |
Author: Brian Evans <grknight <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu May 30 00:04:58 2019 +0000 |
4 |
Commit: Brian Evans <grknight <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu May 30 00:04:58 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d9315810 |
7 |
|
8 |
dev-db/mariadb: Version bump for 10.3.15 |
9 |
|
10 |
Package-Manager: Portage-2.3.67, Repoman-2.3.13 |
11 |
Signed-off-by: Brian Evans <grknight <AT> gentoo.org> |
12 |
|
13 |
dev-db/mariadb/Manifest | 1 + |
14 |
dev-db/mariadb/mariadb-10.3.15.ebuild | 974 ++++++++++++++++++++++++++++++++++ |
15 |
2 files changed, 975 insertions(+) |
16 |
|
17 |
diff --git a/dev-db/mariadb/Manifest b/dev-db/mariadb/Manifest |
18 |
index a10e4cb1fe6..f3f2aaa4c6b 100644 |
19 |
--- a/dev-db/mariadb/Manifest |
20 |
+++ b/dev-db/mariadb/Manifest |
21 |
@@ -8,6 +8,7 @@ DIST mariadb-10.1.40.tar.gz 63573615 BLAKE2B a57f89c3a9cbfdfc7ff85ec6d7f4231f29a |
22 |
DIST mariadb-10.2.22.tar.gz 71907765 BLAKE2B e7781a9e1bb0becca543ebb0b9e03912fbafa9de45bbd5c7232f92d29b934148dd124ad462bf8aa5aec2e4ee0bf75a03fae5e5fe97a77e1d93095052a577c14b SHA512 cd61d0c2d528b23b975e6ea142560d9b9ebff7ecda6fa9b3659b25b3406e8cc925918f4c3bb0e200ddb8d0520bcaa4d4f70d245b4731896f9ba2f1bdf0a817b2 |
23 |
DIST mariadb-10.2.24.tar.gz 71965656 BLAKE2B 2e78d7fc98fe6221126b7700c821ec4294af9d474f440857530b41d5633821b9995b732bbcdcba14c6a01f5decc56f506c99def4dc1a9a4dd52253d3045a88c6 SHA512 bd0e8c506e94f063b6cfbb1e7e872b4fdbe9ab704e07ff3af1e1efabb89daa39fec3b06ec5294d9a19fdc680da082d095cd3c5f9e4c4ee6f9ee5ae0514d6bb6f |
24 |
DIST mariadb-10.3.13.tar.gz 70745600 BLAKE2B f62b6de0566910cd0995954e3b84528bca4d8b99dab79ce1e8b5d4076a223890fc0bb7b43ac3d81c81c0b907cabbc3b042eab936b845ef18d259793759b05d51 SHA512 3cbd93291aa43b235e5b81d953ea69fb32df54fb518f922f69b5485952f01fae693c77b0efac37f414ed7ff132d3b58f899812bdb7be8a5b344c3640e2c3a0dd |
25 |
+DIST mariadb-10.3.15.tar.gz 70824529 BLAKE2B 6a84430e280db287859bd82cc2b6bb63bddd9188e599165d6ccb3e0fa75cb9de083d3d8d267b7de9de70be692a45b72570c8943d949c43673b3c1387623bb0b0 SHA512 35332ac32cba27fef1b4ddd2209236853f4309756fd121fbdbd2b6be0651e817cedc80e276b89ccfa4bc76760811434fab45a4d380d0ebd500c7d9bd7377fe93 |
26 |
DIST mariadb-5.5.63.tar.gz 45946425 BLAKE2B bddfd67d8393ec22c4bc8d7dab2838825394636bd690c04574bdc4da84fbf6c779fcae7f6be5d596458baa732cb5278475f308f03df083cdfcecffc486950d81 SHA512 4699d8af2210e12d0eea659a4d3fd4bfa68ce11a38cffaf939a96cb7a1fe64dd0827d39c3a0a36fa7cc1981a804a9af7a6d5cfaf23a8cfc8440e54c0163c2acb |
27 |
DIST mariadb-5.5.64.tar.gz 45953561 BLAKE2B d6efe53e520b829ec337a00efadd7d813afd5e3ee6ac5a298773c7cd1b724d01856979317fe2bcf814af3bdabdbd7c6c3d2e27a60b4cdf6032b1dfd64e54d84d SHA512 3e93044eb30d2ce50fefce503f16f4b542fd647ff4367675147ebe1b1f576b4fbad5c0bb25670136d0758d2b8b0c571119244c87d66565bb9b3471811f5dc6b8 |
28 |
DIST mysql-extras-20180809-1700Z.tar.bz2 322999 BLAKE2B 8b5feb32085dc35b2f68dae985b2d266c4eaa0e956b490050a2df04bbff99bf8623b67e75af9326d84e3ad625c4d86b0d21d23c9a96df5a0c9cd5ed730958970 SHA512 fbd7af9284bbf09d55f128361e7cc52d94f24ac491aac800cd6d61f2e444aeca66a4d5e6ae94c2fb4044e00cec9b232bae9a76a229f87f19d90b7aecf70792ec |
29 |
|
30 |
diff --git a/dev-db/mariadb/mariadb-10.3.15.ebuild b/dev-db/mariadb/mariadb-10.3.15.ebuild |
31 |
new file mode 100644 |
32 |
index 00000000000..ac4aefb9839 |
33 |
--- /dev/null |
34 |
+++ b/dev-db/mariadb/mariadb-10.3.15.ebuild |
35 |
@@ -0,0 +1,974 @@ |
36 |
+# Copyright 1999-2019 Gentoo Authors |
37 |
+# Distributed under the terms of the GNU General Public License v2 |
38 |
+ |
39 |
+EAPI="6" |
40 |
+MY_EXTRAS_VER="20190305-2052Z" |
41 |
+SUBSLOT="18" |
42 |
+ |
43 |
+JAVA_PKG_OPT_USE="jdbc" |
44 |
+ |
45 |
+# Keeping eutils in EAPI=6 for emktemp in pkg_config |
46 |
+ |
47 |
+inherit eutils systemd flag-o-matic prefix toolchain-funcs \ |
48 |
+ java-pkg-opt-2 user cmake-utils |
49 |
+ |
50 |
+SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz " |
51 |
+ |
52 |
+# Gentoo patches to MySQL |
53 |
+if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then |
54 |
+ SRC_URI="${SRC_URI} |
55 |
+ mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
56 |
+ https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
57 |
+ https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
58 |
+ https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
59 |
+ https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" |
60 |
+fi |
61 |
+ |
62 |
+HOMEPAGE="https://mariadb.org/" |
63 |
+DESCRIPTION="An enhanced, drop-in replacement for MySQL" |
64 |
+LICENSE="GPL-2 LGPL-2.1+" |
65 |
+SLOT="0/${SUBSLOT:-0}" |
66 |
+IUSE="+backup bindist client-libs cracklib debug extraengine galera innodb-lz4 |
67 |
+ innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 libressl mroonga |
68 |
+ numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx |
69 |
+ sst-rsync sst-mariabackup static systemd systemtap tcmalloc |
70 |
+ test tokudb xml yassl" |
71 |
+ |
72 |
+# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests |
73 |
+RESTRICT="!bindist? ( bindist ) libressl? ( test )" |
74 |
+ |
75 |
+REQUIRED_USE="jdbc? ( extraengine server !static ) |
76 |
+ server? ( tokudb? ( jemalloc !tcmalloc ) ) |
77 |
+ ?? ( tcmalloc jemalloc ) |
78 |
+ static? ( yassl !pam )" |
79 |
+ |
80 |
+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" |
81 |
+ |
82 |
+# Shorten the path because the socket path length must be shorter than 107 chars |
83 |
+# and we will run a mysql server during test phase |
84 |
+S="${WORKDIR}/mysql" |
85 |
+ |
86 |
+if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then |
87 |
+ inherit git-r3 |
88 |
+ EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/mysql-extras.git" |
89 |
+ EGIT_CHECKOUT_DIR="${WORKDIR%/}/mysql-extras" |
90 |
+ EGIT_CLONE_TYPE=shallow |
91 |
+ MY_PATCH_DIR="${WORKDIR%/}/mysql-extras" |
92 |
+else |
93 |
+ MY_PATCH_DIR="${WORKDIR%/}/mysql-extras-${MY_EXTRAS_VER}" |
94 |
+fi |
95 |
+ |
96 |
+PATCHES=( |
97 |
+ "${MY_PATCH_DIR}"/20015_all_mariadb-pkgconfig-location.patch |
98 |
+ "${MY_PATCH_DIR}"/20018_all_mariadb-10.3.12-without-clientlibs-tools.patch |
99 |
+ "${MY_PATCH_DIR}"/20024_all_mariadb-10.2.6-mysql_st-regression.patch |
100 |
+ "${MY_PATCH_DIR}"/20025_all_mariadb-10.2.6-gssapi-detect.patch |
101 |
+ "${MY_PATCH_DIR}"/20035_all_mariadb-10.3-atomic-detection.patch |
102 |
+) |
103 |
+ |
104 |
+# Be warned, *DEPEND are version-dependant |
105 |
+# These are used for both runtime and compiletime |
106 |
+COMMON_DEPEND=" |
107 |
+ kernel_linux? ( |
108 |
+ sys-process/procps:0= |
109 |
+ dev-libs/libaio:0= |
110 |
+ ) |
111 |
+ >=sys-apps/sed-4 |
112 |
+ >=sys-apps/texinfo-4.7-r1 |
113 |
+ jemalloc? ( dev-libs/jemalloc:0= ) |
114 |
+ tcmalloc? ( dev-util/google-perftools:0= ) |
115 |
+ systemtap? ( >=dev-util/systemtap-1.3:0= ) |
116 |
+ >=sys-libs/zlib-1.2.3:0= |
117 |
+ kerberos? ( virtual/krb5 ) |
118 |
+ yassl? ( net-libs/gnutls:0= ) |
119 |
+ !yassl? ( |
120 |
+ !libressl? ( >=dev-libs/openssl-1.0.0:0= ) |
121 |
+ libressl? ( dev-libs/libressl:0= ) |
122 |
+ ) |
123 |
+ sys-libs/ncurses:0= |
124 |
+ !bindist? ( |
125 |
+ sys-libs/binutils-libs:0= |
126 |
+ >=sys-libs/readline-4.1:0= |
127 |
+ ) |
128 |
+ server? ( |
129 |
+ backup? ( app-arch/libarchive:0= ) |
130 |
+ cracklib? ( sys-libs/cracklib:0= ) |
131 |
+ extraengine? ( |
132 |
+ odbc? ( dev-db/unixODBC:0= ) |
133 |
+ xml? ( dev-libs/libxml2:2= ) |
134 |
+ ) |
135 |
+ innodb-lz4? ( app-arch/lz4 ) |
136 |
+ innodb-lzo? ( dev-libs/lzo ) |
137 |
+ innodb-snappy? ( app-arch/snappy ) |
138 |
+ mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 ) |
139 |
+ numa? ( sys-process/numactl ) |
140 |
+ oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= ) |
141 |
+ pam? ( virtual/pam:0= ) |
142 |
+ systemd? ( sys-apps/systemd:= ) |
143 |
+ tokudb? ( app-arch/snappy ) |
144 |
+ ) |
145 |
+ >=dev-libs/libpcre-8.41-r1:3= |
146 |
+" |
147 |
+DEPEND="virtual/yacc |
148 |
+ static? ( sys-libs/ncurses[static-libs] ) |
149 |
+ || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) |
150 |
+ server? ( extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) ) ) |
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 |
+ server? ( !prefix? ( dev-db/mysql-init-scripts ) ) |
155 |
+ !<virtual/mysql-5.6-r11 |
156 |
+ ${COMMON_DEPEND} |
157 |
+ server? ( galera? ( |
158 |
+ sys-apps/iproute2 |
159 |
+ =sys-cluster/galera-25* |
160 |
+ sst-rsync? ( sys-process/lsof ) |
161 |
+ sst-mariabackup? ( net-misc/socat[ssl] ) |
162 |
+ ) ) |
163 |
+ perl? ( !dev-db/mytop |
164 |
+ virtual/perl-Getopt-Long |
165 |
+ dev-perl/TermReadKey |
166 |
+ virtual/perl-Term-ANSIColor |
167 |
+ virtual/perl-Time-HiRes ) |
168 |
+ server? ( extraengine? ( jdbc? ( >=virtual/jre-1.6 ) ) ) |
169 |
+" |
170 |
+# For other stuff to bring us in |
171 |
+# dev-perl/DBD-mysql is needed by some scripts installed by MySQL |
172 |
+PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 ) |
173 |
+ server? ( ~virtual/mysql-5.6[static=] )" |
174 |
+ |
175 |
+pkg_setup() { |
176 |
+ if [[ ${MERGE_TYPE} != binary ]] ; then |
177 |
+ local GCC_MAJOR_SET=$(gcc-major-version) |
178 |
+ local GCC_MINOR_SET=$(gcc-minor-version) |
179 |
+ if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \ |
180 |
+ ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then |
181 |
+ eerror "${PN} with tokudb needs to be built with gcc-4.7 or later." |
182 |
+ eerror "Please use gcc-config to switch to gcc-4.7 or later version." |
183 |
+ die |
184 |
+ fi |
185 |
+ # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on |
186 |
+ # non x86{,_64} arches |
187 |
+ if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \ |
188 |
+ ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then |
189 |
+ eerror "${PN} needs to be built with gcc-4.7 or later." |
190 |
+ eerror "Please use gcc-config to switch to gcc-4.7 or later version." |
191 |
+ die |
192 |
+ fi |
193 |
+ fi |
194 |
+ java-pkg-opt-2_pkg_setup |
195 |
+ if has test ${FEATURES} && \ |
196 |
+ use server && ! has userpriv ${FEATURES} ; then |
197 |
+ eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
198 |
+ fi |
199 |
+ |
200 |
+ # This should come after all of the die statements |
201 |
+ enewgroup mysql 60 || die "problem adding 'mysql' group" |
202 |
+ enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user" |
203 |
+} |
204 |
+ |
205 |
+pkg_preinst() { |
206 |
+ java-pkg-opt-2_pkg_preinst |
207 |
+ |
208 |
+ # Here we need to see if the implementation switched client libraries |
209 |
+ # We check if this is a new instance of the package and a client library already exists |
210 |
+ local SHOW_ABI_MESSAGE libpath |
211 |
+ if [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}usr/$(get_libdir)/libmysqlclient.so" ]] ; then |
212 |
+ libpath=$(readlink "${EROOT}usr/$(get_libdir)/libmysqlclient.so") |
213 |
+ elog "Due to ABI changes when switching between different client libraries," |
214 |
+ elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient." |
215 |
+ elog "Please run: revdep-rebuild --library ${libpath}" |
216 |
+ ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries" |
217 |
+ fi |
218 |
+} |
219 |
+ |
220 |
+pkg_postinst() { |
221 |
+ # Make sure the vars are correctly initialized |
222 |
+ mysql_init_vars |
223 |
+ |
224 |
+ # Create log directory securely if it does not exist |
225 |
+ [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}" |
226 |
+ |
227 |
+ if use server ; then |
228 |
+ if use pam; then |
229 |
+ einfo |
230 |
+ elog "This install includes the PAM authentication plugin." |
231 |
+ elog "To activate and configure the PAM plugin, please read:" |
232 |
+ elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/" |
233 |
+ einfo |
234 |
+ fi |
235 |
+ |
236 |
+ if [[ -z "${REPLACING_VERSIONS}" ]] ; then |
237 |
+ einfo |
238 |
+ elog "You might want to run:" |
239 |
+ elog "\"emerge --config =${CATEGORY}/${PF}\"" |
240 |
+ elog "if this is a new install." |
241 |
+ elog |
242 |
+ elog "If you are switching server implentations, you should run the" |
243 |
+ elog "mysql_upgrade tool." |
244 |
+ einfo |
245 |
+ else |
246 |
+ einfo |
247 |
+ elog "If you are upgrading major versions, you should run the" |
248 |
+ elog "mysql_upgrade tool." |
249 |
+ einfo |
250 |
+ fi |
251 |
+ |
252 |
+ if use galera ; then |
253 |
+ einfo |
254 |
+ elog "Be sure to edit the my.cnf file to activate your cluster settings." |
255 |
+ elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\"" |
256 |
+ elog "The first time the cluster is activated, you should add" |
257 |
+ elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node." |
258 |
+ elog "This option should then be removed for subsequent starts." |
259 |
+ einfo |
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 ) |
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 |
+ fi |
318 |
+ |
319 |
+ _disable_engine example |
320 |
+ |
321 |
+ if ! use oqgraph ; then # avoids extra library checks |
322 |
+ _disable_engine oqgraph |
323 |
+ fi |
324 |
+ |
325 |
+ if use mroonga ; then |
326 |
+ # Remove the bundled groonga |
327 |
+ # There is no CMake flag, it simply checks for existance |
328 |
+ rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga" |
329 |
+ else |
330 |
+ _disable_engine mroonga |
331 |
+ fi |
332 |
+ |
333 |
+ cmake-utils_src_prepare |
334 |
+ java-pkg-opt-2_src_prepare |
335 |
+} |
336 |
+ |
337 |
+src_configure(){ |
338 |
+ # bug 508724 mariadb cannot use ld.gold |
339 |
+ tc-ld-disable-gold |
340 |
+ # Bug #114895, bug #110149 |
341 |
+ filter-flags "-O" "-O[01]" |
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 |
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr" |
355 |
+ -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql" |
356 |
+ -DSYSCONFDIR="${EPREFIX}/etc/mysql" |
357 |
+ -DINSTALL_BINDIR=bin |
358 |
+ -DINSTALL_DOCDIR=share/doc/${PF} |
359 |
+ -DINSTALL_DOCREADMEDIR=share/doc/${PF} |
360 |
+ -DINSTALL_INCLUDEDIR=include/mysql |
361 |
+ -DINSTALL_INFODIR=share/info |
362 |
+ -DINSTALL_LIBDIR=$(get_libdir) |
363 |
+ -DINSTALL_MANDIR=share/man |
364 |
+ -DINSTALL_MYSQLSHAREDIR=share/mariadb |
365 |
+ -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin |
366 |
+ -DINSTALL_SCRIPTDIR=share/mariadb/scripts |
367 |
+ -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql" |
368 |
+ -DINSTALL_SBINDIR=sbin |
369 |
+ -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb" |
370 |
+ -DWITH_COMMENT="Gentoo Linux ${PF}" |
371 |
+ -DWITH_UNIT_TESTS=$(usex test ON OFF) |
372 |
+ -DWITH_LIBEDIT=0 |
373 |
+ -DWITH_ZLIB=system |
374 |
+ -DWITHOUT_LIBWRAP=1 |
375 |
+ -DENABLED_LOCAL_INFILE=1 |
376 |
+ -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock" |
377 |
+ -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock" |
378 |
+ -DWITH_DEFAULT_COMPILER_OPTIONS=0 |
379 |
+ -DWITH_DEFAULT_FEATURE_SET=0 |
380 |
+ -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)" |
381 |
+ # The build forces this to be defined when cross-compiling. We pass it |
382 |
+ # all the time for simplicity and to make sure it is actually correct. |
383 |
+ -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) |
384 |
+ -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)" |
385 |
+ -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) |
386 |
+ -DAUTH_GSSAPI_PLUGIN_TYPE=$(usex kerberos DYNAMIC OFF) |
387 |
+ -DCONC_WITH_EXTERNAL_ZLIB=YES |
388 |
+ -DWITH_EXTERNAL_ZLIB=YES |
389 |
+ -DSUFFIX_INSTALL_DIR="" |
390 |
+ -DWITH_UNITTEST=OFF |
391 |
+ -DWITHOUT_CLIENTLIBS=YES |
392 |
+ -DCLIENT_PLUGIN_DIALOG=OFF |
393 |
+ -DCLIENT_PLUGIN_AUTH_GSSAPI_CLIENT=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-utils_src_configure |
526 |
+} |
527 |
+ |
528 |
+src_compile() { |
529 |
+ cmake-utils_src_compile |
530 |
+} |
531 |
+ |
532 |
+src_install() { |
533 |
+ cmake-utils_src_install |
534 |
+ |
535 |
+ # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used |
536 |
+ if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then |
537 |
+ rm "${ED}/usr/include/mysql/server/private/config.h" || die |
538 |
+ fi |
539 |
+ |
540 |
+ # Make sure the vars are correctly initialized |
541 |
+ mysql_init_vars |
542 |
+ |
543 |
+ # Convenience links |
544 |
+ einfo "Making Convenience links for mysqlcheck multi-call binary" |
545 |
+ dosym "mysqlcheck" "/usr/bin/mysqlanalyze" |
546 |
+ dosym "mysqlcheck" "/usr/bin/mysqlrepair" |
547 |
+ dosym "mysqlcheck" "/usr/bin/mysqloptimize" |
548 |
+ |
549 |
+ # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir |
550 |
+ if [[ -d "${ED}/usr/data" ]] ; then |
551 |
+ rm -Rf "${ED}/usr/data" || die |
552 |
+ fi |
553 |
+ |
554 |
+ # Unless they explicitly specific USE=test, then do not install the |
555 |
+ # testsuite. It DOES have a use to be installed, esp. when you want to do a |
556 |
+ # validation of your database configuration after tuning it. |
557 |
+ if ! use test ; then |
558 |
+ rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test" |
559 |
+ fi |
560 |
+ |
561 |
+ # Configuration stuff |
562 |
+ einfo "Building default configuration ..." |
563 |
+ insinto "${MY_SYSCONFDIR#${EPREFIX}}" |
564 |
+ [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf |
565 |
+ cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die |
566 |
+ eprefixify "${TMPDIR}/my.cnf" |
567 |
+ doins "${TMPDIR}/my.cnf" |
568 |
+ insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d" |
569 |
+ cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die |
570 |
+ eprefixify "${TMPDIR}/50-distro-client.cnf" |
571 |
+ doins "${TMPDIR}/50-distro-client.cnf" |
572 |
+ |
573 |
+ if use server ; then |
574 |
+ mycnf_src="my.cnf.distro-server" |
575 |
+ sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ |
576 |
+ "${FILESDIR}/${mycnf_src}" \ |
577 |
+ > "${TMPDIR}/my.cnf.ok" || die |
578 |
+ if use prefix ; then |
579 |
+ sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \ |
580 |
+ "${TMPDIR}/my.cnf.ok" || die |
581 |
+ fi |
582 |
+ if use latin1 ; then |
583 |
+ sed -i \ |
584 |
+ -e "/character-set/s|utf8|latin1|g" \ |
585 |
+ "${TMPDIR}/my.cnf.ok" || die |
586 |
+ fi |
587 |
+ eprefixify "${TMPDIR}/my.cnf.ok" |
588 |
+ newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf |
589 |
+ |
590 |
+ einfo "Including support files and sample configurations" |
591 |
+ docinto "support-files" |
592 |
+ local script |
593 |
+ for script in \ |
594 |
+ "${S}"/support-files/magic |
595 |
+ do |
596 |
+ [[ -f "$script" ]] && dodoc "${script}" |
597 |
+ done |
598 |
+ |
599 |
+ docinto "scripts" |
600 |
+ for script in "${S}"/scripts/mysql* ; do |
601 |
+ [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}" |
602 |
+ done |
603 |
+ # Manually install supporting files that conflict with other packages |
604 |
+ # but are needed for galera and initial installation |
605 |
+ exeinto /usr/libexec/mariadb |
606 |
+ doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror" |
607 |
+ fi |
608 |
+ |
609 |
+ # Remove mytop if perl is not selected |
610 |
+ if [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl ; then |
611 |
+ rm -f "${ED}/usr/bin/mytop" || die |
612 |
+ fi |
613 |
+ |
614 |
+ # Fix a dangling symlink when galera is not built |
615 |
+ if [[ -L "${ED}/usr/bin/wsrep_sst_rsync_wan" ]] && ! use galera ; then |
616 |
+ rm "${ED}/usr/bin/wsrep_sst_rsync_wan" || die |
617 |
+ fi |
618 |
+ |
619 |
+ # Remove broken SST scripts that are incompatible |
620 |
+ local scriptremove |
621 |
+ for scriptremove in wsrep_sst_xtrabackup wsrep_sst_xtrabackup-v2 ; do |
622 |
+ if [[ -e "${ED}/usr/bin/${scriptremove}" ]] ; then |
623 |
+ rm "${ED}/usr/bin/${scriptremove}" || die |
624 |
+ fi |
625 |
+ done |
626 |
+} |
627 |
+ |
628 |
+# Official test instructions: |
629 |
+# USE='extraengine perl server' \ |
630 |
+# FEATURES='test userpriv -usersandbox' \ |
631 |
+# ebuild mariadb-X.X.XX.ebuild \ |
632 |
+# digest clean package |
633 |
+src_test() { |
634 |
+ |
635 |
+ _disable_test() { |
636 |
+ local rawtestname reason |
637 |
+ rawtestname="${1}" ; shift |
638 |
+ reason="${@}" |
639 |
+ ewarn "test '${rawtestname}' disabled: '${reason}'" |
640 |
+ echo ${rawtestname} : ${reason} >> "${T}/disabled.def" |
641 |
+ } |
642 |
+ |
643 |
+ local TESTDIR="${BUILD_DIR}/mysql-test" |
644 |
+ local retstatus_unit |
645 |
+ local retstatus_tests |
646 |
+ |
647 |
+ if ! use server ; then |
648 |
+ einfo "Skipping server tests due to minimal build." |
649 |
+ return 0 |
650 |
+ fi |
651 |
+ |
652 |
+ # Bug #213475 - MySQL _will_ object strenously if your machine is named |
653 |
+ # localhost. Also causes weird failures. |
654 |
+ [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
655 |
+ |
656 |
+ if [[ $UID -eq 0 ]]; then |
657 |
+ die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
658 |
+ fi |
659 |
+ has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox" |
660 |
+ |
661 |
+ einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" |
662 |
+ |
663 |
+ # Run CTest (test-units) |
664 |
+ cmake-utils_src_test |
665 |
+ retstatus_unit=$? |
666 |
+ |
667 |
+ # Ensure that parallel runs don't die |
668 |
+ export MTR_BUILD_THREAD="$((${RANDOM} % 100))" |
669 |
+ # Enable parallel testing, auto will try to detect number of cores |
670 |
+ # You may set this by hand. |
671 |
+ # The default maximum is 8 unless MTR_MAX_PARALLEL is increased |
672 |
+ export MTR_PARALLEL="${MTR_PARALLEL:-auto}" |
673 |
+ |
674 |
+ # create directories because mysqladmin might run out of order |
675 |
+ mkdir -p "${T}"/var-tests{,/log} || die |
676 |
+ |
677 |
+ # Run mysql tests |
678 |
+ pushd "${TESTDIR}" > /dev/null || die |
679 |
+ |
680 |
+ touch "${T}/disabled.def" |
681 |
+ # These are failing in MariaDB 10.0 for now and are believed to be |
682 |
+ # false positives: |
683 |
+ # |
684 |
+ # main.mysql_client_test, main.mysql_client_test_nonblock |
685 |
+ # main.mysql_client_test_comp: |
686 |
+ # segfaults at random under Portage only, suspect resource limits. |
687 |
+ |
688 |
+ local t |
689 |
+ for t in plugins.cracklib_password_check plugins.two_password_validations ; do |
690 |
+ _disable_test "$t" "False positive due to varying policies" |
691 |
+ done |
692 |
+ |
693 |
+ for t in main.mysql_client_test main.mysql_client_test_nonblock \ |
694 |
+ main.mysql main.gis_notembedded \ |
695 |
+ main.mysql_client_test_comp rpl.rpl_extra_col_master_myisam ; do |
696 |
+ _disable_test "$t" "False positives in Gentoo" |
697 |
+ done |
698 |
+ |
699 |
+ _disable_test main.plugin_auth "Needs client libraries built" |
700 |
+ |
701 |
+ _disable_test main.func_time "Dependent on time test was written" |
702 |
+ |
703 |
+ # run mysql-test tests |
704 |
+ perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" |
705 |
+ retstatus_tests=$? |
706 |
+ |
707 |
+ popd > /dev/null || die |
708 |
+ |
709 |
+ # Cleanup is important for these testcases. |
710 |
+ pkill -9 -f "${S}/ndb" 2>/dev/null |
711 |
+ pkill -9 -f "${S}/sql" 2>/dev/null |
712 |
+ |
713 |
+ local failures="" |
714 |
+ [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" |
715 |
+ [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" |
716 |
+ |
717 |
+ [[ -z "$failures" ]] || die "Test failures: $failures" |
718 |
+ einfo "Tests successfully completed" |
719 |
+} |
720 |
+ |
721 |
+mysql_init_vars() { |
722 |
+ MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"} |
723 |
+ MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} |
724 |
+ MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} |
725 |
+ MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"} |
726 |
+ |
727 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
728 |
+ MY_DATADIR="" |
729 |
+ if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then |
730 |
+ MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
731 |
+ | sed -ne '/datadir/s|^--datadir=||p' \ |
732 |
+ | tail -n1` |
733 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
734 |
+ MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ |
735 |
+ | sed -e 's/.*=\s*//' \ |
736 |
+ | tail -n1` |
737 |
+ fi |
738 |
+ fi |
739 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
740 |
+ MY_DATADIR="${MY_LOCALSTATEDIR}" |
741 |
+ einfo "Using default MY_DATADIR" |
742 |
+ fi |
743 |
+ elog "MySQL MY_DATADIR is ${MY_DATADIR}" |
744 |
+ |
745 |
+ if [[ -z "${PREVIOUS_DATADIR}" ]] ; then |
746 |
+ if [[ -e "${MY_DATADIR}" ]] ; then |
747 |
+ # If you get this and you're wondering about it, see bug #207636 |
748 |
+ elog "MySQL datadir found in ${MY_DATADIR}" |
749 |
+ elog "A new one will not be created." |
750 |
+ PREVIOUS_DATADIR="yes" |
751 |
+ else |
752 |
+ PREVIOUS_DATADIR="no" |
753 |
+ fi |
754 |
+ export PREVIOUS_DATADIR |
755 |
+ fi |
756 |
+ else |
757 |
+ if [[ ${EBUILD_PHASE} == "config" ]]; then |
758 |
+ local new_MY_DATADIR |
759 |
+ new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
760 |
+ | sed -ne '/datadir/s|^--datadir=||p' \ |
761 |
+ | tail -n1` |
762 |
+ |
763 |
+ if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then |
764 |
+ ewarn "MySQL MY_DATADIR has changed" |
765 |
+ ewarn "from ${MY_DATADIR}" |
766 |
+ ewarn "to ${new_MY_DATADIR}" |
767 |
+ MY_DATADIR="${new_MY_DATADIR}" |
768 |
+ fi |
769 |
+ fi |
770 |
+ fi |
771 |
+ |
772 |
+ export MY_SHAREDSTATEDIR MY_SYSCONFDIR |
773 |
+ export MY_LOCALSTATEDIR MY_LOGDIR |
774 |
+ export MY_DATADIR |
775 |
+} |
776 |
+ |
777 |
+pkg_config() { |
778 |
+ _getoptval() { |
779 |
+ local mypd="${EROOT}"usr/libexec/mariadb/my_print_defaults |
780 |
+ local section="$1" |
781 |
+ local flag="--${2}=" |
782 |
+ local extra_options="${3}" |
783 |
+ "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp" |
784 |
+ } |
785 |
+ local old_MY_DATADIR="${MY_DATADIR}" |
786 |
+ local old_HOME="${HOME}" |
787 |
+ # my_print_defaults needs to read stuff in $HOME/.my.cnf |
788 |
+ export HOME=${EPREFIX}/root |
789 |
+ |
790 |
+ # Make sure the vars are correctly initialized |
791 |
+ mysql_init_vars |
792 |
+ |
793 |
+ [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR" |
794 |
+ if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then |
795 |
+ die "Minimal builds do NOT include the MySQL server" |
796 |
+ fi |
797 |
+ |
798 |
+ if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then |
799 |
+ local MY_DATADIR_s="${ROOT}/${MY_DATADIR}" |
800 |
+ MY_DATADIR_s="${MY_DATADIR_s%%/}" |
801 |
+ local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}" |
802 |
+ old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}" |
803 |
+ |
804 |
+ if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then |
805 |
+ if [[ -d "${MY_DATADIR_s}" ]]; then |
806 |
+ ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist" |
807 |
+ ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}" |
808 |
+ else |
809 |
+ elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}" |
810 |
+ mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \ |
811 |
+ || die "Moving MY_DATADIR failed" |
812 |
+ fi |
813 |
+ else |
814 |
+ ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist" |
815 |
+ if [[ -d "${MY_DATADIR_s}" ]]; then |
816 |
+ ewarn "Attempting to use ${MY_DATADIR_s}" |
817 |
+ else |
818 |
+ eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist" |
819 |
+ die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}" |
820 |
+ fi |
821 |
+ fi |
822 |
+ fi |
823 |
+ |
824 |
+ local pwd1="a" |
825 |
+ local pwd2="b" |
826 |
+ local maxtry=15 |
827 |
+ |
828 |
+ if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then |
829 |
+ local tmp_mysqld_password_source= |
830 |
+ |
831 |
+ for tmp_mysqld_password_source in mysql client; do |
832 |
+ einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." |
833 |
+ MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" |
834 |
+ if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then |
835 |
+ if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then |
836 |
+ ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" |
837 |
+ MYSQL_ROOT_PASSWORD= |
838 |
+ continue |
839 |
+ fi |
840 |
+ |
841 |
+ einfo "Found password in '${tmp_mysqld_password_source}' section!" |
842 |
+ break |
843 |
+ fi |
844 |
+ done |
845 |
+ |
846 |
+ # Sometimes --show is required to display passwords in some implementations of my_print_defaults |
847 |
+ if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then |
848 |
+ MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" |
849 |
+ fi |
850 |
+ |
851 |
+ unset tmp_mysqld_password_source |
852 |
+ fi |
853 |
+ MYSQL_TMPDIR="$(_getoptval mysqld tmpdir | tail -n1)" |
854 |
+ # These are dir+prefix |
855 |
+ MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log | tail -n1)" |
856 |
+ MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} |
857 |
+ MYSQL_LOG_BIN="$(_getoptval mysqld log-bin | tail -n1)" |
858 |
+ MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} |
859 |
+ |
860 |
+ if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then |
861 |
+ einfo "Creating MySQL tmpdir $MYSQL_TMPDIR" |
862 |
+ install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR" |
863 |
+ fi |
864 |
+ if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then |
865 |
+ einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN" |
866 |
+ install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN" |
867 |
+ fi |
868 |
+ if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then |
869 |
+ einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG" |
870 |
+ install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG" |
871 |
+ fi |
872 |
+ |
873 |
+ if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then |
874 |
+ ewarn "You have already a MySQL database in place." |
875 |
+ ewarn "(${ROOT}/${MY_DATADIR}/*)" |
876 |
+ ewarn "Please rename or delete it if you wish to replace it." |
877 |
+ die "MySQL database already exists!" |
878 |
+ fi |
879 |
+ |
880 |
+ # Bug #213475 - MySQL _will_ object strenously if your machine is named |
881 |
+ # localhost. Also causes weird failures. |
882 |
+ [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
883 |
+ |
884 |
+ if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then |
885 |
+ |
886 |
+ einfo "Please provide a password for the mysql 'root' user now" |
887 |
+ einfo "or through the ${HOME}/.my.cnf file." |
888 |
+ ewarn "Avoid [\"'\\_%] characters in the password" |
889 |
+ read -rsp " >" pwd1 ; echo |
890 |
+ |
891 |
+ einfo "Retype the password" |
892 |
+ read -rsp " >" pwd2 ; echo |
893 |
+ |
894 |
+ if [[ "x$pwd1" != "x$pwd2" ]] ; then |
895 |
+ die "Passwords are not the same" |
896 |
+ fi |
897 |
+ MYSQL_ROOT_PASSWORD="${pwd1}" |
898 |
+ unset pwd1 pwd2 |
899 |
+ fi |
900 |
+ |
901 |
+ local options |
902 |
+ local sqltmp="$(emktemp)" |
903 |
+ |
904 |
+ # Fix bug 446200. Don't reference host my.cnf, needs to come first, |
905 |
+ # see https://bugs.mysql.com/bug.php?id=31312 |
906 |
+ use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'" |
907 |
+ |
908 |
+ # Figure out which options we need to disable to do the setup |
909 |
+ local helpfile="${TMPDIR}/mysqld-help" |
910 |
+ "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null |
911 |
+ for opt in grant-tables host-cache name-resolve networking slave-start \ |
912 |
+ federated ssl log-bin relay-log slow-query-log external-locking \ |
913 |
+ log-slave-updates \ |
914 |
+ ; do |
915 |
+ optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" |
916 |
+ egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}" |
917 |
+ done |
918 |
+ |
919 |
+ einfo "Creating the mysql database and setting proper permissions on it ..." |
920 |
+ |
921 |
+ # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it |
922 |
+ PID_DIR="${EROOT}/var/run/mysqld" |
923 |
+ if [[ ! -d "${PID_DIR}" ]]; then |
924 |
+ install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory" |
925 |
+ fi |
926 |
+ |
927 |
+ if [[ ! -d "${MY_DATADIR}" ]]; then |
928 |
+ install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory" |
929 |
+ fi |
930 |
+ |
931 |
+ pushd "${TMPDIR}" &>/dev/null || die |
932 |
+ |
933 |
+ # Filling timezones, see |
934 |
+ # https://dev.mysql.com/doc/mysql/en/time-zone-support.html |
935 |
+ "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null |
936 |
+ |
937 |
+ local cmd=( "${EROOT}usr/share/mariadb/scripts/mysql_install_db" ) |
938 |
+ [[ -f "${cmd}" ]] || cmd=( "${EROOT}usr/bin/mysql_install_db" ) |
939 |
+ cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" ) |
940 |
+ einfo "Command: ${cmd[*]}" |
941 |
+ su -s /bin/sh -c "${cmd[*]}" mysql \ |
942 |
+ >"${TMPDIR}"/mysql_install_db.log 2>&1 |
943 |
+ if [ $? -ne 0 ]; then |
944 |
+ grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2 |
945 |
+ die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log" |
946 |
+ fi |
947 |
+ popd &>/dev/null || die |
948 |
+ [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \ |
949 |
+ || die "MySQL databases not installed" |
950 |
+ |
951 |
+ use prefix || options="${options} --user=mysql" |
952 |
+ |
953 |
+ local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock" |
954 |
+ local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid" |
955 |
+ local mysqld="${EROOT}/usr/sbin/mysqld \ |
956 |
+ ${options} \ |
957 |
+ --log-warnings=0 \ |
958 |
+ --basedir=${EROOT}/usr \ |
959 |
+ --datadir=${ROOT}/${MY_DATADIR} \ |
960 |
+ --max_allowed_packet=8M \ |
961 |
+ --net_buffer_length=16K \ |
962 |
+ --socket=${socket} \ |
963 |
+ --pid-file=${pidfile} \ |
964 |
+ --tmpdir=${ROOT}/${MYSQL_TMPDIR}" |
965 |
+ #einfo "About to start mysqld: ${mysqld}" |
966 |
+ ebegin "Starting mysqld" |
967 |
+ einfo "Command ${mysqld}" |
968 |
+ ${mysqld} & |
969 |
+ rc=$? |
970 |
+ while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do |
971 |
+ maxtry=$((${maxtry}-1)) |
972 |
+ echo -n "." |
973 |
+ sleep 1 |
974 |
+ done |
975 |
+ eend $rc |
976 |
+ |
977 |
+ if ! [[ -S "${socket}" ]]; then |
978 |
+ die "Completely failed to start up mysqld with: ${mysqld}" |
979 |
+ fi |
980 |
+ |
981 |
+ ebegin "Setting root password" |
982 |
+ # Do this from memory, as we don't want clear text passwords in temp files |
983 |
+ local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES" |
984 |
+ "${EROOT}/usr/bin/mysql" \ |
985 |
+ "--socket=${socket}" \ |
986 |
+ -hlocalhost \ |
987 |
+ -e "${sql}" |
988 |
+ eend $? |
989 |
+ |
990 |
+ if [[ -n "${sqltmp}" ]] ; then |
991 |
+ ebegin "Loading \"zoneinfo\", this step may require a few seconds" |
992 |
+ "${EROOT}/usr/bin/mysql" \ |
993 |
+ "--socket=${socket}" \ |
994 |
+ -hlocalhost \ |
995 |
+ -uroot \ |
996 |
+ --password="${MYSQL_ROOT_PASSWORD}" \ |
997 |
+ mysql < "${sqltmp}" |
998 |
+ rc=$? |
999 |
+ eend $? |
1000 |
+ [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!" |
1001 |
+ fi |
1002 |
+ |
1003 |
+ # Stop the server and cleanup |
1004 |
+ einfo "Stopping the server ..." |
1005 |
+ kill $(< "${pidfile}" ) |
1006 |
+ rm -f "${sqltmp}" |
1007 |
+ wait %1 |
1008 |
+ einfo "Done" |
1009 |
+} |