1 |
commit: fca5f62347954f3277f69e11ff4d733a45c4762a |
2 |
Author: Brian Evans <grknight <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Jan 31 03:59:36 2019 +0000 |
4 |
Commit: Brian Evans <grknight <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jan 31 03:59:36 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fca5f623 |
7 |
|
8 |
dev-db/mariadb: Drop old |
9 |
|
10 |
Package-Manager: Portage-2.3.59, 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-5.5.62.ebuild | 831 ----------------------------------- |
15 |
2 files changed, 832 deletions(-) |
16 |
|
17 |
diff --git a/dev-db/mariadb/Manifest b/dev-db/mariadb/Manifest |
18 |
index cb020173545..8d4c33e2359 100644 |
19 |
--- a/dev-db/mariadb/Manifest |
20 |
+++ b/dev-db/mariadb/Manifest |
21 |
@@ -7,7 +7,6 @@ DIST mariadb-10.2.20.tar.gz 71876032 BLAKE2B cb170dc8e341dd4406112ec66aa3d975466 |
22 |
DIST mariadb-10.2.21.tar.gz 71878359 BLAKE2B cad6a24480b476128d419ad85cfa67777bc0641c8cc30884f90ba61e73e2e009e51742bbe132b2c9736478ee6997fd576bd5c96660bf4f321617382716881cee SHA512 b723ddda5fb22ff41ec8a031a1a0f15bbd13ffec09099c7e0138d7b25028d0807b0bd3ac71957b825516386088bba28b0bf561706e99a6396e599ef21e720cda |
23 |
DIST mariadb-10.3.11.tar.gz 70669435 BLAKE2B e16346519b60aa11a0ffd2c19254ef888c44c054d55b7f98a8d696e3df2c0801c6141adddfb9169098ad5efa5d881c83681c3c5741f68b10c9ce4d15def34254 SHA512 1adc1f9bbabf848726c669a7a0ab01257ba31882758b53fbf3b1316f2295670dba1c3d1f3292d7c1a749c701504588694a55d020839e690595897b0e20435298 |
24 |
DIST mariadb-10.3.12.tar.gz 70666408 BLAKE2B 90e734a5617e44e2c273a1cd22ed2f81493e9458249dc0eb478c3b2b106dd7a0f81d130841be7632272bf6dc01e64350057c2d3e8162e8e8cef1f5a4ac2fb18c SHA512 9dd2939684c4591db306be6afb34663626dfaae133f88dd31125c759dce16b9e9d767a9254e30d9ee5fa2ea027e223dd4799effba8a8b0e4638d5de9e2512003 |
25 |
-DIST mariadb-5.5.62.tar.gz 45938380 BLAKE2B aa17d0e5740805d74f7f74f54605e04c4e29c4208a2efa6da2dde5855dfdc13e3225fe349e2146b11a6cbf5a0ac82a9e6c3e4f31e62afa71fc7ab1381040c68f SHA512 136668a54b404a303ee8f87e736bd14463b2323f0a517e7161c8729f4534bc1d653241d6b79f8cb7ad66ea09cf4190f9b95eceaa209b18a46822a68d9580ba5a |
26 |
DIST mariadb-5.5.63.tar.gz 45946425 BLAKE2B bddfd67d8393ec22c4bc8d7dab2838825394636bd690c04574bdc4da84fbf6c779fcae7f6be5d596458baa732cb5278475f308f03df083cdfcecffc486950d81 SHA512 4699d8af2210e12d0eea659a4d3fd4bfa68ce11a38cffaf939a96cb7a1fe64dd0827d39c3a0a36fa7cc1981a804a9af7a6d5cfaf23a8cfc8440e54c0163c2acb |
27 |
DIST mysql-extras-20180809-1700Z.tar.bz2 322999 BLAKE2B 8b5feb32085dc35b2f68dae985b2d266c4eaa0e956b490050a2df04bbff99bf8623b67e75af9326d84e3ad625c4d86b0d21d23c9a96df5a0c9cd5ed730958970 SHA512 fbd7af9284bbf09d55f128361e7cc52d94f24ac491aac800cd6d61f2e444aeca66a4d5e6ae94c2fb4044e00cec9b232bae9a76a229f87f19d90b7aecf70792ec |
28 |
DIST mysql-extras-20181104-2252Z.tar.bz2 328613 BLAKE2B c869dbdd8eb8ab6706b52815fae88e0789b955b9d3e89eac305e6de6e1bc9e78ea10ac58efeac0d6478c7f83587910834e9b4c44e3621224f006daae44dc2bf3 SHA512 e0dff23aa6420a9cfcf2f60464381d4b08194759dcd96910cdf94075fa71e90b74fa3dae700f279f421fee68315af37e47054c9422adeb6cc757fa968a1b65bf |
29 |
|
30 |
diff --git a/dev-db/mariadb/mariadb-5.5.62.ebuild b/dev-db/mariadb/mariadb-5.5.62.ebuild |
31 |
deleted file mode 100644 |
32 |
index c524ab73fff..00000000000 |
33 |
--- a/dev-db/mariadb/mariadb-5.5.62.ebuild |
34 |
+++ /dev/null |
35 |
@@ -1,831 +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 |
-# Keeping eutils in EAPI=6 for emktemp in pkg_config |
44 |
- |
45 |
-inherit eutils flag-o-matic prefix toolchain-funcs user cmake-utils multilib-build |
46 |
- |
47 |
-SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz " |
48 |
- |
49 |
-# Gentoo patches to MySQL |
50 |
-if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then |
51 |
- SRC_URI="${SRC_URI} |
52 |
- mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
53 |
- https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
54 |
- https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
55 |
- https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
56 |
- https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" |
57 |
-fi |
58 |
- |
59 |
-HOMEPAGE="https://mariadb.org/" |
60 |
-DESCRIPTION="An enhanced, drop-in replacement for MySQL" |
61 |
-LICENSE="GPL-2" |
62 |
-SLOT="0/${SUBSLOT:-0}" |
63 |
-IUSE="bindist client-libs debug extraengine jemalloc latin1 libressl |
64 |
- oqgraph pam +perl profiling selinux +server sphinx |
65 |
- static static-libs systemtap tcmalloc |
66 |
- test tokudb yassl" |
67 |
- |
68 |
-# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests |
69 |
-RESTRICT="!bindist? ( bindist ) libressl? ( test )" |
70 |
- |
71 |
-REQUIRED_USE="server? ( tokudb? ( jemalloc !tcmalloc ) ) |
72 |
- ?? ( tcmalloc jemalloc ) |
73 |
- static? ( yassl !pam )" |
74 |
- |
75 |
-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" |
76 |
- |
77 |
-# Shorten the path because the socket path length must be shorter than 107 chars |
78 |
-# and we will run a mysql server during test phase |
79 |
-S="${WORKDIR}/mysql" |
80 |
- |
81 |
-if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then |
82 |
- MY_PATCH_DIR="${WORKDIR%/}/mysql-extras" |
83 |
- inherit git-r3 |
84 |
- EGIT_REPO_URI="git://anongit.gentoo.org/proj/mysql-extras.git" |
85 |
- EGIT_CHECKOUT_DIR="${WORKDIR%/}/mysql-extras" |
86 |
- EGIT_CLONE_TYPE=shallow |
87 |
-else |
88 |
- MY_PATCH_DIR="${WORKDIR%/}/mysql-extras-${MY_EXTRAS_VER}" |
89 |
-fi |
90 |
- |
91 |
-PATCHES=( |
92 |
- "${MY_PATCH_DIR}/01050_all_mariadb_mysql_config_cleanup-5.5.41.patch" |
93 |
- "${MY_PATCH_DIR}/20004_all_mariadb-filter-tokudb-flags.patch" |
94 |
- "${MY_PATCH_DIR}/20006_all_cmake_elib-mariadb-5.5.50.patch" |
95 |
- "${MY_PATCH_DIR}/20009_all_mariadb_myodbc_symbol_fix-5.5.38.patch" |
96 |
- "${MY_PATCH_DIR}/20018_all_mariadb-5.5.60-without-clientlibs-tools.patch" |
97 |
-) |
98 |
- |
99 |
-# Be warned, *DEPEND are version-dependant |
100 |
-# These are used for both runtime and compiletime |
101 |
-COMMON_DEPEND=" |
102 |
- kernel_linux? ( |
103 |
- sys-process/procps:0= |
104 |
- dev-libs/libaio:0= |
105 |
- ) |
106 |
- >=sys-apps/sed-4 |
107 |
- >=sys-apps/texinfo-4.7-r1 |
108 |
- jemalloc? ( dev-libs/jemalloc:0= ) |
109 |
- tcmalloc? ( dev-util/google-perftools:0= ) |
110 |
- systemtap? ( >=dev-util/systemtap-1.3:0= ) |
111 |
- !yassl? ( |
112 |
- !libressl? ( dev-libs/openssl:0= !>=dev-libs/openssl-1.1 ) |
113 |
- libressl? ( dev-libs/libressl:0= ) |
114 |
- ) |
115 |
- >=sys-libs/zlib-1.2.3:0= |
116 |
- sys-libs/ncurses:0= |
117 |
- !bindist? ( |
118 |
- >=sys-libs/readline-4.1:0= |
119 |
- ) |
120 |
- server? ( |
121 |
- oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= ) |
122 |
- pam? ( virtual/pam:0= ) |
123 |
- ) |
124 |
- !client-libs? ( dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] ) |
125 |
-" |
126 |
-DEPEND="virtual/yacc |
127 |
- static? ( sys-libs/ncurses[static-libs] ) |
128 |
- || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) |
129 |
- ${COMMON_DEPEND}" |
130 |
-RDEPEND="selinux? ( sec-policy/selinux-mysql ) |
131 |
- client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c ) |
132 |
- !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster |
133 |
- server? ( !prefix? ( dev-db/mysql-init-scripts ) ) |
134 |
- ${COMMON_DEPEND} |
135 |
- perl? ( !dev-db/mytop |
136 |
- virtual/perl-Getopt-Long |
137 |
- dev-perl/TermReadKey |
138 |
- virtual/perl-Term-ANSIColor |
139 |
- virtual/perl-Time-HiRes ) |
140 |
-" |
141 |
-# For other stuff to bring us in |
142 |
-# dev-perl/DBD-mysql is needed by some scripts installed by MySQL |
143 |
-PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )" |
144 |
- |
145 |
-pkg_setup() { |
146 |
- if [[ ${MERGE_TYPE} != binary ]] ; then |
147 |
- local GCC_MAJOR_SET=$(gcc-major-version) |
148 |
- local GCC_MINOR_SET=$(gcc-minor-version) |
149 |
- if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \ |
150 |
- ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then |
151 |
- eerror "${PN} with tokudb needs to be built with gcc-4.7 or later." |
152 |
- eerror "Please use gcc-config to switch to gcc-4.7 or later version." |
153 |
- die |
154 |
- fi |
155 |
- # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on |
156 |
- # non x86{,_64} arches |
157 |
- if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \ |
158 |
- ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then |
159 |
- eerror "${PN} needs to be built with gcc-4.7 or later." |
160 |
- eerror "Please use gcc-config to switch to gcc-4.7 or later version." |
161 |
- die |
162 |
- fi |
163 |
- fi |
164 |
- if has test ${FEATURES} && \ |
165 |
- use server && ! has userpriv ${FEATURES} ; then |
166 |
- eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
167 |
- fi |
168 |
- |
169 |
- # This should come after all of the die statements |
170 |
- enewgroup mysql 60 || die "problem adding 'mysql' group" |
171 |
- enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user" |
172 |
-} |
173 |
- |
174 |
-pkg_postinst() { |
175 |
- # Make sure the vars are correctly initialized |
176 |
- mysql_init_vars |
177 |
- |
178 |
- # Create log directory securely if it does not exist |
179 |
- [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}" |
180 |
- |
181 |
- if use server ; then |
182 |
- if use pam; then |
183 |
- einfo |
184 |
- elog "This install includes the PAM authentication plugin." |
185 |
- elog "To activate and configure the PAM plugin, please read:" |
186 |
- elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/" |
187 |
- einfo |
188 |
- fi |
189 |
- |
190 |
- if [[ -z "${REPLACING_VERSIONS}" ]] ; then |
191 |
- einfo |
192 |
- elog "You might want to run:" |
193 |
- elog "\"emerge --config =${CATEGORY}/${PF}\"" |
194 |
- elog "if this is a new install." |
195 |
- elog |
196 |
- elog "If you are switching server implentations, you should run the" |
197 |
- elog "mysql_upgrade tool." |
198 |
- einfo |
199 |
- else |
200 |
- einfo |
201 |
- elog "If you are upgrading major versions, you should run the" |
202 |
- elog "mysql_upgrade tool." |
203 |
- einfo |
204 |
- fi |
205 |
- |
206 |
- einfo |
207 |
- elog "Be sure to edit the my.cnf file to activate your cluster settings." |
208 |
- elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\"" |
209 |
- elog "The first time the cluster is activated, you should add" |
210 |
- elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node." |
211 |
- elog "This option should then be removed for subsequent starts." |
212 |
- einfo |
213 |
- fi |
214 |
-} |
215 |
- |
216 |
-src_unpack() { |
217 |
- unpack ${A} |
218 |
- # Grab the patches |
219 |
- [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR%/}/mysql-extras" git-r3_src_unpack |
220 |
- |
221 |
- mv -f "${WORKDIR%/}/${P}" "${S}" || die |
222 |
-} |
223 |
- |
224 |
-src_prepare() { |
225 |
- _disable_engine() { |
226 |
- echo > "${S%/}/storage/${1}/CMakeLists.txt" || die |
227 |
- } |
228 |
- |
229 |
- _disable_plugin() { |
230 |
- echo > "${S%/}/plugin/${1}/CMakeLists.txt" || die |
231 |
- } |
232 |
- |
233 |
- if use tcmalloc; then |
234 |
- echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S%/}/sql/CMakeLists.txt" || die |
235 |
- fi |
236 |
- |
237 |
- # Don't build bundled xz-utils for tokudb |
238 |
- echo > "${S%/}/storage/tokudb/ft-index/cmake_modules/TokuThirdParty.cmake" || die |
239 |
- sed -i -e 's/ build_lzma//' "${S%/}/storage/tokudb/ft-index/ft/CMakeLists.txt" || die |
240 |
- sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S%/}/storage/tokudb/ft-index/portability/CMakeLists.txt" || die |
241 |
- |
242 |
- local plugin |
243 |
- local server_plugins=( handler_socket auth_socket feedback qc_info server_audit semisync sql_errlog ) |
244 |
- local test_plugins=( audit_null auth_examples daemon_example fulltext ) |
245 |
- if ! use server; then # These plugins are for the server |
246 |
- for plugin in "${server_plugins[@]}" ; do |
247 |
- _disable_plugin "${plugin}" |
248 |
- done |
249 |
- fi |
250 |
- |
251 |
- if ! use test; then # These plugins are only used during testing |
252 |
- for plugin in "${test_plugins[@]}" ; do |
253 |
- _disable_plugin "${plugin}" |
254 |
- done |
255 |
- fi |
256 |
- |
257 |
- # Collides with mariadb-connector-c bug 655980 |
258 |
- _disable_plugin auth_dialog |
259 |
- |
260 |
- # Don't build example |
261 |
- _disable_engine example |
262 |
- |
263 |
- if ! use oqgraph ; then # avoids extra library checks |
264 |
- _disable_engine oqgraph |
265 |
- fi |
266 |
- |
267 |
- cmake-utils_src_prepare |
268 |
-} |
269 |
- |
270 |
-src_configure(){ |
271 |
- # bug 508724 mariadb cannot use ld.gold |
272 |
- tc-ld-disable-gold |
273 |
- # Bug #114895, bug #110149 |
274 |
- filter-flags "-O" "-O[01]" |
275 |
- |
276 |
- append-cxxflags -felide-constructors |
277 |
- |
278 |
- # bug #283926, with GCC4.4, this is required to get correct behavior. |
279 |
- append-flags -fno-strict-aliasing |
280 |
- |
281 |
- CMAKE_BUILD_TYPE="RelWithDebInfo" |
282 |
- |
283 |
- # debug hack wrt #497532 |
284 |
- mycmakeargs=( |
285 |
- -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
286 |
- -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
287 |
- -DCMAKE_INSTALL_PREFIX="${EPREFIX%/}/usr" |
288 |
- -DDEFAULT_SYSCONFDIR="${EPREFIX%/}/etc/mysql" |
289 |
- -DINSTALL_BINDIR=bin |
290 |
- -DINSTALL_DOCDIR=share/doc/${PF} |
291 |
- -DINSTALL_DOCREADMEDIR=share/doc/${PF} |
292 |
- -DINSTALL_INCLUDEDIR=include/mysql |
293 |
- -DINSTALL_INFODIR=share/info |
294 |
- -DINSTALL_LIBDIR=$(get_libdir) |
295 |
- -DINSTALL_MANDIR=share/man |
296 |
- -DINSTALL_MYSQLSHAREDIR=share/mariadb |
297 |
- -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin |
298 |
- -DINSTALL_SCRIPTDIR=share/mariadb/scripts |
299 |
- -DINSTALL_MYSQLDATADIR="${EPREFIX%/}/var/lib/mysql" |
300 |
- -DINSTALL_SBINDIR=sbin |
301 |
- -DINSTALL_SUPPORTFILESDIR="${EPREFIX%/}/usr/share/mariadb" |
302 |
- -DCOMPILATION_COMMENT="Gentoo Linux ${PF}" |
303 |
- -DWITH_UNIT_TESTS=$(usex test ON OFF) |
304 |
- -DWITH_ZLIB=system |
305 |
- -DENABLED_LOCAL_INFILE=1 |
306 |
- -DMYSQL_UNIX_ADDR="${EPREFIX%/}/var/run/mysqld/mysqld.sock" |
307 |
- -DINSTALL_UNIX_ADDRDIR="${EPREFIX%/}/var/run/mysqld/mysqld.sock" |
308 |
- # The build forces this to be defined when cross-compiling. We pass it |
309 |
- # all the time for simplicity and to make sure it is actually correct. |
310 |
- -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) |
311 |
- -DWITHOUT_CLIENTLIBS=YES |
312 |
- -DWITH_READLINE=$(usex bindist 1 0) |
313 |
- -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1) |
314 |
- -DENABLE_DTRACE=$(usex systemtap) |
315 |
- ) |
316 |
- if use test ; then |
317 |
- mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test ) |
318 |
- else |
319 |
- mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' ) |
320 |
- fi |
321 |
- |
322 |
- if ! use yassl ; then |
323 |
- mycmakeargs+=( -DWITH_SSL=system ) |
324 |
- else |
325 |
- mycmakeargs+=( -DWITH_SSL=bundled ) |
326 |
- fi |
327 |
- |
328 |
- if use server ; then |
329 |
- |
330 |
- # Federated{,X} must be treated special otherwise they will not be built as plugins |
331 |
- if ! use extraengine ; then |
332 |
- mycmakeargs+=( |
333 |
- -DWITHOUT_FEDERATED_STORAGE_ENGINE=1 |
334 |
- -DWITHOUT_FEDERATEDX_STORAGE_ENGINE=1 ) |
335 |
- fi |
336 |
- |
337 |
- mycmakeargs+=( |
338 |
- -DWITH_JEMALLOC=$(usex jemalloc system) |
339 |
- -D$(usex sphinx WITH WITHOUT)_SPHINX_STORAGE_ENGINE=1 |
340 |
- -D$(usex tokudb WITH WITHOUT)_TOKUDB_STORAGE_ENGINE=1 |
341 |
- -D$(usex oqgraph WITH WITHOUT)_AUTH_PAM=1 |
342 |
- -DINSTALL_SQLBENCHDIR=share/mariadb |
343 |
- ) |
344 |
- |
345 |
- if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then |
346 |
- ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" |
347 |
- ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." |
348 |
- ewarn "You MUST file bugs without these variables set." |
349 |
- |
350 |
- mycmakeargs+=( |
351 |
- -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} |
352 |
- -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} |
353 |
- ) |
354 |
- |
355 |
- elif ! use latin1 ; then |
356 |
- mycmakeargs+=( |
357 |
- -DDEFAULT_CHARSET=utf8 |
358 |
- -DDEFAULT_COLLATION=utf8_general_ci |
359 |
- ) |
360 |
- else |
361 |
- mycmakeargs+=( |
362 |
- -DDEFAULT_CHARSET=latin1 |
363 |
- -DDEFAULT_COLLATION=latin1_swedish_ci |
364 |
- ) |
365 |
- fi |
366 |
- mycmakeargs+=( |
367 |
- -DEXTRA_CHARSETS=all |
368 |
- -DDISABLE_SHARED=$(usex static YES NO) |
369 |
- -DWITH_EMBEDDED_SERVER=OFF |
370 |
- -DENABLED_PROFILING=$(usex profiling) |
371 |
- ) |
372 |
- |
373 |
- if use static; then |
374 |
- mycmakeargs+=( -DWITH_PIC=1 ) |
375 |
- fi |
376 |
- |
377 |
- if use jemalloc || use tcmalloc ; then |
378 |
- mycmakeargs+=( -DWITH_SAFEMALLOC=OFF ) |
379 |
- fi |
380 |
- |
381 |
- # Storage engines |
382 |
- mycmakeargs+=( |
383 |
- -DWITH_ARCHIVE_STORAGE_ENGINE=1 |
384 |
- -DWITH_BLACKHOLE_STORAGE_ENGINE=1 |
385 |
- -DWITH_CSV_STORAGE_ENGINE=1 |
386 |
- -DWITH_HEAP_STORAGE_ENGINE=1 |
387 |
- -DWITH_INNOBASE_STORAGE_ENGINE=1 |
388 |
- -DWITH_MYISAMMRG_STORAGE_ENGINE=1 |
389 |
- -DWITH_MYISAM_STORAGE_ENGINE=1 |
390 |
- -DWITH_PARTITION_STORAGE_ENGINE=1 |
391 |
- ) |
392 |
- |
393 |
- else |
394 |
- mycmakeargs+=( |
395 |
- -DWITHOUT_SERVER=1 |
396 |
- -DEXTRA_CHARSETS=none |
397 |
- -DINSTALL_SQLBENCHDIR= |
398 |
- ) |
399 |
- fi |
400 |
- |
401 |
- cmake-utils_src_configure |
402 |
-} |
403 |
- |
404 |
-src_compile() { |
405 |
- cmake-utils_src_compile |
406 |
-} |
407 |
- |
408 |
-src_install() { |
409 |
- cmake-utils_src_install |
410 |
- |
411 |
- # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used |
412 |
- if [[ -f "${ED%/}/usr/include/mysql/server/private/config.h" ]] ; then |
413 |
- rm "${ED%/}/usr/include/mysql/server/private/config.h" || die |
414 |
- fi |
415 |
- |
416 |
- # Make sure the vars are correctly initialized |
417 |
- mysql_init_vars |
418 |
- |
419 |
- # Convenience links |
420 |
- einfo "Making Convenience links for mysqlcheck multi-call binary" |
421 |
- dosym "mysqlcheck" "/usr/bin/mysqlanalyze" |
422 |
- dosym "mysqlcheck" "/usr/bin/mysqlrepair" |
423 |
- dosym "mysqlcheck" "/usr/bin/mysqloptimize" |
424 |
- |
425 |
- # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir |
426 |
- if [[ -d "${ED%/}/usr/data" ]] ; then |
427 |
- rm -Rf "${ED%/}/usr/data" || die |
428 |
- fi |
429 |
- |
430 |
- # Unless they explicitly specific USE=test, then do not install the |
431 |
- # testsuite. It DOES have a use to be installed, esp. when you want to do a |
432 |
- # validation of your database configuration after tuning it. |
433 |
- if ! use test ; then |
434 |
- rm -rf "${D%/}/${MY_SHAREDSTATEDIR}/mysql-test" |
435 |
- fi |
436 |
- |
437 |
- # Configuration stuff |
438 |
- einfo "Building default configuration ..." |
439 |
- insinto "${MY_SYSCONFDIR#${EPREFIX}}" |
440 |
- [[ -f "${S%/}/scripts/mysqlaccess.conf" ]] && doins "${S%/}"/scripts/mysqlaccess.conf |
441 |
- local mycnf_src="my.cnf-5.5" |
442 |
- sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ |
443 |
- "${FILESDIR%/}/${mycnf_src}" \ |
444 |
- > "${TMPDIR%/}/my.cnf.ok" || die |
445 |
- use prefix && sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' "${TMPDIR%/}/my.cnf.ok" |
446 |
- if use latin1 ; then |
447 |
- sed -i \ |
448 |
- -e "/character-set/s|utf8|latin1|g" \ |
449 |
- "${TMPDIR%/}/my.cnf.ok" || die |
450 |
- fi |
451 |
- eprefixify "${TMPDIR%/}/my.cnf.ok" |
452 |
- newins "${TMPDIR}/my.cnf.ok" my.cnf |
453 |
- |
454 |
- if use server ; then |
455 |
- einfo "Including support files and sample configurations" |
456 |
- docinto "support-files" |
457 |
- local script |
458 |
- for script in \ |
459 |
- "${S%/}"/support-files/magic |
460 |
- do |
461 |
- [[ -f "$script" ]] && dodoc "${script}" |
462 |
- done |
463 |
- |
464 |
- docinto "scripts" |
465 |
- for script in "${S%/}"/scripts/mysql* ; do |
466 |
- [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}" |
467 |
- done |
468 |
- # Manually install supporting files that conflict with other packages |
469 |
- # but are needed for galera and initial installation |
470 |
- exeinto /usr/libexec/mariadb |
471 |
- doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror" |
472 |
- fi |
473 |
- |
474 |
- #Remove mytop if perl is not selected |
475 |
- [[ -e "${ED%/}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED%/}/usr/bin/mytop" |
476 |
-} |
477 |
- |
478 |
-# Official test instructions: |
479 |
-# USE='extraengine perl server' \ |
480 |
-# FEATURES='test userpriv -usersandbox' \ |
481 |
-# ebuild mariadb-X.X.XX.ebuild \ |
482 |
-# digest clean package |
483 |
-src_test() { |
484 |
- |
485 |
- _disable_test() { |
486 |
- local rawtestname reason |
487 |
- rawtestname="${1}" ; shift |
488 |
- reason="${@}" |
489 |
- ewarn "test '${rawtestname}' disabled: '${reason}'" |
490 |
- echo ${rawtestname} : ${reason} >> "${T}/disabled.def" |
491 |
- } |
492 |
- |
493 |
- local TESTDIR="${BUILD_DIR}/mysql-test" |
494 |
- local retstatus_unit |
495 |
- local retstatus_tests |
496 |
- |
497 |
- if ! use server ; then |
498 |
- einfo "Skipping server tests due to minimal build." |
499 |
- return 0 |
500 |
- fi |
501 |
- |
502 |
- # Bug #213475 - MySQL _will_ object strenously if your machine is named |
503 |
- # localhost. Also causes weird failures. |
504 |
- [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
505 |
- |
506 |
- if [[ $UID -eq 0 ]]; then |
507 |
- die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
508 |
- fi |
509 |
- has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox" |
510 |
- |
511 |
- einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" |
512 |
- |
513 |
- # Run CTest (test-units) |
514 |
- cmake-utils_src_test |
515 |
- retstatus_unit=$? |
516 |
- |
517 |
- # Ensure that parallel runs don't die |
518 |
- export MTR_BUILD_THREAD="$((${RANDOM} % 100))" |
519 |
- # Enable parallel testing, auto will try to detect number of cores |
520 |
- # You may set this by hand. |
521 |
- # The default maximum is 8 unless MTR_MAX_PARALLEL is increased |
522 |
- export MTR_PARALLEL="${MTR_PARALLEL:-auto}" |
523 |
- |
524 |
- # create directories because mysqladmin might run out of order |
525 |
- mkdir -p "${T}"/var-tests{,/log} || die |
526 |
- |
527 |
- # Run mysql tests |
528 |
- pushd "${TESTDIR}" > /dev/null || die |
529 |
- |
530 |
- touch "${T}/disabled.def" |
531 |
- # These are failing in MariaDB 5.5 for now and are believed to be |
532 |
- # false positives: |
533 |
- # |
534 |
- # main.information_schema, binlog.binlog_statement_insert_delayed, |
535 |
- # main.mysqld--help, funcs_1.is_triggers, funcs_1.is_tables_mysql, |
536 |
- # funcs_1.is_columns_mysql |
537 |
- # fails due to USE=-latin1 / utf8 default |
538 |
- # |
539 |
- # main.mysql_client_test, main.mysql_client_test_nonblock: |
540 |
- # segfaults at random under Portage only, suspect resource limits. |
541 |
- # |
542 |
- # archive.mysqlhotcopy_archive main.mysqlhotcopy_myisam |
543 |
- # fails due to bad cleanup of previous tests when run in parallel |
544 |
- # The tool is deprecated anyway |
545 |
- # Bug 532288 |
546 |
- |
547 |
- local t |
548 |
- for t in main.mysql_client_test main.mysql_client_test_nonblock \ |
549 |
- binlog.binlog_statement_insert_delayed main.information_schema \ |
550 |
- main.mysqld--help \ |
551 |
- archive.mysqlhotcopy_archive main.mysqlhotcopy_myisam \ |
552 |
- funcs_1.is_triggers funcs_1.is_tables_mysql funcs_1.is_columns_mysql ; do |
553 |
- _disable_test "$t" "False positives in Gentoo" |
554 |
- done |
555 |
- |
556 |
- if ! use client-libs ; then |
557 |
- _disable_test main.plugin_auth "Needs client libraries built" |
558 |
- fi |
559 |
- |
560 |
- # run mysql-test tests |
561 |
- perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" |
562 |
- retstatus_tests=$? |
563 |
- |
564 |
- popd > /dev/null || die |
565 |
- |
566 |
- # Cleanup is important for these testcases. |
567 |
- pkill -9 -f "${S}/ndb" 2>/dev/null |
568 |
- pkill -9 -f "${S}/sql" 2>/dev/null |
569 |
- |
570 |
- local failures="" |
571 |
- [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" |
572 |
- [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" |
573 |
- |
574 |
- [[ -z "$failures" ]] || die "Test failures: $failures" |
575 |
- einfo "Tests successfully completed" |
576 |
-} |
577 |
- |
578 |
-mysql_init_vars() { |
579 |
- MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"} |
580 |
- MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} |
581 |
- MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} |
582 |
- MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"} |
583 |
- |
584 |
- if [[ -z "${MY_DATADIR}" ]] ; then |
585 |
- MY_DATADIR="" |
586 |
- if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then |
587 |
- MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
588 |
- | sed -ne '/datadir/s|^--datadir=||p' \ |
589 |
- | tail -n1` |
590 |
- if [[ -z "${MY_DATADIR}" ]] ; then |
591 |
- MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ |
592 |
- | sed -e 's/.*=\s*//' \ |
593 |
- | tail -n1` |
594 |
- fi |
595 |
- fi |
596 |
- if [[ -z "${MY_DATADIR}" ]] ; then |
597 |
- MY_DATADIR="${MY_LOCALSTATEDIR}" |
598 |
- einfo "Using default MY_DATADIR" |
599 |
- fi |
600 |
- elog "MySQL MY_DATADIR is ${MY_DATADIR}" |
601 |
- |
602 |
- if [[ -z "${PREVIOUS_DATADIR}" ]] ; then |
603 |
- if [[ -e "${MY_DATADIR}" ]] ; then |
604 |
- # If you get this and you're wondering about it, see bug #207636 |
605 |
- elog "MySQL datadir found in ${MY_DATADIR}" |
606 |
- elog "A new one will not be created." |
607 |
- PREVIOUS_DATADIR="yes" |
608 |
- else |
609 |
- PREVIOUS_DATADIR="no" |
610 |
- fi |
611 |
- export PREVIOUS_DATADIR |
612 |
- fi |
613 |
- else |
614 |
- if [[ ${EBUILD_PHASE} == "config" ]]; then |
615 |
- local new_MY_DATADIR |
616 |
- new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
617 |
- | sed -ne '/datadir/s|^--datadir=||p' \ |
618 |
- | tail -n1` |
619 |
- |
620 |
- if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then |
621 |
- ewarn "MySQL MY_DATADIR has changed" |
622 |
- ewarn "from ${MY_DATADIR}" |
623 |
- ewarn "to ${new_MY_DATADIR}" |
624 |
- MY_DATADIR="${new_MY_DATADIR}" |
625 |
- fi |
626 |
- fi |
627 |
- fi |
628 |
- |
629 |
- export MY_SHAREDSTATEDIR MY_SYSCONFDIR |
630 |
- export MY_LOCALSTATEDIR MY_LOGDIR |
631 |
- export MY_DATADIR |
632 |
-} |
633 |
- |
634 |
-pkg_config() { |
635 |
- _getoptval() { |
636 |
- local mypd="${EROOT}"/usr/bin/my_print_defaults |
637 |
- local section="$1" |
638 |
- local flag="--${2}=" |
639 |
- local extra_options="${3}" |
640 |
- "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp" |
641 |
- } |
642 |
- local old_MY_DATADIR="${MY_DATADIR}" |
643 |
- local old_HOME="${HOME}" |
644 |
- # my_print_defaults needs to read stuff in $HOME/.my.cnf |
645 |
- export HOME=${EPREFIX}/root |
646 |
- |
647 |
- # Make sure the vars are correctly initialized |
648 |
- mysql_init_vars |
649 |
- |
650 |
- [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR" |
651 |
- if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then |
652 |
- die "Minimal builds do NOT include the MySQL server" |
653 |
- fi |
654 |
- |
655 |
- if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then |
656 |
- local MY_DATADIR_s="${ROOT}/${MY_DATADIR}" |
657 |
- MY_DATADIR_s="${MY_DATADIR_s%%/}" |
658 |
- local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}" |
659 |
- old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}" |
660 |
- |
661 |
- if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then |
662 |
- if [[ -d "${MY_DATADIR_s}" ]]; then |
663 |
- ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist" |
664 |
- ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}" |
665 |
- else |
666 |
- elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}" |
667 |
- mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \ |
668 |
- || die "Moving MY_DATADIR failed" |
669 |
- fi |
670 |
- else |
671 |
- ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist" |
672 |
- if [[ -d "${MY_DATADIR_s}" ]]; then |
673 |
- ewarn "Attempting to use ${MY_DATADIR_s}" |
674 |
- else |
675 |
- eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist" |
676 |
- die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}" |
677 |
- fi |
678 |
- fi |
679 |
- fi |
680 |
- |
681 |
- local pwd1="a" |
682 |
- local pwd2="b" |
683 |
- local maxtry=15 |
684 |
- |
685 |
- if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then |
686 |
- local tmp_mysqld_password_source= |
687 |
- |
688 |
- for tmp_mysqld_password_source in mysql client; do |
689 |
- einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." |
690 |
- MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" |
691 |
- if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then |
692 |
- if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then |
693 |
- ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" |
694 |
- MYSQL_ROOT_PASSWORD= |
695 |
- continue |
696 |
- fi |
697 |
- |
698 |
- einfo "Found password in '${tmp_mysqld_password_source}' section!" |
699 |
- break |
700 |
- fi |
701 |
- done |
702 |
- |
703 |
- # Sometimes --show is required to display passwords in some implementations of my_print_defaults |
704 |
- if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then |
705 |
- MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" |
706 |
- fi |
707 |
- |
708 |
- unset tmp_mysqld_password_source |
709 |
- fi |
710 |
- MYSQL_TMPDIR="$(_getoptval mysqld tmpdir)" |
711 |
- # These are dir+prefix |
712 |
- MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log)" |
713 |
- MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} |
714 |
- MYSQL_LOG_BIN="$(_getoptval mysqld log-bin)" |
715 |
- MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} |
716 |
- |
717 |
- if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then |
718 |
- einfo "Creating MySQL tmpdir $MYSQL_TMPDIR" |
719 |
- install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR" |
720 |
- fi |
721 |
- if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then |
722 |
- einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN" |
723 |
- install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN" |
724 |
- fi |
725 |
- if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then |
726 |
- einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG" |
727 |
- install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG" |
728 |
- fi |
729 |
- |
730 |
- if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then |
731 |
- ewarn "You have already a MySQL database in place." |
732 |
- ewarn "(${ROOT}/${MY_DATADIR}/*)" |
733 |
- ewarn "Please rename or delete it if you wish to replace it." |
734 |
- die "MySQL database already exists!" |
735 |
- fi |
736 |
- |
737 |
- # Bug #213475 - MySQL _will_ object strenously if your machine is named |
738 |
- # localhost. Also causes weird failures. |
739 |
- [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
740 |
- |
741 |
- if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then |
742 |
- |
743 |
- einfo "Please provide a password for the mysql 'root' user now" |
744 |
- einfo "or through the ${HOME}/.my.cnf file." |
745 |
- ewarn "Avoid [\"'\\_%] characters in the password" |
746 |
- read -rsp " >" pwd1 ; echo |
747 |
- |
748 |
- einfo "Retype the password" |
749 |
- read -rsp " >" pwd2 ; echo |
750 |
- |
751 |
- if [[ "x$pwd1" != "x$pwd2" ]] ; then |
752 |
- die "Passwords are not the same" |
753 |
- fi |
754 |
- MYSQL_ROOT_PASSWORD="${pwd1}" |
755 |
- unset pwd1 pwd2 |
756 |
- fi |
757 |
- |
758 |
- local options |
759 |
- local sqltmp="$(emktemp)" |
760 |
- |
761 |
- # Fix bug 446200. Don't reference host my.cnf, needs to come first, |
762 |
- # see https://bugs.mysql.com/bug.php?id=31312 |
763 |
- use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'" |
764 |
- |
765 |
- # Figure out which options we need to disable to do the setup |
766 |
- local helpfile="${TMPDIR}/mysqld-help" |
767 |
- "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null |
768 |
- for opt in grant-tables host-cache name-resolve networking slave-start \ |
769 |
- federated ssl log-bin relay-log slow-query-log external-locking \ |
770 |
- log-slave-updates \ |
771 |
- ; do |
772 |
- optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" |
773 |
- egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}" |
774 |
- done |
775 |
- |
776 |
- einfo "Creating the mysql database and setting proper permissions on it ..." |
777 |
- |
778 |
- # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it |
779 |
- PID_DIR="${EROOT}/var/run/mysqld" |
780 |
- if [[ ! -d "${PID_DIR}" ]]; then |
781 |
- install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory" |
782 |
- fi |
783 |
- |
784 |
- if [[ ! -d "${MY_DATADIR}" ]]; then |
785 |
- install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory" |
786 |
- fi |
787 |
- |
788 |
- pushd "${TMPDIR}" &>/dev/null || die |
789 |
- |
790 |
- # Filling timezones, see |
791 |
- # https://dev.mysql.com/doc/mysql/en/time-zone-support.html |
792 |
- "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null |
793 |
- |
794 |
- local cmd=( "${EROOT}usr/share/mariadb/scripts/mysql_install_db" ) |
795 |
- [[ -f "${cmd}" ]] || cmd=( "${EROOT}usr/bin/mysql_install_db" ) |
796 |
- cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" ) |
797 |
- einfo "Command: ${cmd[*]}" |
798 |
- su -s /bin/sh -c "${cmd[*]}" mysql \ |
799 |
- >"${TMPDIR}"/mysql_install_db.log 2>&1 |
800 |
- if [ $? -ne 0 ]; then |
801 |
- grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2 |
802 |
- die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log" |
803 |
- fi |
804 |
- popd &>/dev/null || die |
805 |
- [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \ |
806 |
- || die "MySQL databases not installed" |
807 |
- |
808 |
- use prefix || options="${options} --user=mysql" |
809 |
- |
810 |
- local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock" |
811 |
- local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid" |
812 |
- local mysqld="${EROOT}/usr/sbin/mysqld \ |
813 |
- ${options} \ |
814 |
- --log-warnings=0 \ |
815 |
- --basedir=${EROOT}/usr \ |
816 |
- --datadir=${ROOT}/${MY_DATADIR} \ |
817 |
- --max_allowed_packet=8M \ |
818 |
- --net_buffer_length=16K \ |
819 |
- --socket=${socket} \ |
820 |
- --pid-file=${pidfile} \ |
821 |
- --tmpdir=${ROOT}/${MYSQL_TMPDIR}" |
822 |
- #einfo "About to start mysqld: ${mysqld}" |
823 |
- ebegin "Starting mysqld" |
824 |
- einfo "Command ${mysqld}" |
825 |
- ${mysqld} & |
826 |
- rc=$? |
827 |
- while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do |
828 |
- maxtry=$((${maxtry}-1)) |
829 |
- echo -n "." |
830 |
- sleep 1 |
831 |
- done |
832 |
- eend $rc |
833 |
- |
834 |
- if ! [[ -S "${socket}" ]]; then |
835 |
- die "Completely failed to start up mysqld with: ${mysqld}" |
836 |
- fi |
837 |
- |
838 |
- ebegin "Setting root password" |
839 |
- # Do this from memory, as we don't want clear text passwords in temp files |
840 |
- local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES" |
841 |
- "${EROOT}/usr/bin/mysql" \ |
842 |
- "--socket=${socket}" \ |
843 |
- -hlocalhost \ |
844 |
- -e "${sql}" |
845 |
- eend $? |
846 |
- |
847 |
- if [[ -n "${sqltmp}" ]] ; then |
848 |
- ebegin "Loading \"zoneinfo\", this step may require a few seconds" |
849 |
- "${EROOT}/usr/bin/mysql" \ |
850 |
- "--socket=${socket}" \ |
851 |
- -hlocalhost \ |
852 |
- -uroot \ |
853 |
- --password="${MYSQL_ROOT_PASSWORD}" \ |
854 |
- mysql < "${sqltmp}" |
855 |
- rc=$? |
856 |
- eend $? |
857 |
- [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!" |
858 |
- fi |
859 |
- |
860 |
- # Stop the server and cleanup |
861 |
- einfo "Stopping the server ..." |
862 |
- kill $(< "${pidfile}" ) |
863 |
- rm -f "${sqltmp}" |
864 |
- wait %1 |
865 |
- einfo "Done" |
866 |
-} |