Gentoo Archives: gentoo-commits

From: Brian Evans <grknight@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-db/mariadb/
Date: Thu, 02 Nov 2017 14:01:50
Message-Id: 1509631292.661fc075392e437292cac82ecd004de95e68d31c.grknight@gentoo
1 commit: 661fc075392e437292cac82ecd004de95e68d31c
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Thu Nov 2 14:01:32 2017 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Thu Nov 2 14:01:32 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=661fc075
7
8 dev-db/mariadb: Drop old 10.2
9
10 Package-Manager: Portage-2.3.13, Repoman-2.3.4
11
12 dev-db/mariadb/Manifest | 1 -
13 dev-db/mariadb/mariadb-10.2.9.ebuild | 1006 ----------------------------------
14 2 files changed, 1007 deletions(-)
15
16 diff --git a/dev-db/mariadb/Manifest b/dev-db/mariadb/Manifest
17 index c880ad04625..e6d24d5842d 100644
18 --- a/dev-db/mariadb/Manifest
19 +++ b/dev-db/mariadb/Manifest
20 @@ -5,7 +5,6 @@ DIST mariadb-10.1.24.tar.gz 61780687 SHA256 b3df99ae5b1ec8cf6cede4cbc4ae3f54ce66
21 DIST mariadb-10.1.26.tar.gz 61887132 SHA256 ba88b1cb9967dea2909938a34ba89373b162b0d83e5c98a0f1c94540156bf73d SHA512 a7505c579728b58eb6a92bdee1f5dfea5c10c8389cb7a31eb99fe2c6bc416593925cf9708d3dec91ede12eb4e232098a0833af2185bdd60bc593c89d255f3c0b WHIRLPOOL 8fe0c23f70b441a1f8d32d1fedcd033443641288ef1a20c49fbedfe6f5da95cb82125faa68f676fd68c441d4bf096101f364e1b3976f54229f5d9d0d10edbe21
22 DIST mariadb-10.1.28.tar.gz 67559689 SHA256 292dc8fff420c4bdaf3a2c3381ec3c99292965db2b09de0d7fec414c00032bbd SHA512 ca10d28f6b966719c7488c2b4ba928b65cbe9dc32ccf2a28d29c4d0c2d46ea1c59c3e339230017b317132dcd216925a71769dfba80a7d6321079c74ac41926d8 WHIRLPOOL d8ff24346a9e8ada4a9ec0ea8fd7657ff4972d43347afb7a9d7725293437ba70e0035c365738084b1e4828344861f000bd963260176524da2188c2c3a1389f67
23 DIST mariadb-10.2.10.tar.gz 72388999 SHA256 5c7b83c4d2f7501ef9f187d8c97688a24fd3e53dc43bb388f8e1cead61a92fc2 SHA512 39c198009f8b19f4a08226ef9842b50e24636580b67c1c92d59c61cce3aa1edbd466e253c281dfcdfc58ab573ae9a59aaacb0ce3e8b82222043ddd849fc3e239 WHIRLPOOL b64e99254764556d6de947e254a45c5c2743d9e825ee109354b3101641048b3509dd26471abdb6f7b90f3a208ac7d2d13ad70cbb966e05ac49b26ef2ecb12e6e
24 -DIST mariadb-10.2.9.tar.gz 70858881 SHA256 12e0a01c52591ee77cf0f940fe65df024457fa16c70f08c6116048d576096124 SHA512 11ba0913144d7298ffa4c0a0128a3d1525a39b8205ffc580311751cf25a4e86159e46a32d3c8330c4ea028cdd50643eb5381651df654751ca3e4fb3d4698a373 WHIRLPOOL dba0a8dfd5079b314ffc399e116abf8582bdaf51657dfe6e72247ab92da874aca97af4ca27dbcfdca5634c926598a853b7a8ecd8a61fee453c2764085a05b949
25 DIST mariadb-5.5.58.tar.gz 45784323 SHA256 26fdf8784a51e5d6f7624c0f4528433a6188065dd1bf92ef69e27db6b0a41002 SHA512 c5c8b52c613a1a3f30de2cd1d8e390f8110b0891af78ee2a24ef2c4b7b8c5f2e140970ca89865e8277e7486dbfd0ad01c1fdbf8791c67a9793392247d68fec63 WHIRLPOOL b507f3aaaced5da716de1a131dc4e69ace6f2ccd2ac58614d3d722b46b0b271ab0a452aef03b78d499b961f39a057ece5169f5af6fcce2e840aecd77ebf9295e
26 DIST mysql-extras-20160721-1526Z.tar.bz2 301788 SHA256 45198f8adb4a61fdd89a5d3c7966ce2fe9241381510e1f7b93e793502a32dfcb SHA512 c7450039780e4e2684c932ba7c291c1de25dd1a64e4c6e88aa13b790768b4100955f36ae4a3bf983569ea23b43be02da6dad3d5985c1163ec9e8aa91f0efd85d WHIRLPOOL becdf0d4d7b8b5a269246d2fcf1bc09c4313046468b264f07394ae9f1de2f736ad3fff8cad35e544df7a3623688050e6fb9635dfea3876ea082d19cf9fe88927
27 DIST mysql-extras-20170310-1426Z.tar.bz2 307052 SHA256 23f5becec389fc49e7cf0d52c6c914cbc8d7e3fc5851ee38881ee6884ffc5732 SHA512 2dbb3e46f14fbd0be9ee0e3a8ff2e4d5325f9a9be332014ea556283c0bc5f53349952d267d6713fac5b54e3167a66ddd36f18b18b79ca6b68ede399399488157 WHIRLPOOL 9f459d9e58938597e7919b29fc819d87920a51461d274bf87520fe322a67ad8638ef19212855ba8e37507d3b160d29ecad0099f4632f078cc503e1be0f809fb4
28
29 diff --git a/dev-db/mariadb/mariadb-10.2.9.ebuild b/dev-db/mariadb/mariadb-10.2.9.ebuild
30 deleted file mode 100644
31 index cc434baea24..00000000000
32 --- a/dev-db/mariadb/mariadb-10.2.9.ebuild
33 +++ /dev/null
34 @@ -1,1006 +0,0 @@
35 -# Copyright 1999-2017 Gentoo Foundation
36 -# Distributed under the terms of the GNU General Public License v2
37 -
38 -EAPI="6"
39 -MY_EXTRAS_VER="20170926-1321Z"
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 cracklib debug embedded 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 !embedded )
77 - ?? ( tcmalloc jemalloc )
78 - static? ( yassl !pam )"
79 -
80 -# REMEMBER: also update eclass/mysql*.eclass before committing!
81 -KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
82 -
83 -# Shorten the path because the socket path length must be shorter than 107 chars
84 -# and we will run a mysql server during test phase
85 -S="${WORKDIR}/mysql"
86 -
87 -if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then
88 - MY_PATCH_DIR="${WORKDIR}/mysql-extras"
89 -else
90 - MY_PATCH_DIR="${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}"
91 -fi
92 -
93 -PATCHES=(
94 - "${MY_PATCH_DIR}"/20015_all_mariadb-pkgconfig-location.patch
95 - "${MY_PATCH_DIR}"/20018_all_mariadb-10.2.8-without-clientlibs-tools.patch
96 - "${MY_PATCH_DIR}"/20024_all_mariadb-10.2.6-mysql_st-regression.patch
97 - "${MY_PATCH_DIR}"/20025_all_mariadb-10.2.6-gssapi-detect.patch
98 - "${MY_PATCH_DIR}"/20026_all_mariadb-add-pkgdatadir.patch
99 -)
100 -
101 -# Be warned, *DEPEND are version-dependant
102 -# These are used for both runtime and compiletime
103 -# MULTILIB_USEDEP only set for libraries used by the client library
104 -COMMON_DEPEND="
105 - kernel_linux? (
106 - sys-process/procps:0=
107 - dev-libs/libaio:0=
108 - )
109 - >=sys-apps/sed-4
110 - >=sys-apps/texinfo-4.7-r1
111 - !dev-db/mariadb-connector-c[mysqlcompat]
112 - jemalloc? ( dev-libs/jemalloc:0= )
113 - tcmalloc? ( dev-util/google-perftools:0= )
114 - systemtap? ( >=dev-util/systemtap-1.3:0= )
115 - !yassl? (
116 - !libressl? ( >=dev-libs/openssl-1.0.0:0=[${MULTILIB_USEDEP},static-libs?] )
117 - libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP},static-libs?] )
118 - )
119 - >=sys-libs/zlib-1.2.3:0=[${MULTILIB_USEDEP},static-libs?]
120 - sys-libs/ncurses:0=
121 - mroonga? ( app-text/groonga-normalizer-mysql )
122 - kerberos? ( virtual/krb5[${MULTILIB_USEDEP}] )
123 - !bindist? (
124 - sys-libs/binutils-libs:0=
125 - >=sys-libs/readline-4.1:0=
126 - )
127 - server? (
128 - backup? ( app-arch/libarchive:0= )
129 - cracklib? ( sys-libs/cracklib:0= )
130 - extraengine? (
131 - odbc? ( dev-db/unixODBC:0= )
132 - xml? ( dev-libs/libxml2:2= )
133 - )
134 - innodb-lz4? ( app-arch/lz4 )
135 - innodb-lzo? ( dev-libs/lzo )
136 - innodb-snappy? ( app-arch/snappy )
137 - numa? ( sys-process/numactl )
138 - oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= )
139 - pam? ( virtual/pam:0= )
140 - systemd? ( sys-apps/systemd:= )
141 - tokudb? ( app-arch/snappy )
142 - )
143 - >=dev-libs/libpcre-8.35:3=
144 -"
145 -DEPEND="virtual/yacc
146 - static? ( sys-libs/ncurses[static-libs] )
147 - || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
148 - server? ( extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) ) )
149 - ${COMMON_DEPEND}"
150 -RDEPEND="selinux? ( sec-policy/selinux-mysql )
151 - abi_x86_32? ( !app-emulation/emul-linux-x86-db[-abi_x86_32(-)] )
152 - !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
153 - server? ( !prefix? ( dev-db/mysql-init-scripts ) )
154 - !<virtual/mysql-5.6-r9
155 - ${COMMON_DEPEND}
156 - server? ( galera? (
157 - sys-apps/iproute2
158 - =sys-cluster/galera-25*
159 - sst-rsync? ( sys-process/lsof )
160 - sst-mariabackup? ( net-misc/socat[ssl] )
161 - sst-xtrabackup? ( net-misc/socat[ssl] )
162 - ) )
163 - perl? ( !dev-db/mytop
164 - virtual/perl-Getopt-Long
165 - dev-perl/TermReadKey
166 - virtual/perl-Term-ANSIColor
167 - virtual/perl-Time-HiRes )
168 - server? ( extraengine? ( jdbc? ( >=virtual/jre-1.6 ) ) )
169 -"
170 -# For other stuff to bring us in
171 -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
172 -# xtrabackup-bin causes a circular dependency if DBD-mysql is not already installed
173 -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )
174 - server? ( ~virtual/mysql-5.6[embedded=,static=] )
175 - virtual/libmysqlclient:${SLOT}[${MULTILIB_USEDEP},static-libs=]
176 - server? ( galera? ( sst-xtrabackup? ( || ( >=dev-db/xtrabackup-bin-2.2.4 dev-db/percona-xtrabackup ) ) ) )"
177 -
178 -pkg_setup() {
179 - if [[ ${MERGE_TYPE} != binary ]] ; then
180 - local GCC_MAJOR_SET=$(gcc-major-version)
181 - local GCC_MINOR_SET=$(gcc-minor-version)
182 - if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \
183 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
184 - eerror "${PN} with tokudb needs to be built with gcc-4.7 or later."
185 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
186 - die
187 - fi
188 - # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
189 - # non x86{,_64} arches
190 - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
191 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
192 - eerror "${PN} needs to be built with gcc-4.7 or later."
193 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
194 - die
195 - fi
196 - fi
197 - java-pkg-opt-2_pkg_setup
198 - if has test ${FEATURES} && \
199 - use server && ! has userpriv ${FEATURES} ; then
200 - eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
201 - fi
202 -
203 - # This should come after all of the die statements
204 - enewgroup mysql 60 || die "problem adding 'mysql' group"
205 - enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
206 -}
207 -
208 -pkg_preinst() {
209 - java-pkg-opt-2_pkg_preinst
210 -
211 - # Here we need to see if the implementation switched client libraries
212 - # We check if this is a new instance of the package and a client library already exists
213 - local SHOW_ABI_MESSAGE libpath
214 - if [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}usr/$(get_libdir)/libmysqlclient.so" ]] ; then
215 - libpath=$(readlink "${EROOT}usr/$(get_libdir)/libmysqlclient.so")
216 - elog "Due to ABI changes when switching between different client libraries,"
217 - elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient."
218 - elog "Please run: revdep-rebuild --library ${libpath}"
219 - ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries"
220 - fi
221 -}
222 -
223 -pkg_postinst() {
224 - # Make sure the vars are correctly initialized
225 - mysql_init_vars
226 -
227 - # Create log directory securely if it does not exist
228 - [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
229 -
230 - if use server ; then
231 - if use pam; then
232 - einfo
233 - elog "This install includes the PAM authentication plugin."
234 - elog "To activate and configure the PAM plugin, please read:"
235 - elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/"
236 - einfo
237 - fi
238 -
239 - if [[ -z "${REPLACING_VERSIONS}" ]] ; then
240 - einfo
241 - elog "You might want to run:"
242 - elog "\"emerge --config =${CATEGORY}/${PF}\""
243 - elog "if this is a new install."
244 - elog
245 - elog "If you are switching server implentations, you should run the"
246 - elog "mysql_upgrade tool."
247 - einfo
248 - else
249 - einfo
250 - elog "If you are upgrading major versions, you should run the"
251 - elog "mysql_upgrade tool."
252 - einfo
253 - fi
254 -
255 - if use galera ; then
256 - einfo
257 - elog "Be sure to edit the my.cnf file to activate your cluster settings."
258 - elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
259 - elog "The first time the cluster is activated, you should add"
260 - elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
261 - elog "This option should then be removed for subsequent starts."
262 - einfo
263 - fi
264 - fi
265 -
266 - # Note about configuration change
267 - einfo
268 - elog "This version of mariadb reorganizes the configuration from a single my.cnf"
269 - elog "to several files in /etc/mysql/${PN}.d."
270 - elog "Please backup any changes you made to /etc/mysql/my.cnf"
271 - elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension."
272 - elog "You may have as many files as needed and they are read alphabetically."
273 - elog "Be sure the options have the appropitate section headers, i.e. [mysqld]."
274 - einfo
275 -}
276 -
277 -src_unpack() {
278 -
279 - # Initialize the proper variables first
280 - mysql_init_vars
281 -
282 - unpack ${A}
283 - # Grab the patches
284 - [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack
285 -
286 - mv -f "${WORKDIR}/${P}" "${S}" || die
287 -}
288 -
289 -src_prepare() {
290 - java-pkg-opt-2_src_prepare
291 - if use tcmalloc; then
292 - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt"
293 - fi
294 -
295 - # Don't build bundled xz-utils for tokudb
296 - echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die
297 - sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die
298 - sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die
299 -
300 - # Remove the bundled groonga
301 - # There is no CMake flag, it simply checks for existance
302 - rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga"
303 -
304 - cmake-utils_src_prepare
305 -}
306 -
307 -src_configure(){
308 - # bug 508724 mariadb cannot use ld.gold
309 - tc-ld-disable-gold
310 - # Bug #114895, bug #110149
311 - filter-flags "-O" "-O[01]"
312 -
313 - append-cxxflags -felide-constructors
314 -
315 - # bug #283926, with GCC4.4, this is required to get correct behavior.
316 - append-flags -fno-strict-aliasing
317 -
318 - multilib-minimal_src_configure
319 -}
320 -
321 -multilib_src_configure() {
322 - debug-print-function ${FUNCNAME} "$@"
323 -
324 - CMAKE_BUILD_TYPE="RelWithDebInfo"
325 -
326 - # debug hack wrt #497532
327 - mycmakeargs=(
328 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
329 - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
330 - -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr"
331 - -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql"
332 - -DSYSCONFDIR="${EPREFIX}/etc/mysql"
333 - -DINSTALL_BINDIR=bin
334 - -DINSTALL_DOCDIR=share/doc/${PF}
335 - -DINSTALL_DOCREADMEDIR=share/doc/${PF}
336 - -DINSTALL_INCLUDEDIR=include/mysql
337 - -DINSTALL_INFODIR=share/info
338 - -DINSTALL_LIBDIR=$(get_libdir)
339 - -DINSTALL_MANDIR=share/man
340 - -DINSTALL_MYSQLSHAREDIR=share/mariadb
341 - -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin
342 - -DINSTALL_SCRIPTDIR=share/mariadb/scripts
343 - -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql"
344 - -DINSTALL_SBINDIR=sbin
345 - -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb"
346 - -DWITH_COMMENT="Gentoo Linux ${PF}"
347 - -DWITH_UNIT_TESTS=$(usex test ON OFF)
348 - -DWITH_LIBEDIT=0
349 - -DWITH_ZLIB=system
350 - -DWITHOUT_LIBWRAP=1
351 - -DENABLED_LOCAL_INFILE=1
352 - -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock"
353 - -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock"
354 - -DWITH_DEFAULT_COMPILER_OPTIONS=0
355 - -DWITH_DEFAULT_FEATURE_SET=0
356 - -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)"
357 - -DENABLE_STATIC_LIBS=$(usex static-libs ON OFF)
358 - # The build forces this to be defined when cross-compiling. We pass it
359 - # all the time for simplicity and to make sure it is actually correct.
360 - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
361 - -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)"
362 - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
363 - -DAUTH_GSSAPI_PLUGIN_TYPE=$(usex kerberos DYNAMIC OFF)
364 - -DCONC_WITH_EXTERNAL_ZLIB=YES
365 - -DWITH_EXTERNAL_ZLIB=YES
366 - -DSUFFIX_INSTALL_DIR=""
367 - -DWITH_UNITTEST=OFF
368 - )
369 - if use test ; then
370 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test )
371 - else
372 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
373 - fi
374 -
375 - if ! use yassl ; then
376 - mycmakeargs+=( -DWITH_SSL=system )
377 - else
378 - mycmakeargs+=( -DWITH_SSL=bundled )
379 - fi
380 -
381 - # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION
382 - # systemtap only works on native ABI bug 530132
383 - if multilib_is_native_abi; then
384 - mycmakeargs+=(
385 - -DWITH_READLINE=$(usex bindist 1 0)
386 - -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1)
387 - -DENABLE_DTRACE=$(usex systemtap)
388 - )
389 - else
390 - mycmakeargs+=(
391 - -DWITHOUT_TOOLS=1
392 - -DWITH_READLINE=1
393 - -DNOT_FOR_DISTRIBUTION=0
394 - -DENABLE_DTRACE=0
395 - )
396 - fi
397 -
398 - if multilib_is_native_abi && use server ; then
399 -
400 - # Federated{,X} must be treated special otherwise they will not be built as plugins
401 - if ! use extraengine ; then
402 - mycmakeargs+=(
403 - -DPLUGIN_FEDERATED=NO
404 - -DPLUGIN_FEDERATEDX=NO )
405 - fi
406 -
407 - mycmakeargs+=(
408 - -DWITH_JEMALLOC=$(usex jemalloc system)
409 - -DWITH_PCRE=system
410 - -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO)
411 - -DPLUGIN_SPHINX=$(usex sphinx YES NO)
412 - -DPLUGIN_TOKUDB=$(usex tokudb YES NO)
413 - -DPLUGIN_AUTH_PAM=$(usex pam YES NO)
414 - -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO)
415 - -DPLUGIN_CASSANDRA=NO
416 - -DPLUGIN_SEQUENCE=$(usex extraengine YES NO)
417 - -DPLUGIN_SPIDER=$(usex extraengine YES NO)
418 - -DPLUGIN_CONNECT=$(usex extraengine YES NO)
419 - -DCONNECT_WITH_MYSQL=1
420 - -DCONNECT_WITH_LIBXML2=$(usex xml)
421 - -DCONNECT_WITH_ODBC=$(usex odbc)
422 - -DCONNECT_WITH_JDBC=$(usex jdbc)
423 - -DWITH_WSREP=$(usex galera)
424 - -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF)
425 - -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF)
426 - -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF)
427 - -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO)
428 - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
429 - -DWITH_MARIABACKUP=$(usex backup ON OFF)
430 - -DWITH_LIBARCHIVE=$(usex backup ON OFF)
431 - -DINSTALL_SQLBENCHDIR=share/mariadb
432 - -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO)
433 - # systemd is only linked to for server notification
434 - -DWITH_SYSTEMD=$(usex systemd yes no)
435 - -DWITH_NUMA=$(usex numa ON OFF)
436 - )
437 - if use test ; then
438 - # This is needed for the new client lib which tests a real, open server
439 - mycmakeargs+=( -DSKIP_TESTS=ON )
440 - fi
441 -
442 - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
443 - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
444 - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
445 - ewarn "You MUST file bugs without these variables set."
446 -
447 - mycmakeargs+=(
448 - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
449 - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
450 - )
451 -
452 - elif ! use latin1 ; then
453 - mycmakeargs+=(
454 - -DDEFAULT_CHARSET=utf8
455 - -DDEFAULT_COLLATION=utf8_general_ci
456 - )
457 - else
458 - mycmakeargs+=(
459 - -DDEFAULT_CHARSET=latin1
460 - -DDEFAULT_COLLATION=latin1_swedish_ci
461 - )
462 - fi
463 - mycmakeargs+=(
464 - -DEXTRA_CHARSETS=all
465 - -DMYSQL_USER=mysql
466 - -DDISABLE_SHARED=$(usex static YES NO)
467 - -DWITH_DEBUG=$(usex debug)
468 - -DWITH_EMBEDDED_SERVER=$(usex embedded)
469 - -DWITH_PROFILING=$(usex profiling)
470 - )
471 -
472 - if use static; then
473 - mycmakeargs+=( -DWITH_PIC=1 )
474 - fi
475 -
476 - if use jemalloc || use tcmalloc ; then
477 - mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
478 - fi
479 -
480 - # Storage engines
481 - mycmakeargs+=(
482 - -DWITH_ARCHIVE_STORAGE_ENGINE=1
483 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1
484 - -DWITH_CSV_STORAGE_ENGINE=1
485 - -DWITH_HEAP_STORAGE_ENGINE=1
486 - -DWITH_INNOBASE_STORAGE_ENGINE=1
487 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1
488 - -DWITH_MYISAM_STORAGE_ENGINE=1
489 - -DWITH_PARTITION_STORAGE_ENGINE=1
490 - )
491 -
492 - else
493 - mycmakeargs+=(
494 - -DWITHOUT_SERVER=1
495 - -DWITHOUT_EMBEDDED_SERVER=1
496 - -DEXTRA_CHARSETS=none
497 - -DINSTALL_SQLBENCHDIR=
498 - -DWITH_SYSTEMD=no
499 - )
500 - fi
501 -
502 - cmake-utils_src_configure
503 -}
504 -
505 -src_compile() {
506 - multilib-minimal_src_compile
507 -}
508 -
509 -multilib_src_compile() {
510 - cmake-utils_src_compile
511 -}
512 -
513 -src_install() {
514 - # headers with ABI specific data
515 - local MULTILIB_WRAPPED_HEADERS=(
516 - /usr/include/mysql/server/my_config.h
517 - /usr/include/mysql/server/private/embedded_priv.h
518 - /usr/include/mysql/server/mysql_version.h
519 - /usr/include/mariadb/mariadb_version.h
520 - /usr/include/mysql/mariadb_version.h
521 - /usr/include/mysql/server/private/probes_mysql_nodtrace.h
522 - /usr/include/mysql/server/private/probes_mysql_dtrace.h )
523 -
524 - # wrap the config scripts
525 - local MULTILIB_CHOST_TOOLS=( /usr/bin/mariadb_config /usr/bin/mysql_config )
526 - multilib-minimal_src_install
527 -}
528 -
529 -# Intentionally override eclass function
530 -multilib_src_install() {
531 - cmake-utils_src_install
532 -
533 - # Make sure the vars are correctly initialized
534 - mysql_init_vars
535 -
536 - # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used
537 - if [[ -f "${D}/usr/include/mysql/server/private/config.h" ]] ; then
538 - rm "${D}/usr/include/mysql/server/private/config.h" || die
539 - fi
540 -
541 - if ! multilib_is_native_abi && use server ; then
542 - insinto /usr/include/mysql/server/private
543 - doins "${S}"/sql/*.h
544 - fi
545 -
546 - # Install compatible symlinks to libmysqlclient
547 -# use static-libs && dosym libmariadbclient.a "${EPREFIX}/usr/$(get_libdir)/libmysqlclient.a"
548 -# dosym libmariadb.so.3 "${EPREFIX}/usr/$(get_libdir)/libmysqlclient.so"
549 - dosym libmariadb.so.3 "${EPREFIX}/usr/$(get_libdir)/libmysqlclient.so.${SUBSLOT}"
550 -
551 - # Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them.
552 - find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die
553 -}
554 -
555 -multilib_src_install_all() {
556 - # Make sure the vars are correctly initialized
557 - mysql_init_vars
558 -
559 - # Convenience links
560 - einfo "Making Convenience links for mysqlcheck multi-call binary"
561 - dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
562 - dosym "mysqlcheck" "/usr/bin/mysqlrepair"
563 - dosym "mysqlcheck" "/usr/bin/mysqloptimize"
564 -
565 - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
566 - if [[ -d "${ED}/usr/data" ]] ; then
567 - rm -Rf "${ED}/usr/data" || die
568 - fi
569 -
570 - # Unless they explicitly specific USE=test, then do not install the
571 - # testsuite. It DOES have a use to be installed, esp. when you want to do a
572 - # validation of your database configuration after tuning it.
573 - if ! use test ; then
574 - rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
575 - fi
576 -
577 - # Configuration stuff
578 - einfo "Building default configuration ..."
579 - insinto "${MY_SYSCONFDIR#${EPREFIX}}"
580 - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
581 - cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die
582 - eprefixify "${TMPDIR}/my.cnf"
583 - doins "${TMPDIR}/my.cnf"
584 - insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d"
585 - cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
586 - eprefixify "${TMPDIR}/50-distro-client.cnf"
587 - doins "${TMPDIR}/50-distro-client.cnf"
588 -
589 - if use server ; then
590 - mycnf_src="my.cnf.distro-server"
591 - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
592 - "${FILESDIR}/${mycnf_src}" \
593 - > "${TMPDIR}/my.cnf.ok" || die
594 - if use prefix ; then
595 - sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
596 - "${TMPDIR}/my.cnf.ok" || die
597 - fi
598 - if use latin1 ; then
599 - sed -i \
600 - -e "/character-set/s|utf8|latin1|g" \
601 - "${TMPDIR}/my.cnf.ok" || die
602 - fi
603 - eprefixify "${TMPDIR}/my.cnf.ok"
604 - newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
605 -
606 - einfo "Including support files and sample configurations"
607 - docinto "support-files"
608 - local script
609 - for script in \
610 - "${S}"/support-files/magic
611 - do
612 - [[ -f "$script" ]] && dodoc "${script}"
613 - done
614 -
615 - docinto "scripts"
616 - for script in "${S}"/scripts/mysql* ; do
617 - [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
618 - done
619 - fi
620 -
621 - #Remove mytop if perl is not selected
622 - [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop"
623 -}
624 -
625 -# Official test instructions:
626 -# USE='extraengine perl server static-libs' \
627 -# FEATURES='test userpriv -usersandbox' \
628 -# ebuild mariadb-X.X.XX.ebuild \
629 -# digest clean package
630 -multilib_src_test() {
631 -
632 - if ! multilib_is_native_abi ; then
633 - einfo "Server tests not available on non-native abi".
634 - return 0;
635 - fi
636 -
637 - _disable_test() {
638 -
639 - local rawtestname testname testsuite reason mysql_disabled_file mysql_disabled_dir
640 - rawtestname="${1}" ; shift
641 - reason="${@}"
642 - ewarn "test '${rawtestname}' disabled: '${reason}'"
643 -
644 - testsuite="${rawtestname/.*}"
645 - testname="${rawtestname/*.}"
646 - for mysql_disabled_file in \
647 - "${S}/mysql-test/disabled.def" \
648 - "${S}/mysql-test/t/disabled.def" ; do
649 - [[ -f ${mysql_disabled_file} ]] && break
650 - done
651 - #mysql_disabled_file="${S}/mysql-test/t/disabled.def"
652 - #einfo "rawtestname=${rawtestname} testname=${testname} testsuite=${testsuite}"
653 - echo ${testname} : ${reason} >> "${mysql_disabled_file}"
654 -
655 - if [[ ( -n ${testsuite} ) && ( ${testsuite} != "main" ) ]]; then
656 - for mysql_disabled_file in \
657 - "${S}/mysql-test/suite/${testsuite}/disabled.def" \
658 - "${S}/mysql-test/suite/${testsuite}/t/disabled.def" \
659 - FAILED ; do
660 - [[ -f ${mysql_disabled_file} ]] && break
661 - done
662 - if [[ ${mysql_disabled_file} != "FAILED" ]]; then
663 - echo "${testname} : ${reason}" >> "${mysql_disabled_file}"
664 - else
665 - for mysql_disabled_dir in \
666 - "${S}/mysql-test/suite/${testsuite}" \
667 - "${S}/mysql-test/suite/${testsuite}/t" \
668 - FAILED ; do
669 - [[ -d ${mysql_disabled_dir} ]] && break
670 - done
671 - if [[ ${mysql_disabled_dir} != "FAILED" ]]; then
672 - echo "${testname} : ${reason}" >> "${mysql_disabled_dir}/disabled.def"
673 - else
674 - ewarn "Could not find testsuite disabled.def location for ${rawtestname}"
675 - fi
676 - fi
677 - fi
678 - }
679 -
680 - local TESTDIR="${BUILD_DIR}/mysql-test"
681 - local retstatus_unit
682 - local retstatus_tests
683 -
684 - if ! use server ; then
685 - einfo "Skipping server tests due to minimal build."
686 - return 0
687 - fi
688 -
689 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
690 - # localhost. Also causes weird failures.
691 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
692 -
693 - if [[ $UID -eq 0 ]]; then
694 - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
695 - fi
696 - has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox"
697 -
698 - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
699 -
700 - # Run CTest (test-units)
701 - cmake-utils_src_test
702 - retstatus_unit=$?
703 -
704 - # Ensure that parallel runs don't die
705 - export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
706 - # Enable parallel testing, auto will try to detect number of cores
707 - # You may set this by hand.
708 - # The default maximum is 8 unless MTR_MAX_PARALLEL is increased
709 - export MTR_PARALLEL="${MTR_PARALLEL:-auto}"
710 -
711 - # create directories because mysqladmin might run out of order
712 - mkdir -p "${T}"/var-tests{,/log} || die
713 -
714 - # Run mysql tests
715 - pushd "${TESTDIR}" > /dev/null || die
716 -
717 - # These are failing in MariaDB 10.0 for now and are believed to be
718 - # false positives:
719 - #
720 - # main.mysql_client_test, main.mysql_client_test_nonblock
721 - # main.mysql_client_test_comp:
722 - # segfaults at random under Portage only, suspect resource limits.
723 -
724 - local t
725 - for t in plugins.cracklib_password_check plugins.two_password_validations ; do
726 - _disable_test "$t" "False positive due to varying policies"
727 - done
728 -
729 - for t in main.mysql_client_test main.mysql_client_test_nonblock \
730 - main.mysql_client_test_comp ; do
731 - _disable_test "$t" "False positives in Gentoo"
732 - done
733 -
734 - # run mysql-test tests
735 - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder
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 -}