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