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