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