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: Mon, 30 Apr 2018 18:08:14
Message-Id: 1525111676.9f344aff9f95dd3c242ae2b9f6c8186eb9400fe2.grknight@gentoo
1 commit: 9f344aff9f95dd3c242ae2b9f6c8186eb9400fe2
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Mon Apr 30 18:02:50 2018 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Mon Apr 30 18:07:56 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9f344aff
7
8 dev-db/mariadb: Drop old
9
10 Package-Manager: Portage-2.3.31, Repoman-2.3.9
11
12 dev-db/mariadb/Manifest | 3 -
13 dev-db/mariadb/mariadb-10.2.12.ebuild | 976 -----------------------------
14 dev-db/mariadb/mariadb-10.2.13.ebuild | 1007 ------------------------------
15 dev-db/mariadb/mariadb-10.3.5_rc.ebuild | 1011 -------------------------------
16 4 files changed, 2997 deletions(-)
17
18 diff --git a/dev-db/mariadb/Manifest b/dev-db/mariadb/Manifest
19 index 5b97bc2ddae..7fcf6544175 100644
20 --- a/dev-db/mariadb/Manifest
21 +++ b/dev-db/mariadb/Manifest
22 @@ -5,10 +5,7 @@ DIST mariadb-10.1.24.tar.gz 61780687 BLAKE2B 38df67a1b26aab559e41f44b129f2e57388
23 DIST mariadb-10.1.29.tar.gz 67885370 BLAKE2B 40b94ed519522f16ee4687a9c569a0e52632d2aeccf65b87070de31118bf5e719cce78cf36afd4f1386166b14e418e0262ffbc3a61098c95e6ee101faf871ec5 SHA512 c169dfa2878f9fa9e0e9d12ca79fcbfa644e9b51bb0b78b8dd51d6c5679f3184d139fa96a1ddb25f3ae5d1c0489708c2c624f96a24020f77bf7e5247fac45ecd
24 DIST mariadb-10.1.31.tar.gz 67982786 BLAKE2B 1fabbea67345024157be4be34a50c4e9c73b1a60def452321b6e9209d9fb16aace92e7ab1c37c168e5c9f6c52b623245e9df3171ce3f84e8fd0e840948b3e57f SHA512 db37ddb8ae5daf35b37d5132860c19c4a9b51c40005d05c5107f956ac5b4ecd447375b6f3a09bf59ea5aef2f4009314ed6e969ca2ac516722702b4da286dbd89
25 DIST mariadb-10.1.32.tar.gz 68001321 BLAKE2B 8ecdf12b10697576b3550d962c6090726f515e0f1f99f786e2b8882e1b81c053e9e43e423f83afd6955357ef85cd539db6fb1ff613d3c553f2f3801293c7ee07 SHA512 fcaeb8005b08b3ac5b7c070f07fe669593bd8a2eb8ea1bbdcb4d8e9ba4856420039f39542ecf920eec352ee4a26179899f9c6cb1f9f26040f557ae4b4b63660a
26 -DIST mariadb-10.2.12.tar.gz 72818636 BLAKE2B 50a72b8096ae8bd5dc635352fc35d22322a0d7cf415e45883898307050ec547a79c66d51ab0ce311f1895eb178afeb49664fb434af77f9ff2b9aedef0aea85bc SHA512 8d3d3c84d4a01d6047e4f2b6802eb802e1f6a7b0e10e981c7ef9fdd27a5a25baab0af47a21b8637f4cbb9d21ef3bcc85097c5fdb8745c2a79040ab87fecb5a7b
27 -DIST mariadb-10.2.13.tar.gz 72591913 BLAKE2B 5abc3fefc5b02f099254b8a3a832a20793989a316efdc22b146cf78b5b83fcb3e4e617fce1b9161194e3f54b7bb469de3bb656319048fb137915af24e21f6aa2 SHA512 4c6038f134a32f50daa3172b367588240ef20a6f6cfe36d830e427cf52d315284481f5300d3db32d9e81ddd352dbea01fd4230f4e4d79e175d97c0c49331a4ca
28 DIST mariadb-10.2.14.tar.gz 72607526 BLAKE2B ca0c73e30e15265a7a1599d9bd4b64e030aaf92fcdbe18fda39eaf071c88c90b32a16ea5d9c63130e3853572a30a0c5870e6389e6dcb2a3eb690311cdb9bde3c SHA512 12195cc8c7a97619024d6b8b37558a43f4f543efff257a7a3dbb10e8a6e064ec2f0740554cf50cc83576b74ba355cf00f3c99855bc2bcf68b90c1fa90c850026
29 -DIST mariadb-10.3.5.tar.gz 70945381 BLAKE2B 10f5f08a64b3d046f8255a5ea9bb1661b7a88d130b0a89b41c8f98abbe3c04cc13154e1ad6c012ef97a396f055ca5d748998f1e7d6dc89ca73a3b61f70749457 SHA512 e7f2ffd38da4e4dbd214bc97e30216682b6f8ca368bcbd5717fb408a6110f26da4472cd7ac0d288c817eb9c6426a063cff8d582e03fe8a1219c0d70508e5a004
30 DIST mariadb-10.3.6.tar.gz 71064269 BLAKE2B 681150a26de95cc276276a9b8d0b2c6e4a842dac80f20c2e8b0caeec5823cb956feffb494d18b1f2832e220c392c437424813de7720fb83a5d5c1fca71a4aef9 SHA512 cf146752be5857e702a3c88f42c7b6be3117bd92ac304eb217f902c1ffe478dc3043d3cf6a9a9305b51babb3bafc2612a8e4f5dfa7731cfa53634014d86438d1
31 DIST mariadb-5.5.60.tar.gz 45822878 BLAKE2B 150a2d7108db2db18d66b56d961b05f8746f744e9453e341fde21f93bd846a3091a44c5df3baed6774d0ad12b8dc806b9bfdd177b4149f5be9d37af2a298f807 SHA512 eacf6ec57d46b00701b5038a67745174060d592b0e425466149c9a1b6dc1ac0659a36e57e82bf7e9f7865d8eac3dd50d0737630bd6220002d168b5b574437e4c
32 DIST mysql-extras-20160721-1526Z.tar.bz2 301788 BLAKE2B 23ef75d0122e9e18382f708a86c61624e0437fad593b7f02ccb2b3939d710404e18e3b70617ed400e5f6947d3a92d2867a5f7d98bf61597442e99989f60ca4f7 SHA512 c7450039780e4e2684c932ba7c291c1de25dd1a64e4c6e88aa13b790768b4100955f36ae4a3bf983569ea23b43be02da6dad3d5985c1163ec9e8aa91f0efd85d
33
34 diff --git a/dev-db/mariadb/mariadb-10.2.12.ebuild b/dev-db/mariadb/mariadb-10.2.12.ebuild
35 deleted file mode 100644
36 index 73d4cd9e20e..00000000000
37 --- a/dev-db/mariadb/mariadb-10.2.12.ebuild
38 +++ /dev/null
39 @@ -1,976 +0,0 @@
40 -# Copyright 1999-2018 Gentoo Foundation
41 -# Distributed under the terms of the GNU General Public License v2
42 -
43 -EAPI="6"
44 -MY_EXTRAS_VER="20170926-1321Z"
45 -SUBSLOT="18"
46 -
47 -JAVA_PKG_OPT_USE="jdbc"
48 -
49 -# Keeping eutils in EAPI=6 for emktemp in pkg_config
50 -
51 -inherit eutils systemd flag-o-matic prefix toolchain-funcs \
52 - java-pkg-opt-2 user cmake-utils multilib-minimal
53 -
54 -SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz "
55 -
56 -# Gentoo patches to MySQL
57 -if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then
58 - SRC_URI="${SRC_URI}
59 - mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
60 - https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
61 - https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
62 - https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
63 - https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
64 -fi
65 -
66 -HOMEPAGE="http://mariadb.org/"
67 -DESCRIPTION="An enhanced, drop-in replacement for MySQL"
68 -LICENSE="GPL-2 LGPL-2.1+"
69 -SLOT="0/${SUBSLOT:-0}"
70 -IUSE="+backup bindist cracklib debug embedded extraengine galera innodb-lz4
71 - innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 libressl mroonga
72 - numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx
73 - sst-rsync sst-mariabackup sst-xtrabackup static static-libs systemd systemtap tcmalloc
74 - test tokudb xml yassl"
75 -
76 -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
77 -RESTRICT="!bindist? ( bindist ) libressl? ( test )"
78 -
79 -REQUIRED_USE="jdbc? ( extraengine server !static )
80 - server? ( tokudb? ( jemalloc !tcmalloc ) )
81 - !server? ( !extraengine !embedded )
82 - ?? ( tcmalloc jemalloc )
83 - static? ( yassl !pam )"
84 -
85 -# REMEMBER: also update eclass/mysql*.eclass before committing!
86 -KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
87 -
88 -# Shorten the path because the socket path length must be shorter than 107 chars
89 -# and we will run a mysql server during test phase
90 -S="${WORKDIR}/mysql"
91 -
92 -if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then
93 - MY_PATCH_DIR="${WORKDIR}/mysql-extras"
94 -else
95 - MY_PATCH_DIR="${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}"
96 -fi
97 -
98 -PATCHES=(
99 - "${MY_PATCH_DIR}"/20015_all_mariadb-pkgconfig-location.patch
100 - "${MY_PATCH_DIR}"/20018_all_mariadb-10.2.8-without-clientlibs-tools.patch
101 - "${MY_PATCH_DIR}"/20024_all_mariadb-10.2.6-mysql_st-regression.patch
102 - "${MY_PATCH_DIR}"/20025_all_mariadb-10.2.6-gssapi-detect.patch
103 -)
104 -
105 -# Be warned, *DEPEND are version-dependant
106 -# These are used for both runtime and compiletime
107 -# MULTILIB_USEDEP only set for libraries used by the client library
108 -COMMON_DEPEND="
109 - kernel_linux? (
110 - sys-process/procps:0=
111 - dev-libs/libaio:0=
112 - )
113 - >=sys-apps/sed-4
114 - >=sys-apps/texinfo-4.7-r1
115 - !dev-db/mariadb-connector-c[mysqlcompat]
116 - jemalloc? ( dev-libs/jemalloc:0= )
117 - tcmalloc? ( dev-util/google-perftools:0= )
118 - systemtap? ( >=dev-util/systemtap-1.3:0= )
119 - !yassl? (
120 - !libressl? ( >=dev-libs/openssl-1.0.0:0=[${MULTILIB_USEDEP},static-libs?] )
121 - libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP},static-libs?] )
122 - )
123 - >=sys-libs/zlib-1.2.3:0=[${MULTILIB_USEDEP},static-libs?]
124 - sys-libs/ncurses:0=
125 - mroonga? ( app-text/groonga-normalizer-mysql )
126 - kerberos? ( virtual/krb5[${MULTILIB_USEDEP}] )
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 - numa? ( sys-process/numactl )
142 - oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= )
143 - pam? ( virtual/pam:0= )
144 - systemd? ( sys-apps/systemd:= )
145 - tokudb? ( app-arch/snappy )
146 - )
147 - >=dev-libs/libpcre-8.41-r1:3=
148 -"
149 -DEPEND="virtual/yacc
150 - static? ( sys-libs/ncurses[static-libs] )
151 - || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
152 - server? ( extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) ) )
153 - ${COMMON_DEPEND}"
154 -RDEPEND="selinux? ( sec-policy/selinux-mysql )
155 - !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
156 - server? ( !prefix? ( dev-db/mysql-init-scripts ) )
157 - !<virtual/mysql-5.6-r9
158 - ${COMMON_DEPEND}
159 - server? ( galera? (
160 - sys-apps/iproute2
161 - =sys-cluster/galera-25*
162 - sst-rsync? ( sys-process/lsof )
163 - sst-mariabackup? ( net-misc/socat[ssl] )
164 - sst-xtrabackup? ( net-misc/socat[ssl] )
165 - ) )
166 - perl? ( !dev-db/mytop
167 - virtual/perl-Getopt-Long
168 - dev-perl/TermReadKey
169 - virtual/perl-Term-ANSIColor
170 - virtual/perl-Time-HiRes )
171 - server? ( extraengine? ( jdbc? ( >=virtual/jre-1.6 ) ) )
172 -"
173 -# For other stuff to bring us in
174 -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
175 -# xtrabackup-bin causes a circular dependency if DBD-mysql is not already installed
176 -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )
177 - server? ( ~virtual/mysql-5.6[embedded=,static=] )
178 - virtual/libmysqlclient:${SLOT}[${MULTILIB_USEDEP},static-libs=]
179 - server? ( galera? ( sst-xtrabackup? ( || ( >=dev-db/xtrabackup-bin-2.2.4 dev-db/percona-xtrabackup ) ) ) )"
180 -
181 -pkg_setup() {
182 - if [[ ${MERGE_TYPE} != binary ]] ; then
183 - local GCC_MAJOR_SET=$(gcc-major-version)
184 - local GCC_MINOR_SET=$(gcc-minor-version)
185 - if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \
186 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
187 - eerror "${PN} with tokudb needs to be built with gcc-4.7 or later."
188 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
189 - die
190 - fi
191 - # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
192 - # non x86{,_64} arches
193 - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
194 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
195 - eerror "${PN} needs to be built with gcc-4.7 or later."
196 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
197 - die
198 - fi
199 - fi
200 - java-pkg-opt-2_pkg_setup
201 - if has test ${FEATURES} && \
202 - use server && ! has userpriv ${FEATURES} ; then
203 - eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
204 - fi
205 -
206 - # This should come after all of the die statements
207 - enewgroup mysql 60 || die "problem adding 'mysql' group"
208 - enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
209 -}
210 -
211 -pkg_preinst() {
212 - java-pkg-opt-2_pkg_preinst
213 -
214 - # Here we need to see if the implementation switched client libraries
215 - # We check if this is a new instance of the package and a client library already exists
216 - local SHOW_ABI_MESSAGE libpath
217 - if [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}usr/$(get_libdir)/libmysqlclient.so" ]] ; then
218 - libpath=$(readlink "${EROOT}usr/$(get_libdir)/libmysqlclient.so")
219 - elog "Due to ABI changes when switching between different client libraries,"
220 - elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient."
221 - elog "Please run: revdep-rebuild --library ${libpath}"
222 - ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries"
223 - fi
224 -}
225 -
226 -pkg_postinst() {
227 - # Make sure the vars are correctly initialized
228 - mysql_init_vars
229 -
230 - # Create log directory securely if it does not exist
231 - [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
232 -
233 - if use server ; then
234 - if use pam; then
235 - einfo
236 - elog "This install includes the PAM authentication plugin."
237 - elog "To activate and configure the PAM plugin, please read:"
238 - elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/"
239 - einfo
240 - fi
241 -
242 - if [[ -z "${REPLACING_VERSIONS}" ]] ; then
243 - einfo
244 - elog "You might want to run:"
245 - elog "\"emerge --config =${CATEGORY}/${PF}\""
246 - elog "if this is a new install."
247 - elog
248 - elog "If you are switching server implentations, you should run the"
249 - elog "mysql_upgrade tool."
250 - einfo
251 - else
252 - einfo
253 - elog "If you are upgrading major versions, you should run the"
254 - elog "mysql_upgrade tool."
255 - einfo
256 - fi
257 -
258 - if use galera ; then
259 - einfo
260 - elog "Be sure to edit the my.cnf file to activate your cluster settings."
261 - elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
262 - elog "The first time the cluster is activated, you should add"
263 - elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
264 - elog "This option should then be removed for subsequent starts."
265 - einfo
266 - fi
267 - fi
268 -
269 - # Note about configuration change
270 - einfo
271 - elog "This version of mariadb reorganizes the configuration from a single my.cnf"
272 - elog "to several files in /etc/mysql/${PN}.d."
273 - elog "Please backup any changes you made to /etc/mysql/my.cnf"
274 - elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension."
275 - elog "You may have as many files as needed and they are read alphabetically."
276 - elog "Be sure the options have the appropitate section headers, i.e. [mysqld]."
277 - einfo
278 -}
279 -
280 -src_unpack() {
281 -
282 - # Initialize the proper variables first
283 - mysql_init_vars
284 -
285 - unpack ${A}
286 - # Grab the patches
287 - [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack
288 -
289 - mv -f "${WORKDIR}/${P}" "${S}" || die
290 -}
291 -
292 -src_prepare() {
293 - java-pkg-opt-2_src_prepare
294 - if use tcmalloc; then
295 - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt"
296 - fi
297 -
298 - # Don't build bundled xz-utils for tokudb
299 - echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die
300 - sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die
301 - sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die
302 -
303 - # Remove the bundled groonga
304 - # There is no CMake flag, it simply checks for existance
305 - rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga"
306 -
307 - cmake-utils_src_prepare
308 -}
309 -
310 -src_configure(){
311 - # bug 508724 mariadb cannot use ld.gold
312 - tc-ld-disable-gold
313 - # Bug #114895, bug #110149
314 - filter-flags "-O" "-O[01]"
315 -
316 - append-cxxflags -felide-constructors
317 -
318 - # bug #283926, with GCC4.4, this is required to get correct behavior.
319 - append-flags -fno-strict-aliasing
320 -
321 - multilib-minimal_src_configure
322 -}
323 -
324 -multilib_src_configure() {
325 - debug-print-function ${FUNCNAME} "$@"
326 -
327 - CMAKE_BUILD_TYPE="RelWithDebInfo"
328 -
329 - # debug hack wrt #497532
330 - mycmakeargs=(
331 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
332 - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
333 - -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr"
334 - -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql"
335 - -DSYSCONFDIR="${EPREFIX}/etc/mysql"
336 - -DINSTALL_BINDIR=bin
337 - -DINSTALL_DOCDIR=share/doc/${PF}
338 - -DINSTALL_DOCREADMEDIR=share/doc/${PF}
339 - -DINSTALL_INCLUDEDIR=include/mysql
340 - -DINSTALL_INFODIR=share/info
341 - -DINSTALL_LIBDIR=$(get_libdir)
342 - -DINSTALL_MANDIR=share/man
343 - -DINSTALL_MYSQLSHAREDIR=share/mariadb
344 - -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin
345 - -DINSTALL_SCRIPTDIR=share/mariadb/scripts
346 - -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql"
347 - -DINSTALL_SBINDIR=sbin
348 - -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb"
349 - -DWITH_COMMENT="Gentoo Linux ${PF}"
350 - -DWITH_UNIT_TESTS=$(usex test ON OFF)
351 - -DWITH_LIBEDIT=0
352 - -DWITH_ZLIB=system
353 - -DWITHOUT_LIBWRAP=1
354 - -DENABLED_LOCAL_INFILE=1
355 - -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock"
356 - -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock"
357 - -DWITH_DEFAULT_COMPILER_OPTIONS=0
358 - -DWITH_DEFAULT_FEATURE_SET=0
359 - -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)"
360 - -DENABLE_STATIC_LIBS=$(usex static-libs ON OFF)
361 - # The build forces this to be defined when cross-compiling. We pass it
362 - # all the time for simplicity and to make sure it is actually correct.
363 - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
364 - -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)"
365 - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
366 - -DAUTH_GSSAPI_PLUGIN_TYPE=$(usex kerberos DYNAMIC OFF)
367 - -DCONC_WITH_EXTERNAL_ZLIB=YES
368 - -DWITH_EXTERNAL_ZLIB=YES
369 - -DSUFFIX_INSTALL_DIR=""
370 - -DWITH_UNITTEST=OFF
371 - )
372 - if use test ; then
373 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test )
374 - else
375 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
376 - fi
377 -
378 - if ! use yassl ; then
379 - mycmakeargs+=( -DWITH_SSL=system )
380 - else
381 - mycmakeargs+=( -DWITH_SSL=bundled )
382 - fi
383 -
384 - # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION
385 - # systemtap only works on native ABI bug 530132
386 - if multilib_is_native_abi; then
387 - mycmakeargs+=(
388 - -DWITH_READLINE=$(usex bindist 1 0)
389 - -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1)
390 - -DENABLE_DTRACE=$(usex systemtap)
391 - )
392 - else
393 - mycmakeargs+=(
394 - -DWITHOUT_TOOLS=1
395 - -DWITH_READLINE=1
396 - -DNOT_FOR_DISTRIBUTION=0
397 - -DENABLE_DTRACE=0
398 - )
399 - fi
400 -
401 - if multilib_is_native_abi && use server ; then
402 -
403 - # Federated{,X} must be treated special otherwise they will not be built as plugins
404 - if ! use extraengine ; then
405 - mycmakeargs+=(
406 - -DPLUGIN_FEDERATED=NO
407 - -DPLUGIN_FEDERATEDX=NO )
408 - fi
409 -
410 - mycmakeargs+=(
411 - -DWITH_JEMALLOC=$(usex jemalloc system)
412 - -DWITH_PCRE=system
413 - -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO)
414 - -DPLUGIN_SPHINX=$(usex sphinx YES NO)
415 - -DPLUGIN_TOKUDB=$(usex tokudb YES NO)
416 - -DPLUGIN_AUTH_PAM=$(usex pam YES NO)
417 - -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO)
418 - -DPLUGIN_CASSANDRA=NO
419 - -DPLUGIN_SEQUENCE=$(usex extraengine YES NO)
420 - -DPLUGIN_SPIDER=$(usex extraengine YES NO)
421 - -DPLUGIN_CONNECT=$(usex extraengine YES NO)
422 - -DCONNECT_WITH_MYSQL=1
423 - -DCONNECT_WITH_LIBXML2=$(usex xml)
424 - -DCONNECT_WITH_ODBC=$(usex odbc)
425 - -DCONNECT_WITH_JDBC=$(usex jdbc)
426 - # Build failure and autodep wrt bug 639144
427 - -DCONNECT_WITH_MONGO=OFF
428 - -DWITH_WSREP=$(usex galera)
429 - -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF)
430 - -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF)
431 - -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF)
432 - -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO)
433 - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
434 - -DWITH_MARIABACKUP=$(usex backup ON OFF)
435 - -DWITH_LIBARCHIVE=$(usex backup ON OFF)
436 - -DINSTALL_SQLBENCHDIR=share/mariadb
437 - -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO)
438 - # systemd is only linked to for server notification
439 - -DWITH_SYSTEMD=$(usex systemd yes no)
440 - -DWITH_NUMA=$(usex numa ON OFF)
441 - )
442 -
443 - # Workaround for MDEV-14524
444 - use tokudb && mycmakeargs+=( -DTOKUDB_OK=1 )
445 -
446 - if use test ; then
447 - # This is needed for the new client lib which tests a real, open server
448 - mycmakeargs+=( -DSKIP_TESTS=ON )
449 - fi
450 -
451 - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
452 - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
453 - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
454 - ewarn "You MUST file bugs without these variables set."
455 -
456 - mycmakeargs+=(
457 - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
458 - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
459 - )
460 -
461 - elif ! use latin1 ; then
462 - mycmakeargs+=(
463 - -DDEFAULT_CHARSET=utf8
464 - -DDEFAULT_COLLATION=utf8_general_ci
465 - )
466 - else
467 - mycmakeargs+=(
468 - -DDEFAULT_CHARSET=latin1
469 - -DDEFAULT_COLLATION=latin1_swedish_ci
470 - )
471 - fi
472 - mycmakeargs+=(
473 - -DEXTRA_CHARSETS=all
474 - -DMYSQL_USER=mysql
475 - -DDISABLE_SHARED=$(usex static YES NO)
476 - -DWITH_DEBUG=$(usex debug)
477 - -DWITH_EMBEDDED_SERVER=$(usex embedded)
478 - -DWITH_PROFILING=$(usex profiling)
479 - )
480 -
481 - if use static; then
482 - mycmakeargs+=( -DWITH_PIC=1 )
483 - fi
484 -
485 - if use jemalloc || use tcmalloc ; then
486 - mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
487 - fi
488 -
489 - # Storage engines
490 - mycmakeargs+=(
491 - -DWITH_ARCHIVE_STORAGE_ENGINE=1
492 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1
493 - -DWITH_CSV_STORAGE_ENGINE=1
494 - -DWITH_HEAP_STORAGE_ENGINE=1
495 - -DWITH_INNOBASE_STORAGE_ENGINE=1
496 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1
497 - -DWITH_MYISAM_STORAGE_ENGINE=1
498 - -DWITH_PARTITION_STORAGE_ENGINE=1
499 - )
500 -
501 - else
502 - mycmakeargs+=(
503 - -DWITHOUT_SERVER=1
504 - -DWITHOUT_EMBEDDED_SERVER=1
505 - -DEXTRA_CHARSETS=none
506 - -DINSTALL_SQLBENCHDIR=
507 - -DWITH_SYSTEMD=no
508 - )
509 - fi
510 -
511 - cmake-utils_src_configure
512 -}
513 -
514 -src_compile() {
515 - multilib-minimal_src_compile
516 -}
517 -
518 -multilib_src_compile() {
519 - cmake-utils_src_compile
520 -}
521 -
522 -src_install() {
523 - # headers with ABI specific data
524 - local MULTILIB_WRAPPED_HEADERS=(
525 - /usr/include/mysql/server/my_config.h
526 - /usr/include/mysql/server/private/embedded_priv.h
527 - /usr/include/mysql/server/mysql_version.h
528 - /usr/include/mariadb/mariadb_version.h
529 - /usr/include/mysql/mariadb_version.h
530 - /usr/include/mysql/server/private/probes_mysql_nodtrace.h
531 - /usr/include/mysql/server/private/probes_mysql_dtrace.h )
532 -
533 - # wrap the config scripts
534 - local MULTILIB_CHOST_TOOLS=( /usr/bin/mariadb_config /usr/bin/mysql_config )
535 - multilib-minimal_src_install
536 -}
537 -
538 -# Intentionally override eclass function
539 -multilib_src_install() {
540 - cmake-utils_src_install
541 -
542 - # Make sure the vars are correctly initialized
543 - mysql_init_vars
544 -
545 - # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used
546 - if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then
547 - rm "${ED}/usr/include/mysql/server/private/config.h" || die
548 - fi
549 -
550 - if ! multilib_is_native_abi && use server ; then
551 - insinto /usr/include/mysql/server/private
552 - doins "${S}"/sql/*.h
553 - fi
554 -
555 - # Install compatible symlinks to libmysqlclient
556 -# use static-libs && dosym libmariadbclient.a "/usr/$(get_libdir)/libmysqlclient.a"
557 -# dosym libmariadb.so.3 "/usr/$(get_libdir)/libmysqlclient.so"
558 - dosym libmariadb.so.3 "/usr/$(get_libdir)/libmysqlclient.so.${SUBSLOT}"
559 -
560 - # Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them.
561 - find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die
562 -}
563 -
564 -multilib_src_install_all() {
565 - # Make sure the vars are correctly initialized
566 - mysql_init_vars
567 -
568 - # Convenience links
569 - einfo "Making Convenience links for mysqlcheck multi-call binary"
570 - dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
571 - dosym "mysqlcheck" "/usr/bin/mysqlrepair"
572 - dosym "mysqlcheck" "/usr/bin/mysqloptimize"
573 -
574 - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
575 - if [[ -d "${ED}/usr/data" ]] ; then
576 - rm -Rf "${ED}/usr/data" || die
577 - fi
578 -
579 - # Unless they explicitly specific USE=test, then do not install the
580 - # testsuite. It DOES have a use to be installed, esp. when you want to do a
581 - # validation of your database configuration after tuning it.
582 - if ! use test ; then
583 - rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
584 - fi
585 -
586 - # Configuration stuff
587 - einfo "Building default configuration ..."
588 - insinto "${MY_SYSCONFDIR#${EPREFIX}}"
589 - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
590 - cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die
591 - eprefixify "${TMPDIR}/my.cnf"
592 - doins "${TMPDIR}/my.cnf"
593 - insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d"
594 - cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
595 - eprefixify "${TMPDIR}/50-distro-client.cnf"
596 - doins "${TMPDIR}/50-distro-client.cnf"
597 -
598 - if use server ; then
599 - mycnf_src="my.cnf.distro-server"
600 - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
601 - "${FILESDIR}/${mycnf_src}" \
602 - > "${TMPDIR}/my.cnf.ok" || die
603 - if use prefix ; then
604 - sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
605 - "${TMPDIR}/my.cnf.ok" || die
606 - fi
607 - if use latin1 ; then
608 - sed -i \
609 - -e "/character-set/s|utf8|latin1|g" \
610 - "${TMPDIR}/my.cnf.ok" || die
611 - fi
612 - eprefixify "${TMPDIR}/my.cnf.ok"
613 - newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
614 -
615 - einfo "Including support files and sample configurations"
616 - docinto "support-files"
617 - local script
618 - for script in \
619 - "${S}"/support-files/magic
620 - do
621 - [[ -f "$script" ]] && dodoc "${script}"
622 - done
623 -
624 - docinto "scripts"
625 - for script in "${S}"/scripts/mysql* ; do
626 - [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
627 - done
628 - fi
629 -
630 - #Remove mytop if perl is not selected
631 - [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop"
632 -}
633 -
634 -# Official test instructions:
635 -# USE='extraengine perl server static-libs' \
636 -# FEATURES='test userpriv -usersandbox' \
637 -# ebuild mariadb-X.X.XX.ebuild \
638 -# digest clean package
639 -multilib_src_test() {
640 -
641 - if ! multilib_is_native_abi ; then
642 - einfo "Server tests not available on non-native abi".
643 - return 0;
644 - fi
645 -
646 - _disable_test() {
647 - local rawtestname reason
648 - rawtestname="${1}" ; shift
649 - reason="${@}"
650 - ewarn "test '${rawtestname}' disabled: '${reason}'"
651 - echo ${rawtestname} : ${reason} >> "${T}/disabled.def"
652 - }
653 -
654 - local TESTDIR="${BUILD_DIR}/mysql-test"
655 - local retstatus_unit
656 - local retstatus_tests
657 -
658 - if ! use server ; then
659 - einfo "Skipping server tests due to minimal build."
660 - return 0
661 - fi
662 -
663 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
664 - # localhost. Also causes weird failures.
665 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
666 -
667 - if [[ $UID -eq 0 ]]; then
668 - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
669 - fi
670 - has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox"
671 -
672 - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
673 -
674 - # Run CTest (test-units)
675 - cmake-utils_src_test
676 - retstatus_unit=$?
677 -
678 - # Ensure that parallel runs don't die
679 - export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
680 - # Enable parallel testing, auto will try to detect number of cores
681 - # You may set this by hand.
682 - # The default maximum is 8 unless MTR_MAX_PARALLEL is increased
683 - export MTR_PARALLEL="${MTR_PARALLEL:-auto}"
684 -
685 - # create directories because mysqladmin might run out of order
686 - mkdir -p "${T}"/var-tests{,/log} || die
687 -
688 - # Run mysql tests
689 - pushd "${TESTDIR}" > /dev/null || die
690 -
691 - touch "${T}/disabled.def"
692 - # These are failing in MariaDB 10.0 for now and are believed to be
693 - # false positives:
694 - #
695 - # main.mysql_client_test, main.mysql_client_test_nonblock
696 - # main.mysql_client_test_comp:
697 - # segfaults at random under Portage only, suspect resource limits.
698 -
699 - local t
700 - for t in plugins.cracklib_password_check plugins.two_password_validations ; do
701 - _disable_test "$t" "False positive due to varying policies"
702 - done
703 -
704 - for t in main.mysql_client_test main.mysql_client_test_nonblock \
705 - main.mysql_client_test_comp rpl.rpl_extra_col_master_myisam ; do
706 - _disable_test "$t" "False positives in Gentoo"
707 - done
708 -
709 - # run mysql-test tests
710 - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def"
711 - retstatus_tests=$?
712 -
713 - popd > /dev/null || die
714 -
715 - # Cleanup is important for these testcases.
716 - pkill -9 -f "${S}/ndb" 2>/dev/null
717 - pkill -9 -f "${S}/sql" 2>/dev/null
718 -
719 - local failures=""
720 - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
721 - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
722 -
723 - [[ -z "$failures" ]] || die "Test failures: $failures"
724 - einfo "Tests successfully completed"
725 -}
726 -
727 -mysql_init_vars() {
728 - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"}
729 - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
730 - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
731 - MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
732 -
733 - if [[ -z "${MY_DATADIR}" ]] ; then
734 - MY_DATADIR=""
735 - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
736 - MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
737 - | sed -ne '/datadir/s|^--datadir=||p' \
738 - | tail -n1`
739 - if [[ -z "${MY_DATADIR}" ]] ; then
740 - MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
741 - | sed -e 's/.*=\s*//' \
742 - | tail -n1`
743 - fi
744 - fi
745 - if [[ -z "${MY_DATADIR}" ]] ; then
746 - MY_DATADIR="${MY_LOCALSTATEDIR}"
747 - einfo "Using default MY_DATADIR"
748 - fi
749 - elog "MySQL MY_DATADIR is ${MY_DATADIR}"
750 -
751 - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
752 - if [[ -e "${MY_DATADIR}" ]] ; then
753 - # If you get this and you're wondering about it, see bug #207636
754 - elog "MySQL datadir found in ${MY_DATADIR}"
755 - elog "A new one will not be created."
756 - PREVIOUS_DATADIR="yes"
757 - else
758 - PREVIOUS_DATADIR="no"
759 - fi
760 - export PREVIOUS_DATADIR
761 - fi
762 - else
763 - if [[ ${EBUILD_PHASE} == "config" ]]; then
764 - local new_MY_DATADIR
765 - new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
766 - | sed -ne '/datadir/s|^--datadir=||p' \
767 - | tail -n1`
768 -
769 - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
770 - ewarn "MySQL MY_DATADIR has changed"
771 - ewarn "from ${MY_DATADIR}"
772 - ewarn "to ${new_MY_DATADIR}"
773 - MY_DATADIR="${new_MY_DATADIR}"
774 - fi
775 - fi
776 - fi
777 -
778 - export MY_SHAREDSTATEDIR MY_SYSCONFDIR
779 - export MY_LOCALSTATEDIR MY_LOGDIR
780 - export MY_DATADIR
781 -}
782 -
783 -pkg_config() {
784 - _getoptval() {
785 - local mypd="${EROOT}"/usr/bin/my_print_defaults
786 - local section="$1"
787 - local flag="--${2}="
788 - local extra_options="${3}"
789 - "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp"
790 - }
791 - local old_MY_DATADIR="${MY_DATADIR}"
792 - local old_HOME="${HOME}"
793 - # my_print_defaults needs to read stuff in $HOME/.my.cnf
794 - export HOME=${EPREFIX}/root
795 -
796 - # Make sure the vars are correctly initialized
797 - mysql_init_vars
798 -
799 - [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
800 - if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then
801 - die "Minimal builds do NOT include the MySQL server"
802 - fi
803 -
804 - if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then
805 - local MY_DATADIR_s="${ROOT}/${MY_DATADIR}"
806 - MY_DATADIR_s="${MY_DATADIR_s%%/}"
807 - local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}"
808 - old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
809 -
810 - if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then
811 - if [[ -d "${MY_DATADIR_s}" ]]; then
812 - ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
813 - ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
814 - else
815 - elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
816 - mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
817 - || die "Moving MY_DATADIR failed"
818 - fi
819 - else
820 - ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
821 - if [[ -d "${MY_DATADIR_s}" ]]; then
822 - ewarn "Attempting to use ${MY_DATADIR_s}"
823 - else
824 - eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
825 - die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
826 - fi
827 - fi
828 - fi
829 -
830 - local pwd1="a"
831 - local pwd2="b"
832 - local maxtry=15
833 -
834 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
835 - local tmp_mysqld_password_source=
836 -
837 - for tmp_mysqld_password_source in mysql client; do
838 - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
839 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
840 - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then
841 - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then
842 - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
843 - MYSQL_ROOT_PASSWORD=
844 - continue
845 - fi
846 -
847 - einfo "Found password in '${tmp_mysqld_password_source}' section!"
848 - break
849 - fi
850 - done
851 -
852 - # Sometimes --show is required to display passwords in some implementations of my_print_defaults
853 - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then
854 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
855 - fi
856 -
857 - unset tmp_mysqld_password_source
858 - fi
859 - MYSQL_TMPDIR="$(_getoptval '--mysqld' tmpdir)"
860 - # These are dir+prefix
861 - MYSQL_RELAY_LOG="$(_getoptval '--mysqld' relay-log)"
862 - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
863 - MYSQL_LOG_BIN="$(_getoptval '--mysqld' log-bin)"
864 - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
865 -
866 - if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then
867 - einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
868 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR"
869 - fi
870 - if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then
871 - einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
872 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN"
873 - fi
874 - if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then
875 - einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
876 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG"
877 - fi
878 -
879 - if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then
880 - ewarn "You have already a MySQL database in place."
881 - ewarn "(${ROOT}/${MY_DATADIR}/*)"
882 - ewarn "Please rename or delete it if you wish to replace it."
883 - die "MySQL database already exists!"
884 - fi
885 -
886 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
887 - # localhost. Also causes weird failures.
888 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
889 -
890 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
891 -
892 - einfo "Please provide a password for the mysql 'root' user now"
893 - einfo "or through the ${HOME}/.my.cnf file."
894 - ewarn "Avoid [\"'\\_%] characters in the password"
895 - read -rsp " >" pwd1 ; echo
896 -
897 - einfo "Retype the password"
898 - read -rsp " >" pwd2 ; echo
899 -
900 - if [[ "x$pwd1" != "x$pwd2" ]] ; then
901 - die "Passwords are not the same"
902 - fi
903 - MYSQL_ROOT_PASSWORD="${pwd1}"
904 - unset pwd1 pwd2
905 - fi
906 -
907 - local options
908 - local sqltmp="$(emktemp)"
909 -
910 - # Fix bug 446200. Don't reference host my.cnf, needs to come first,
911 - # see http://bugs.mysql.com/bug.php?id=31312
912 - use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
913 -
914 - # Figure out which options we need to disable to do the setup
915 - local helpfile="${TMPDIR}/mysqld-help"
916 - "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
917 - for opt in grant-tables host-cache name-resolve networking slave-start \
918 - federated ssl log-bin relay-log slow-query-log external-locking \
919 - log-slave-updates \
920 - ; do
921 - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
922 - egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
923 - done
924 -
925 - einfo "Creating the mysql database and setting proper permissions on it ..."
926 -
927 - # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
928 - PID_DIR="${EROOT}/var/run/mysqld"
929 - if [[ ! -d "${PID_DIR}" ]]; then
930 - install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
931 - fi
932 -
933 - if [[ ! -d "${MY_DATADIR}" ]]; then
934 - install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory"
935 - fi
936 -
937 - pushd "${TMPDIR}" &>/dev/null || die
938 -
939 - # Filling timezones, see
940 - # http://dev.mysql.com/doc/mysql/en/time-zone-support.html
941 - "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null
942 -
943 - local cmd=( "${EROOT}usr/share/mariadb/scripts/mysql_install_db" )
944 - [[ -f "${cmd}" ]] || cmd=( "${EROOT}usr/bin/mysql_install_db" )
945 - cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" )
946 - einfo "Command: ${cmd[*]}"
947 - su -s /bin/sh -c "${cmd[*]}" mysql \
948 - >"${TMPDIR}"/mysql_install_db.log 2>&1
949 - if [ $? -ne 0 ]; then
950 - grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2
951 - die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log"
952 - fi
953 - popd &>/dev/null || die
954 - [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \
955 - || die "MySQL databases not installed"
956 -
957 - use prefix || options="${options} --user=mysql"
958 -
959 - local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock"
960 - local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid"
961 - local mysqld="${EROOT}/usr/sbin/mysqld \
962 - ${options} \
963 - --log-warnings=0 \
964 - --basedir=${EROOT}/usr \
965 - --datadir=${ROOT}/${MY_DATADIR} \
966 - --max_allowed_packet=8M \
967 - --net_buffer_length=16K \
968 - --socket=${socket} \
969 - --pid-file=${pidfile}
970 - --tmpdir=${ROOT}/${MYSQL_TMPDIR}"
971 - #einfo "About to start mysqld: ${mysqld}"
972 - ebegin "Starting mysqld"
973 - einfo "Command ${mysqld}"
974 - ${mysqld} &
975 - rc=$?
976 - while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
977 - maxtry=$((${maxtry}-1))
978 - echo -n "."
979 - sleep 1
980 - done
981 - eend $rc
982 -
983 - if ! [[ -S "${socket}" ]]; then
984 - die "Completely failed to start up mysqld with: ${mysqld}"
985 - fi
986 -
987 - ebegin "Setting root password"
988 - # Do this from memory, as we don't want clear text passwords in temp files
989 - local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES"
990 - "${EROOT}/usr/bin/mysql" \
991 - "--socket=${socket}" \
992 - -hlocalhost \
993 - -e "${sql}"
994 - eend $?
995 -
996 - if [[ -n "${sqltmp}" ]] ; then
997 - ebegin "Loading \"zoneinfo\", this step may require a few seconds"
998 - "${EROOT}/usr/bin/mysql" \
999 - "--socket=${socket}" \
1000 - -hlocalhost \
1001 - -uroot \
1002 - --password="${MYSQL_ROOT_PASSWORD}" \
1003 - mysql < "${sqltmp}"
1004 - rc=$?
1005 - eend $?
1006 - [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!"
1007 - fi
1008 -
1009 - # Stop the server and cleanup
1010 - einfo "Stopping the server ..."
1011 - kill $(< "${pidfile}" )
1012 - rm -f "${sqltmp}"
1013 - wait %1
1014 - einfo "Done"
1015 -}
1016
1017 diff --git a/dev-db/mariadb/mariadb-10.2.13.ebuild b/dev-db/mariadb/mariadb-10.2.13.ebuild
1018 deleted file mode 100644
1019 index 2eff8c74630..00000000000
1020 --- a/dev-db/mariadb/mariadb-10.2.13.ebuild
1021 +++ /dev/null
1022 @@ -1,1007 +0,0 @@
1023 -# Copyright 1999-2018 Gentoo Foundation
1024 -# Distributed under the terms of the GNU General Public License v2
1025 -
1026 -EAPI="6"
1027 -MY_EXTRAS_VER="20180308-1938Z"
1028 -SUBSLOT="18"
1029 -
1030 -JAVA_PKG_OPT_USE="jdbc"
1031 -
1032 -# Keeping eutils in EAPI=6 for emktemp in pkg_config
1033 -
1034 -inherit eutils systemd flag-o-matic prefix toolchain-funcs \
1035 - java-pkg-opt-2 user cmake-utils multilib-minimal
1036 -
1037 -SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz "
1038 -
1039 -# Gentoo patches to MySQL
1040 -if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then
1041 - SRC_URI="${SRC_URI}
1042 - mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
1043 - https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
1044 - https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
1045 - https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
1046 - https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
1047 -fi
1048 -
1049 -HOMEPAGE="http://mariadb.org/"
1050 -DESCRIPTION="An enhanced, drop-in replacement for MySQL"
1051 -LICENSE="GPL-2 LGPL-2.1+"
1052 -SLOT="0/${SUBSLOT:-0}"
1053 -IUSE="+backup bindist client-libs cracklib debug extraengine galera innodb-lz4
1054 - innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 libressl mroonga
1055 - numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx
1056 - sst-rsync sst-mariabackup sst-xtrabackup static static-libs systemd systemtap tcmalloc
1057 - test tokudb xml yassl"
1058 -
1059 -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
1060 -RESTRICT="!bindist? ( bindist ) libressl? ( test )"
1061 -
1062 -REQUIRED_USE="jdbc? ( extraengine server !static )
1063 - server? ( tokudb? ( jemalloc !tcmalloc ) )
1064 - !server? ( !extraengine )
1065 - ?? ( tcmalloc jemalloc )
1066 - static? ( yassl !pam )"
1067 -
1068 -KEYWORDS="~amd64 ~arm ~hppa ~ia64 ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
1069 -
1070 -# Shorten the path because the socket path length must be shorter than 107 chars
1071 -# and we will run a mysql server during test phase
1072 -S="${WORKDIR}/mysql"
1073 -
1074 -if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then
1075 - MY_PATCH_DIR="${WORKDIR}/mysql-extras"
1076 -else
1077 - MY_PATCH_DIR="${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}"
1078 -fi
1079 -
1080 -PATCHES=(
1081 - "${MY_PATCH_DIR}"/20015_all_mariadb-pkgconfig-location.patch
1082 - "${MY_PATCH_DIR}"/20018_all_mariadb-10.2.9-without-clientlibs-tools.patch
1083 - "${MY_PATCH_DIR}"/20024_all_mariadb-10.2.6-mysql_st-regression.patch
1084 - "${MY_PATCH_DIR}"/20025_all_mariadb-10.2.6-gssapi-detect.patch
1085 - "${MY_PATCH_DIR}"/20032_all_mariadb-10.2.12-fix-address-resolve.patch
1086 - "${MY_PATCH_DIR}"/20033_all_mariadb-10.1.31-xtradb-sst.patch
1087 -)
1088 -
1089 -# Be warned, *DEPEND are version-dependant
1090 -# These are used for both runtime and compiletime
1091 -# MULTILIB_USEDEP only set for libraries used by the client library
1092 -COMMON_DEPEND="
1093 - kernel_linux? (
1094 - sys-process/procps:0=
1095 - dev-libs/libaio:0=
1096 - )
1097 - >=sys-apps/sed-4
1098 - >=sys-apps/texinfo-4.7-r1
1099 - jemalloc? ( dev-libs/jemalloc:0= )
1100 - tcmalloc? ( dev-util/google-perftools:0= )
1101 - systemtap? ( >=dev-util/systemtap-1.3:0= )
1102 - !yassl? (
1103 - client-libs? (
1104 - !libressl? ( >=dev-libs/openssl-1.0.0:0=[${MULTILIB_USEDEP},static-libs?] )
1105 - libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP},static-libs?] )
1106 - )
1107 - !client-libs? (
1108 - !libressl? ( >=dev-libs/openssl-1.0.0:0= )
1109 - libressl? ( dev-libs/libressl:0= )
1110 - )
1111 - )
1112 - client-libs? ( >=sys-libs/zlib-1.2.3:0=[${MULTILIB_USEDEP},static-libs?]
1113 - kerberos? ( virtual/krb5[${MULTILIB_USEDEP}] )
1114 - )
1115 - !client-libs? ( >=sys-libs/zlib-1.2.3:0= kerberos? ( virtual/krb5 ) )
1116 - sys-libs/ncurses:0=
1117 - !bindist? (
1118 - sys-libs/binutils-libs:0=
1119 - >=sys-libs/readline-4.1:0=
1120 - )
1121 - server? (
1122 - backup? ( app-arch/libarchive:0= )
1123 - cracklib? ( sys-libs/cracklib:0= )
1124 - extraengine? (
1125 - odbc? ( dev-db/unixODBC:0= )
1126 - xml? ( dev-libs/libxml2:2= )
1127 - )
1128 - innodb-lz4? ( app-arch/lz4 )
1129 - innodb-lzo? ( dev-libs/lzo )
1130 - innodb-snappy? ( app-arch/snappy )
1131 - mroonga? ( app-text/groonga-normalizer-mysql )
1132 - numa? ( sys-process/numactl )
1133 - oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= )
1134 - pam? ( virtual/pam:0= )
1135 - systemd? ( sys-apps/systemd:= )
1136 - tokudb? ( app-arch/snappy )
1137 - )
1138 - >=dev-libs/libpcre-8.41-r1:3=
1139 -"
1140 -DEPEND="virtual/yacc
1141 - static? ( sys-libs/ncurses[static-libs] )
1142 - || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
1143 - server? ( extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) ) )
1144 - ${COMMON_DEPEND}"
1145 -RDEPEND="selinux? ( sec-policy/selinux-mysql )
1146 - client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c )
1147 - !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
1148 - server? ( !prefix? ( dev-db/mysql-init-scripts ) )
1149 - !<virtual/mysql-5.6-r9
1150 - ${COMMON_DEPEND}
1151 - server? ( galera? (
1152 - sys-apps/iproute2
1153 - =sys-cluster/galera-25*
1154 - sst-rsync? ( sys-process/lsof )
1155 - sst-mariabackup? ( net-misc/socat[ssl] )
1156 - sst-xtrabackup? ( net-misc/socat[ssl] )
1157 - ) )
1158 - perl? ( !dev-db/mytop
1159 - virtual/perl-Getopt-Long
1160 - dev-perl/TermReadKey
1161 - virtual/perl-Term-ANSIColor
1162 - virtual/perl-Time-HiRes )
1163 - server? ( extraengine? ( jdbc? ( >=virtual/jre-1.6 ) ) )
1164 -"
1165 -# For other stuff to bring us in
1166 -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
1167 -# xtrabackup-bin causes a circular dependency if DBD-mysql is not already installed
1168 -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )
1169 - !client-libs? ( dev-db/mariadb-connector-c[${MULTILIB_USEDEP}] dev-db/mysql-connector-c[${MULTILIB_USEDEP}] )
1170 - server? ( ~virtual/mysql-5.6[static=]
1171 - galera? ( sst-xtrabackup? ( || ( >=dev-db/xtrabackup-bin-2.2.4 dev-db/percona-xtrabackup ) ) ) )"
1172 -
1173 -pkg_setup() {
1174 - if [[ ${MERGE_TYPE} != binary ]] ; then
1175 - local GCC_MAJOR_SET=$(gcc-major-version)
1176 - local GCC_MINOR_SET=$(gcc-minor-version)
1177 - if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \
1178 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
1179 - eerror "${PN} with tokudb needs to be built with gcc-4.7 or later."
1180 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
1181 - die
1182 - fi
1183 - # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
1184 - # non x86{,_64} arches
1185 - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
1186 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
1187 - eerror "${PN} needs to be built with gcc-4.7 or later."
1188 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
1189 - die
1190 - fi
1191 - fi
1192 - java-pkg-opt-2_pkg_setup
1193 - if has test ${FEATURES} && \
1194 - use server && ! has userpriv ${FEATURES} ; then
1195 - eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
1196 - fi
1197 -
1198 - # This should come after all of the die statements
1199 - enewgroup mysql 60 || die "problem adding 'mysql' group"
1200 - enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
1201 -}
1202 -
1203 -pkg_preinst() {
1204 - java-pkg-opt-2_pkg_preinst
1205 -
1206 - # Here we need to see if the implementation switched client libraries
1207 - # We check if this is a new instance of the package and a client library already exists
1208 - local SHOW_ABI_MESSAGE libpath
1209 - if [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}usr/$(get_libdir)/libmysqlclient.so" ]] ; then
1210 - libpath=$(readlink "${EROOT}usr/$(get_libdir)/libmysqlclient.so")
1211 - elog "Due to ABI changes when switching between different client libraries,"
1212 - elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient."
1213 - elog "Please run: revdep-rebuild --library ${libpath}"
1214 - ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries"
1215 - fi
1216 -}
1217 -
1218 -pkg_postinst() {
1219 - # Make sure the vars are correctly initialized
1220 - mysql_init_vars
1221 -
1222 - # Create log directory securely if it does not exist
1223 - [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
1224 -
1225 - if use server ; then
1226 - if use pam; then
1227 - einfo
1228 - elog "This install includes the PAM authentication plugin."
1229 - elog "To activate and configure the PAM plugin, please read:"
1230 - elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/"
1231 - einfo
1232 - fi
1233 -
1234 - if [[ -z "${REPLACING_VERSIONS}" ]] ; then
1235 - einfo
1236 - elog "You might want to run:"
1237 - elog "\"emerge --config =${CATEGORY}/${PF}\""
1238 - elog "if this is a new install."
1239 - elog
1240 - elog "If you are switching server implentations, you should run the"
1241 - elog "mysql_upgrade tool."
1242 - einfo
1243 - else
1244 - einfo
1245 - elog "If you are upgrading major versions, you should run the"
1246 - elog "mysql_upgrade tool."
1247 - einfo
1248 - fi
1249 -
1250 - if use galera ; then
1251 - einfo
1252 - elog "Be sure to edit the my.cnf file to activate your cluster settings."
1253 - elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
1254 - elog "The first time the cluster is activated, you should add"
1255 - elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
1256 - elog "This option should then be removed for subsequent starts."
1257 - einfo
1258 - fi
1259 - fi
1260 -
1261 - # Note about configuration change
1262 - einfo
1263 - elog "This version of mariadb reorganizes the configuration from a single my.cnf"
1264 - elog "to several files in /etc/mysql/${PN}.d."
1265 - elog "Please backup any changes you made to /etc/mysql/my.cnf"
1266 - elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension."
1267 - elog "You may have as many files as needed and they are read alphabetically."
1268 - elog "Be sure the options have the appropitate section headers, i.e. [mysqld]."
1269 - einfo
1270 -}
1271 -
1272 -src_unpack() {
1273 - unpack ${A}
1274 - # Grab the patches
1275 - [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack
1276 -
1277 - mv -f "${WORKDIR}/${P}" "${S}" || die
1278 -}
1279 -
1280 -src_prepare() {
1281 - java-pkg-opt-2_src_prepare
1282 - if use tcmalloc; then
1283 - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt"
1284 - fi
1285 -
1286 - # Don't build bundled xz-utils for tokudb
1287 - echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die
1288 - sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die
1289 - sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die
1290 -
1291 - # Remove the bundled groonga
1292 - # There is no CMake flag, it simply checks for existance
1293 - rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga"
1294 -
1295 - if ! use server; then
1296 - rm -r "${S}"/plugin/handler_socket || die
1297 - fi
1298 -
1299 - cmake-utils_src_prepare
1300 -}
1301 -
1302 -src_configure(){
1303 - # bug 508724 mariadb cannot use ld.gold
1304 - tc-ld-disable-gold
1305 - # Bug #114895, bug #110149
1306 - filter-flags "-O" "-O[01]"
1307 -
1308 - append-cxxflags -felide-constructors
1309 -
1310 - # bug #283926, with GCC4.4, this is required to get correct behavior.
1311 - append-flags -fno-strict-aliasing
1312 -
1313 - if use client-libs ; then
1314 - multilib-minimal_src_configure
1315 - else
1316 - multilib_src_configure
1317 - fi
1318 -}
1319 -
1320 -multilib_src_configure() {
1321 - debug-print-function ${FUNCNAME} "$@"
1322 -
1323 - if ! multilib_is_native_abi && ! use client-libs ; then
1324 - return
1325 - fi
1326 -
1327 - CMAKE_BUILD_TYPE="RelWithDebInfo"
1328 -
1329 - # debug hack wrt #497532
1330 - mycmakeargs=(
1331 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
1332 - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
1333 - -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr"
1334 - -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql"
1335 - -DSYSCONFDIR="${EPREFIX}/etc/mysql"
1336 - -DINSTALL_BINDIR=bin
1337 - -DINSTALL_DOCDIR=share/doc/${PF}
1338 - -DINSTALL_DOCREADMEDIR=share/doc/${PF}
1339 - -DINSTALL_INCLUDEDIR=include/mysql
1340 - -DINSTALL_INFODIR=share/info
1341 - -DINSTALL_LIBDIR=$(get_libdir)
1342 - -DINSTALL_MANDIR=share/man
1343 - -DINSTALL_MYSQLSHAREDIR=share/mariadb
1344 - -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin
1345 - -DINSTALL_SCRIPTDIR=share/mariadb/scripts
1346 - -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql"
1347 - -DINSTALL_SBINDIR=sbin
1348 - -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb"
1349 - -DWITH_COMMENT="Gentoo Linux ${PF}"
1350 - -DWITH_UNIT_TESTS=$(usex test ON OFF)
1351 - -DWITH_LIBEDIT=0
1352 - -DWITH_ZLIB=system
1353 - -DWITHOUT_LIBWRAP=1
1354 - -DENABLED_LOCAL_INFILE=1
1355 - -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock"
1356 - -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock"
1357 - -DWITH_DEFAULT_COMPILER_OPTIONS=0
1358 - -DWITH_DEFAULT_FEATURE_SET=0
1359 - -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)"
1360 - -DENABLE_STATIC_LIBS=$(usex static-libs ON OFF)
1361 - # The build forces this to be defined when cross-compiling. We pass it
1362 - # all the time for simplicity and to make sure it is actually correct.
1363 - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
1364 - -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)"
1365 - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
1366 - -DAUTH_GSSAPI_PLUGIN_TYPE=$(usex kerberos DYNAMIC OFF)
1367 - -DCONC_WITH_EXTERNAL_ZLIB=YES
1368 - -DWITH_EXTERNAL_ZLIB=YES
1369 - -DSUFFIX_INSTALL_DIR=""
1370 - -DWITH_UNITTEST=OFF
1371 - )
1372 - if use test ; then
1373 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test )
1374 - else
1375 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
1376 - fi
1377 -
1378 - if ! use yassl ; then
1379 - mycmakeargs+=( -DWITH_SSL=system )
1380 - else
1381 - mycmakeargs+=( -DWITH_SSL=bundled )
1382 - fi
1383 -
1384 - if ! use client-libs ; then
1385 - mycmakeargs+=( -DWITHOUT_CLIENTLIBS=YES )
1386 - fi
1387 -
1388 - # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION
1389 - # systemtap only works on native ABI bug 530132
1390 - if multilib_is_native_abi; then
1391 - mycmakeargs+=(
1392 - -DWITH_READLINE=$(usex bindist 1 0)
1393 - -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1)
1394 - -DENABLE_DTRACE=$(usex systemtap)
1395 - )
1396 - else
1397 - mycmakeargs+=(
1398 - -DWITHOUT_TOOLS=1
1399 - -DWITH_READLINE=1
1400 - -DNOT_FOR_DISTRIBUTION=0
1401 - -DENABLE_DTRACE=0
1402 - )
1403 - fi
1404 -
1405 - if multilib_is_native_abi && use server ; then
1406 -
1407 - # Federated{,X} must be treated special otherwise they will not be built as plugins
1408 - if ! use extraengine ; then
1409 - mycmakeargs+=(
1410 - -DPLUGIN_FEDERATED=NO
1411 - -DPLUGIN_FEDERATEDX=NO )
1412 - fi
1413 -
1414 - mycmakeargs+=(
1415 - -DWITH_JEMALLOC=$(usex jemalloc system)
1416 - -DWITH_PCRE=system
1417 - -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO)
1418 - -DPLUGIN_SPHINX=$(usex sphinx YES NO)
1419 - -DPLUGIN_TOKUDB=$(usex tokudb YES NO)
1420 - -DPLUGIN_AUTH_PAM=$(usex pam YES NO)
1421 - -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO)
1422 - -DPLUGIN_CASSANDRA=NO
1423 - -DPLUGIN_SEQUENCE=$(usex extraengine YES NO)
1424 - -DPLUGIN_SPIDER=$(usex extraengine YES NO)
1425 - -DPLUGIN_CONNECT=$(usex extraengine YES NO)
1426 - -DCONNECT_WITH_MYSQL=1
1427 - -DCONNECT_WITH_LIBXML2=$(usex xml)
1428 - -DCONNECT_WITH_ODBC=$(usex odbc)
1429 - -DCONNECT_WITH_JDBC=$(usex jdbc)
1430 - # Build failure and autodep wrt bug 639144
1431 - -DCONNECT_WITH_MONGO=OFF
1432 - -DWITH_WSREP=$(usex galera)
1433 - -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF)
1434 - -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF)
1435 - -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF)
1436 - -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO)
1437 - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
1438 - -DWITH_MARIABACKUP=$(usex backup ON OFF)
1439 - -DWITH_LIBARCHIVE=$(usex backup ON OFF)
1440 - -DINSTALL_SQLBENCHDIR=share/mariadb
1441 - -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO)
1442 - # systemd is only linked to for server notification
1443 - -DWITH_SYSTEMD=$(usex systemd yes no)
1444 - -DWITH_NUMA=$(usex numa ON OFF)
1445 - )
1446 -
1447 - # Workaround for MDEV-14524
1448 - use tokudb && mycmakeargs+=( -DTOKUDB_OK=1 )
1449 -
1450 - if use test ; then
1451 - # This is needed for the new client lib which tests a real, open server
1452 - mycmakeargs+=( -DSKIP_TESTS=ON )
1453 - fi
1454 -
1455 - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
1456 - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
1457 - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
1458 - ewarn "You MUST file bugs without these variables set."
1459 -
1460 - mycmakeargs+=(
1461 - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
1462 - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
1463 - )
1464 -
1465 - elif ! use latin1 ; then
1466 - mycmakeargs+=(
1467 - -DDEFAULT_CHARSET=utf8
1468 - -DDEFAULT_COLLATION=utf8_general_ci
1469 - )
1470 - else
1471 - mycmakeargs+=(
1472 - -DDEFAULT_CHARSET=latin1
1473 - -DDEFAULT_COLLATION=latin1_swedish_ci
1474 - )
1475 - fi
1476 - mycmakeargs+=(
1477 - -DEXTRA_CHARSETS=all
1478 - -DMYSQL_USER=mysql
1479 - -DDISABLE_SHARED=$(usex static YES NO)
1480 - -DWITH_DEBUG=$(usex debug)
1481 - -DWITH_EMBEDDED_SERVER=OFF
1482 - -DWITH_PROFILING=$(usex profiling)
1483 - )
1484 -
1485 - if use static; then
1486 - mycmakeargs+=( -DWITH_PIC=1 )
1487 - fi
1488 -
1489 - if use jemalloc || use tcmalloc ; then
1490 - mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
1491 - fi
1492 -
1493 - # Storage engines
1494 - mycmakeargs+=(
1495 - -DWITH_ARCHIVE_STORAGE_ENGINE=1
1496 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1
1497 - -DWITH_CSV_STORAGE_ENGINE=1
1498 - -DWITH_HEAP_STORAGE_ENGINE=1
1499 - -DWITH_INNOBASE_STORAGE_ENGINE=1
1500 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1
1501 - -DWITH_MYISAM_STORAGE_ENGINE=1
1502 - -DWITH_PARTITION_STORAGE_ENGINE=1
1503 - )
1504 -
1505 - else
1506 - mycmakeargs+=(
1507 - -DWITHOUT_SERVER=1
1508 - -DWITH_EMBEDDED_SERVER=OFF
1509 - -DEXTRA_CHARSETS=none
1510 - -DINSTALL_SQLBENCHDIR=
1511 - -DWITH_SYSTEMD=no
1512 - )
1513 - fi
1514 -
1515 - cmake-utils_src_configure
1516 -}
1517 -
1518 -src_compile() {
1519 - if use client-libs ; then
1520 - multilib-minimal_src_compile
1521 - else
1522 - multilib_src_compile
1523 - fi
1524 -}
1525 -
1526 -multilib_src_compile() {
1527 - cmake-utils_src_compile
1528 -}
1529 -
1530 -src_install() {
1531 - local MULTILIB_WRAPPED_HEADERS
1532 - local MULTILIB_CHOST_TOOLS
1533 - if use client-libs ; then
1534 - # headers with ABI specific data
1535 - MULTILIB_WRAPPED_HEADERS=(
1536 - /usr/include/mysql/server/my_config.h
1537 - /usr/include/mysql/server/private/embedded_priv.h
1538 - /usr/include/mysql/server/mysql_version.h
1539 - /usr/include/mariadb/mariadb_version.h
1540 - /usr/include/mysql/mariadb_version.h
1541 - /usr/include/mysql/server/private/probes_mysql_nodtrace.h
1542 - /usr/include/mysql/server/private/probes_mysql_dtrace.h )
1543 -
1544 - # wrap the config scripts
1545 - MULTILIB_CHOST_TOOLS=( /usr/bin/mariadb_config /usr/bin/mysql_config )
1546 - multilib-minimal_src_install
1547 - else
1548 - multilib_src_install
1549 - multilib_src_install_all
1550 - fi
1551 -}
1552 -
1553 -# Intentionally override eclass function
1554 -multilib_src_install() {
1555 -
1556 - cmake-utils_src_install
1557 -
1558 - # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used
1559 - if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then
1560 - rm "${ED}/usr/include/mysql/server/private/config.h" || die
1561 - fi
1562 -
1563 - if ! multilib_is_native_abi && use server ; then
1564 - insinto /usr/include/mysql/server/private
1565 - doins "${S}"/sql/*.h
1566 - fi
1567 -
1568 - if use client-libs ; then
1569 - # Install compatible symlinks to libmysqlclient
1570 -# use static-libs && dosym libmariadbclient.a "/usr/$(get_libdir)/libmysqlclient.a"
1571 -# dosym libmariadb.so.3 "/usr/$(get_libdir)/libmysqlclient.so"
1572 - dosym libmariadb.so.3 "/usr/$(get_libdir)/libmysqlclient.so.${SUBSLOT}"
1573 - fi
1574 -
1575 - # Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them.
1576 - find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die
1577 -}
1578 -
1579 -multilib_src_install_all() {
1580 - # Make sure the vars are correctly initialized
1581 - mysql_init_vars
1582 -
1583 - # Convenience links
1584 - einfo "Making Convenience links for mysqlcheck multi-call binary"
1585 - dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
1586 - dosym "mysqlcheck" "/usr/bin/mysqlrepair"
1587 - dosym "mysqlcheck" "/usr/bin/mysqloptimize"
1588 -
1589 - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
1590 - if [[ -d "${ED}/usr/data" ]] ; then
1591 - rm -Rf "${ED}/usr/data" || die
1592 - fi
1593 -
1594 - # Unless they explicitly specific USE=test, then do not install the
1595 - # testsuite. It DOES have a use to be installed, esp. when you want to do a
1596 - # validation of your database configuration after tuning it.
1597 - if ! use test ; then
1598 - rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
1599 - fi
1600 -
1601 - # Configuration stuff
1602 - einfo "Building default configuration ..."
1603 - insinto "${MY_SYSCONFDIR#${EPREFIX}}"
1604 - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
1605 - cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die
1606 - eprefixify "${TMPDIR}/my.cnf"
1607 - doins "${TMPDIR}/my.cnf"
1608 - insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d"
1609 - cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
1610 - eprefixify "${TMPDIR}/50-distro-client.cnf"
1611 - doins "${TMPDIR}/50-distro-client.cnf"
1612 -
1613 - if use server ; then
1614 - mycnf_src="my.cnf.distro-server"
1615 - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
1616 - "${FILESDIR}/${mycnf_src}" \
1617 - > "${TMPDIR}/my.cnf.ok" || die
1618 - if use prefix ; then
1619 - sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
1620 - "${TMPDIR}/my.cnf.ok" || die
1621 - fi
1622 - if use latin1 ; then
1623 - sed -i \
1624 - -e "/character-set/s|utf8|latin1|g" \
1625 - "${TMPDIR}/my.cnf.ok" || die
1626 - fi
1627 - eprefixify "${TMPDIR}/my.cnf.ok"
1628 - newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
1629 -
1630 - einfo "Including support files and sample configurations"
1631 - docinto "support-files"
1632 - local script
1633 - for script in \
1634 - "${S}"/support-files/magic
1635 - do
1636 - [[ -f "$script" ]] && dodoc "${script}"
1637 - done
1638 -
1639 - docinto "scripts"
1640 - for script in "${S}"/scripts/mysql* ; do
1641 - [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
1642 - done
1643 - fi
1644 -
1645 - #Remove mytop if perl is not selected
1646 - [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop"
1647 -}
1648 -
1649 -# Official test instructions:
1650 -# USE='extraengine perl server static-libs' \
1651 -# FEATURES='test userpriv -usersandbox' \
1652 -# ebuild mariadb-X.X.XX.ebuild \
1653 -# digest clean package
1654 -src_test() {
1655 -
1656 - _disable_test() {
1657 - local rawtestname reason
1658 - rawtestname="${1}" ; shift
1659 - reason="${@}"
1660 - ewarn "test '${rawtestname}' disabled: '${reason}'"
1661 - echo ${rawtestname} : ${reason} >> "${T}/disabled.def"
1662 - }
1663 -
1664 - local TESTDIR="${BUILD_DIR}/mysql-test"
1665 - local retstatus_unit
1666 - local retstatus_tests
1667 -
1668 - if ! use server ; then
1669 - einfo "Skipping server tests due to minimal build."
1670 - return 0
1671 - fi
1672 -
1673 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
1674 - # localhost. Also causes weird failures.
1675 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
1676 -
1677 - if [[ $UID -eq 0 ]]; then
1678 - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
1679 - fi
1680 - has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox"
1681 -
1682 - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
1683 -
1684 - # Run CTest (test-units)
1685 - cmake-utils_src_test
1686 - retstatus_unit=$?
1687 -
1688 - # Ensure that parallel runs don't die
1689 - export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
1690 - # Enable parallel testing, auto will try to detect number of cores
1691 - # You may set this by hand.
1692 - # The default maximum is 8 unless MTR_MAX_PARALLEL is increased
1693 - export MTR_PARALLEL="${MTR_PARALLEL:-auto}"
1694 -
1695 - # create directories because mysqladmin might run out of order
1696 - mkdir -p "${T}"/var-tests{,/log} || die
1697 -
1698 - # Run mysql tests
1699 - pushd "${TESTDIR}" > /dev/null || die
1700 -
1701 - touch "${T}/disabled.def"
1702 - # These are failing in MariaDB 10.0 for now and are believed to be
1703 - # false positives:
1704 - #
1705 - # main.mysql_client_test, main.mysql_client_test_nonblock
1706 - # main.mysql_client_test_comp:
1707 - # segfaults at random under Portage only, suspect resource limits.
1708 -
1709 - local t
1710 - for t in plugins.cracklib_password_check plugins.two_password_validations ; do
1711 - _disable_test "$t" "False positive due to varying policies"
1712 - done
1713 -
1714 - for t in main.mysql_client_test main.mysql_client_test_nonblock \
1715 - main.mysql_client_test_comp rpl.rpl_extra_col_master_myisam ; do
1716 - _disable_test "$t" "False positives in Gentoo"
1717 - done
1718 -
1719 - if ! use client-libs ; then
1720 - _disable_test main.plugin_auth "Needs client libraries built"
1721 - fi
1722 -
1723 - # run mysql-test tests
1724 - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def"
1725 - retstatus_tests=$?
1726 -
1727 - popd > /dev/null || die
1728 -
1729 - # Cleanup is important for these testcases.
1730 - pkill -9 -f "${S}/ndb" 2>/dev/null
1731 - pkill -9 -f "${S}/sql" 2>/dev/null
1732 -
1733 - local failures=""
1734 - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
1735 - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
1736 -
1737 - [[ -z "$failures" ]] || die "Test failures: $failures"
1738 - einfo "Tests successfully completed"
1739 -}
1740 -
1741 -mysql_init_vars() {
1742 - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"}
1743 - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
1744 - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
1745 - MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
1746 -
1747 - if [[ -z "${MY_DATADIR}" ]] ; then
1748 - MY_DATADIR=""
1749 - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
1750 - MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
1751 - | sed -ne '/datadir/s|^--datadir=||p' \
1752 - | tail -n1`
1753 - if [[ -z "${MY_DATADIR}" ]] ; then
1754 - MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
1755 - | sed -e 's/.*=\s*//' \
1756 - | tail -n1`
1757 - fi
1758 - fi
1759 - if [[ -z "${MY_DATADIR}" ]] ; then
1760 - MY_DATADIR="${MY_LOCALSTATEDIR}"
1761 - einfo "Using default MY_DATADIR"
1762 - fi
1763 - elog "MySQL MY_DATADIR is ${MY_DATADIR}"
1764 -
1765 - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
1766 - if [[ -e "${MY_DATADIR}" ]] ; then
1767 - # If you get this and you're wondering about it, see bug #207636
1768 - elog "MySQL datadir found in ${MY_DATADIR}"
1769 - elog "A new one will not be created."
1770 - PREVIOUS_DATADIR="yes"
1771 - else
1772 - PREVIOUS_DATADIR="no"
1773 - fi
1774 - export PREVIOUS_DATADIR
1775 - fi
1776 - else
1777 - if [[ ${EBUILD_PHASE} == "config" ]]; then
1778 - local new_MY_DATADIR
1779 - new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
1780 - | sed -ne '/datadir/s|^--datadir=||p' \
1781 - | tail -n1`
1782 -
1783 - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
1784 - ewarn "MySQL MY_DATADIR has changed"
1785 - ewarn "from ${MY_DATADIR}"
1786 - ewarn "to ${new_MY_DATADIR}"
1787 - MY_DATADIR="${new_MY_DATADIR}"
1788 - fi
1789 - fi
1790 - fi
1791 -
1792 - export MY_SHAREDSTATEDIR MY_SYSCONFDIR
1793 - export MY_LOCALSTATEDIR MY_LOGDIR
1794 - export MY_DATADIR
1795 -}
1796 -
1797 -pkg_config() {
1798 - _getoptval() {
1799 - local mypd="${EROOT}"/usr/bin/my_print_defaults
1800 - local section="$1"
1801 - local flag="--${2}="
1802 - local extra_options="${3}"
1803 - "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp"
1804 - }
1805 - local old_MY_DATADIR="${MY_DATADIR}"
1806 - local old_HOME="${HOME}"
1807 - # my_print_defaults needs to read stuff in $HOME/.my.cnf
1808 - export HOME=${EPREFIX}/root
1809 -
1810 - # Make sure the vars are correctly initialized
1811 - mysql_init_vars
1812 -
1813 - [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
1814 - if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then
1815 - die "Minimal builds do NOT include the MySQL server"
1816 - fi
1817 -
1818 - if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then
1819 - local MY_DATADIR_s="${ROOT}/${MY_DATADIR}"
1820 - MY_DATADIR_s="${MY_DATADIR_s%%/}"
1821 - local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}"
1822 - old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
1823 -
1824 - if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then
1825 - if [[ -d "${MY_DATADIR_s}" ]]; then
1826 - ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
1827 - ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
1828 - else
1829 - elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
1830 - mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
1831 - || die "Moving MY_DATADIR failed"
1832 - fi
1833 - else
1834 - ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
1835 - if [[ -d "${MY_DATADIR_s}" ]]; then
1836 - ewarn "Attempting to use ${MY_DATADIR_s}"
1837 - else
1838 - eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
1839 - die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
1840 - fi
1841 - fi
1842 - fi
1843 -
1844 - local pwd1="a"
1845 - local pwd2="b"
1846 - local maxtry=15
1847 -
1848 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
1849 - local tmp_mysqld_password_source=
1850 -
1851 - for tmp_mysqld_password_source in mysql client; do
1852 - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
1853 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
1854 - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then
1855 - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then
1856 - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
1857 - MYSQL_ROOT_PASSWORD=
1858 - continue
1859 - fi
1860 -
1861 - einfo "Found password in '${tmp_mysqld_password_source}' section!"
1862 - break
1863 - fi
1864 - done
1865 -
1866 - # Sometimes --show is required to display passwords in some implementations of my_print_defaults
1867 - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then
1868 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
1869 - fi
1870 -
1871 - unset tmp_mysqld_password_source
1872 - fi
1873 - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir)"
1874 - # These are dir+prefix
1875 - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log)"
1876 - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
1877 - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin)"
1878 - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
1879 -
1880 - if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then
1881 - einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
1882 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR"
1883 - fi
1884 - if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then
1885 - einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
1886 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN"
1887 - fi
1888 - if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then
1889 - einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
1890 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG"
1891 - fi
1892 -
1893 - if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then
1894 - ewarn "You have already a MySQL database in place."
1895 - ewarn "(${ROOT}/${MY_DATADIR}/*)"
1896 - ewarn "Please rename or delete it if you wish to replace it."
1897 - die "MySQL database already exists!"
1898 - fi
1899 -
1900 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
1901 - # localhost. Also causes weird failures.
1902 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
1903 -
1904 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
1905 -
1906 - einfo "Please provide a password for the mysql 'root' user now"
1907 - einfo "or through the ${HOME}/.my.cnf file."
1908 - ewarn "Avoid [\"'\\_%] characters in the password"
1909 - read -rsp " >" pwd1 ; echo
1910 -
1911 - einfo "Retype the password"
1912 - read -rsp " >" pwd2 ; echo
1913 -
1914 - if [[ "x$pwd1" != "x$pwd2" ]] ; then
1915 - die "Passwords are not the same"
1916 - fi
1917 - MYSQL_ROOT_PASSWORD="${pwd1}"
1918 - unset pwd1 pwd2
1919 - fi
1920 -
1921 - local options
1922 - local sqltmp="$(emktemp)"
1923 -
1924 - # Fix bug 446200. Don't reference host my.cnf, needs to come first,
1925 - # see http://bugs.mysql.com/bug.php?id=31312
1926 - use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
1927 -
1928 - # Figure out which options we need to disable to do the setup
1929 - local helpfile="${TMPDIR}/mysqld-help"
1930 - "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
1931 - for opt in grant-tables host-cache name-resolve networking slave-start \
1932 - federated ssl log-bin relay-log slow-query-log external-locking \
1933 - log-slave-updates \
1934 - ; do
1935 - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
1936 - egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
1937 - done
1938 -
1939 - einfo "Creating the mysql database and setting proper permissions on it ..."
1940 -
1941 - # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
1942 - PID_DIR="${EROOT}/var/run/mysqld"
1943 - if [[ ! -d "${PID_DIR}" ]]; then
1944 - install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
1945 - fi
1946 -
1947 - if [[ ! -d "${MY_DATADIR}" ]]; then
1948 - install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory"
1949 - fi
1950 -
1951 - pushd "${TMPDIR}" &>/dev/null || die
1952 -
1953 - # Filling timezones, see
1954 - # http://dev.mysql.com/doc/mysql/en/time-zone-support.html
1955 - "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null
1956 -
1957 - local cmd=( "${EROOT}usr/share/mariadb/scripts/mysql_install_db" )
1958 - [[ -f "${cmd}" ]] || cmd=( "${EROOT}usr/bin/mysql_install_db" )
1959 - cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" )
1960 - einfo "Command: ${cmd[*]}"
1961 - su -s /bin/sh -c "${cmd[*]}" mysql \
1962 - >"${TMPDIR}"/mysql_install_db.log 2>&1
1963 - if [ $? -ne 0 ]; then
1964 - grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2
1965 - die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log"
1966 - fi
1967 - popd &>/dev/null || die
1968 - [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \
1969 - || die "MySQL databases not installed"
1970 -
1971 - use prefix || options="${options} --user=mysql"
1972 -
1973 - local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock"
1974 - local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid"
1975 - local mysqld="${EROOT}/usr/sbin/mysqld \
1976 - ${options} \
1977 - --log-warnings=0 \
1978 - --basedir=${EROOT}/usr \
1979 - --datadir=${ROOT}/${MY_DATADIR} \
1980 - --max_allowed_packet=8M \
1981 - --net_buffer_length=16K \
1982 - --socket=${socket} \
1983 - --pid-file=${pidfile}
1984 - --tmpdir=${ROOT}/${MYSQL_TMPDIR}"
1985 - #einfo "About to start mysqld: ${mysqld}"
1986 - ebegin "Starting mysqld"
1987 - einfo "Command ${mysqld}"
1988 - ${mysqld} &
1989 - rc=$?
1990 - while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
1991 - maxtry=$((${maxtry}-1))
1992 - echo -n "."
1993 - sleep 1
1994 - done
1995 - eend $rc
1996 -
1997 - if ! [[ -S "${socket}" ]]; then
1998 - die "Completely failed to start up mysqld with: ${mysqld}"
1999 - fi
2000 -
2001 - ebegin "Setting root password"
2002 - # Do this from memory, as we don't want clear text passwords in temp files
2003 - local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES"
2004 - "${EROOT}/usr/bin/mysql" \
2005 - "--socket=${socket}" \
2006 - -hlocalhost \
2007 - -e "${sql}"
2008 - eend $?
2009 -
2010 - if [[ -n "${sqltmp}" ]] ; then
2011 - ebegin "Loading \"zoneinfo\", this step may require a few seconds"
2012 - "${EROOT}/usr/bin/mysql" \
2013 - "--socket=${socket}" \
2014 - -hlocalhost \
2015 - -uroot \
2016 - --password="${MYSQL_ROOT_PASSWORD}" \
2017 - mysql < "${sqltmp}"
2018 - rc=$?
2019 - eend $?
2020 - [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!"
2021 - fi
2022 -
2023 - # Stop the server and cleanup
2024 - einfo "Stopping the server ..."
2025 - kill $(< "${pidfile}" )
2026 - rm -f "${sqltmp}"
2027 - wait %1
2028 - einfo "Done"
2029 -}
2030
2031 diff --git a/dev-db/mariadb/mariadb-10.3.5_rc.ebuild b/dev-db/mariadb/mariadb-10.3.5_rc.ebuild
2032 deleted file mode 100644
2033 index 69e55e88ddc..00000000000
2034 --- a/dev-db/mariadb/mariadb-10.3.5_rc.ebuild
2035 +++ /dev/null
2036 @@ -1,1011 +0,0 @@
2037 -# Copyright 1999-2018 Gentoo Foundation
2038 -# Distributed under the terms of the GNU General Public License v2
2039 -
2040 -EAPI="6"
2041 -MY_EXTRAS_VER="20180308-1938Z"
2042 -SUBSLOT="18"
2043 -
2044 -JAVA_PKG_OPT_USE="jdbc"
2045 -
2046 -# Keeping eutils in EAPI=6 for emktemp in pkg_config
2047 -
2048 -inherit eutils systemd flag-o-matic prefix toolchain-funcs \
2049 - java-pkg-opt-2 user cmake-utils multilib-minimal
2050 -
2051 -SRC_URI="https://downloads.mariadb.org/interstitial/${P/_rc/}/source/${P/_rc/}.tar.gz "
2052 -
2053 -# Gentoo patches to MySQL
2054 -if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then
2055 - SRC_URI="${SRC_URI}
2056 - mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
2057 - https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
2058 - https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
2059 - https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
2060 - https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
2061 -fi
2062 -
2063 -HOMEPAGE="http://mariadb.org/"
2064 -DESCRIPTION="An enhanced, drop-in replacement for MySQL"
2065 -LICENSE="GPL-2 LGPL-2.1+"
2066 -SLOT="0/${SUBSLOT:-0}"
2067 -IUSE="+backup bindist client-libs cracklib debug extraengine galera innodb-lz4
2068 - innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 libressl mroonga
2069 - numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx
2070 - sst-rsync sst-mariabackup sst-xtrabackup static static-libs systemd systemtap tcmalloc
2071 - test tokudb xml yassl"
2072 -
2073 -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
2074 -RESTRICT="!bindist? ( bindist ) libressl? ( test )"
2075 -
2076 -REQUIRED_USE="jdbc? ( extraengine server !static )
2077 - server? ( tokudb? ( jemalloc !tcmalloc ) )
2078 - !server? ( !extraengine )
2079 - ?? ( tcmalloc jemalloc )
2080 - static? ( yassl !pam )"
2081 -
2082 -# REMEMBER: also update eclass/mysql*.eclass before committing!
2083 -KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc64 ~sparc ~x86"
2084 -
2085 -# Shorten the path because the socket path length must be shorter than 107 chars
2086 -# and we will run a mysql server during test phase
2087 -S="${WORKDIR}/mysql"
2088 -
2089 -if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then
2090 - inherit git-r3
2091 - EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/mysql-extras.git"
2092 - EGIT_CHECKOUT_DIR="${WORKDIR}/mysql-extras"
2093 - EGIT_CLONE_TYPE=shallow
2094 - MY_PATCH_DIR="${WORKDIR}/mysql-extras"
2095 -else
2096 - MY_PATCH_DIR="${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}"
2097 -fi
2098 -
2099 -PATCHES=(
2100 - "${MY_PATCH_DIR}"/20015_all_mariadb-pkgconfig-location.patch
2101 - "${MY_PATCH_DIR}"/20018_all_mariadb-10.2.9-without-clientlibs-tools.patch
2102 - "${MY_PATCH_DIR}"/20024_all_mariadb-10.2.6-mysql_st-regression.patch
2103 - "${MY_PATCH_DIR}"/20025_all_mariadb-10.2.6-gssapi-detect.patch
2104 -)
2105 -
2106 -# Be warned, *DEPEND are version-dependant
2107 -# These are used for both runtime and compiletime
2108 -# MULTILIB_USEDEP only set for libraries used by the client library
2109 -COMMON_DEPEND="
2110 - kernel_linux? (
2111 - sys-process/procps:0=
2112 - dev-libs/libaio:0=
2113 - )
2114 - >=sys-apps/sed-4
2115 - >=sys-apps/texinfo-4.7-r1
2116 - jemalloc? ( dev-libs/jemalloc:0= )
2117 - tcmalloc? ( dev-util/google-perftools:0= )
2118 - systemtap? ( >=dev-util/systemtap-1.3:0= )
2119 - !yassl? (
2120 - !libressl? ( >=dev-libs/openssl-1.0.0:0=[${MULTILIB_USEDEP},static-libs?] )
2121 - libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP},static-libs?] )
2122 - )
2123 - >=sys-libs/zlib-1.2.3:0=[${MULTILIB_USEDEP},static-libs?]
2124 - sys-libs/ncurses:0=
2125 - mroonga? ( app-text/groonga-normalizer-mysql )
2126 - kerberos? ( virtual/krb5[${MULTILIB_USEDEP}] )
2127 - !bindist? (
2128 - sys-libs/binutils-libs:0=
2129 - >=sys-libs/readline-4.1:0=
2130 - )
2131 - server? (
2132 - backup? ( app-arch/libarchive:0= )
2133 - cracklib? ( sys-libs/cracklib:0= )
2134 - extraengine? (
2135 - odbc? ( dev-db/unixODBC:0= )
2136 - xml? ( dev-libs/libxml2:2= )
2137 - )
2138 - innodb-lz4? ( app-arch/lz4 )
2139 - innodb-lzo? ( dev-libs/lzo )
2140 - innodb-snappy? ( app-arch/snappy )
2141 - numa? ( sys-process/numactl )
2142 - oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= )
2143 - pam? ( virtual/pam:0= )
2144 - systemd? ( sys-apps/systemd:= )
2145 - tokudb? ( app-arch/snappy )
2146 - )
2147 - >=dev-libs/libpcre-8.41-r1:3=
2148 -"
2149 -DEPEND="virtual/yacc
2150 - static? ( sys-libs/ncurses[static-libs] )
2151 - || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
2152 - server? ( extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) ) )
2153 - ${COMMON_DEPEND}"
2154 -RDEPEND="selinux? ( sec-policy/selinux-mysql )
2155 - client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c )
2156 - !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
2157 - server? ( !prefix? ( dev-db/mysql-init-scripts ) )
2158 - !<virtual/mysql-5.6-r11
2159 - ${COMMON_DEPEND}
2160 - server? ( galera? (
2161 - sys-apps/iproute2
2162 - =sys-cluster/galera-25*
2163 - sst-rsync? ( sys-process/lsof )
2164 - sst-mariabackup? ( net-misc/socat[ssl] )
2165 - sst-xtrabackup? ( net-misc/socat[ssl] )
2166 - ) )
2167 - perl? ( !dev-db/mytop
2168 - virtual/perl-Getopt-Long
2169 - dev-perl/TermReadKey
2170 - virtual/perl-Term-ANSIColor
2171 - virtual/perl-Time-HiRes )
2172 - server? ( extraengine? ( jdbc? ( >=virtual/jre-1.6 ) ) )
2173 -"
2174 -# For other stuff to bring us in
2175 -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
2176 -# xtrabackup-bin causes a circular dependency if DBD-mysql is not already installed
2177 -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )
2178 - !client-libs? ( dev-db/mariadb-connector-c dev-db/mysql-connector-c )
2179 - server? ( ~virtual/mysql-5.6[static=]
2180 - galera? ( sst-xtrabackup? ( || ( >=dev-db/xtrabackup-bin-2.2.4 dev-db/percona-xtrabackup ) ) ) )"
2181 -
2182 -pkg_setup() {
2183 - if [[ ${MERGE_TYPE} != binary ]] ; then
2184 - local GCC_MAJOR_SET=$(gcc-major-version)
2185 - local GCC_MINOR_SET=$(gcc-minor-version)
2186 - if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \
2187 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
2188 - eerror "${PN} with tokudb needs to be built with gcc-4.7 or later."
2189 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
2190 - die
2191 - fi
2192 - # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
2193 - # non x86{,_64} arches
2194 - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
2195 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
2196 - eerror "${PN} needs to be built with gcc-4.7 or later."
2197 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
2198 - die
2199 - fi
2200 - fi
2201 - java-pkg-opt-2_pkg_setup
2202 - if has test ${FEATURES} && \
2203 - use server && ! has userpriv ${FEATURES} ; then
2204 - eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
2205 - fi
2206 -
2207 - # This should come after all of the die statements
2208 - enewgroup mysql 60 || die "problem adding 'mysql' group"
2209 - enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
2210 -}
2211 -
2212 -pkg_preinst() {
2213 - java-pkg-opt-2_pkg_preinst
2214 -
2215 - # Here we need to see if the implementation switched client libraries
2216 - # We check if this is a new instance of the package and a client library already exists
2217 - local SHOW_ABI_MESSAGE libpath
2218 - if [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}usr/$(get_libdir)/libmysqlclient.so" ]] ; then
2219 - libpath=$(readlink "${EROOT}usr/$(get_libdir)/libmysqlclient.so")
2220 - elog "Due to ABI changes when switching between different client libraries,"
2221 - elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient."
2222 - elog "Please run: revdep-rebuild --library ${libpath}"
2223 - ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries"
2224 - fi
2225 -}
2226 -
2227 -pkg_postinst() {
2228 - # Make sure the vars are correctly initialized
2229 - mysql_init_vars
2230 -
2231 - # Create log directory securely if it does not exist
2232 - [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
2233 -
2234 - if use server ; then
2235 - if use pam; then
2236 - einfo
2237 - elog "This install includes the PAM authentication plugin."
2238 - elog "To activate and configure the PAM plugin, please read:"
2239 - elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/"
2240 - einfo
2241 - fi
2242 -
2243 - if [[ -z "${REPLACING_VERSIONS}" ]] ; then
2244 - einfo
2245 - elog "You might want to run:"
2246 - elog "\"emerge --config =${CATEGORY}/${PF}\""
2247 - elog "if this is a new install."
2248 - elog
2249 - elog "If you are switching server implentations, you should run the"
2250 - elog "mysql_upgrade tool."
2251 - einfo
2252 - else
2253 - einfo
2254 - elog "If you are upgrading major versions, you should run the"
2255 - elog "mysql_upgrade tool."
2256 - einfo
2257 - fi
2258 -
2259 - if use galera ; then
2260 - einfo
2261 - elog "Be sure to edit the my.cnf file to activate your cluster settings."
2262 - elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
2263 - elog "The first time the cluster is activated, you should add"
2264 - elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
2265 - elog "This option should then be removed for subsequent starts."
2266 - einfo
2267 - fi
2268 - fi
2269 -
2270 - # Note about configuration change
2271 - einfo
2272 - elog "This version of mariadb reorganizes the configuration from a single my.cnf"
2273 - elog "to several files in /etc/mysql/${PN}.d."
2274 - elog "Please backup any changes you made to /etc/mysql/my.cnf"
2275 - elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension."
2276 - elog "You may have as many files as needed and they are read alphabetically."
2277 - elog "Be sure the options have the appropitate section headers, i.e. [mysqld]."
2278 - einfo
2279 -}
2280 -
2281 -src_unpack() {
2282 -
2283 - # Initialize the proper variables first
2284 - mysql_init_vars
2285 -
2286 - unpack ${A}
2287 - # Grab the patches
2288 - [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack
2289 -
2290 - mv -f "${WORKDIR}/${P/_rc/}" "${S}" || die
2291 -}
2292 -
2293 -src_prepare() {
2294 - java-pkg-opt-2_src_prepare
2295 - if use tcmalloc; then
2296 - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt"
2297 - fi
2298 -
2299 - # Don't build bundled xz-utils for tokudb
2300 - echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die
2301 - sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die
2302 - sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die
2303 -
2304 - # Remove the bundled groonga
2305 - # There is no CMake flag, it simply checks for existance
2306 - rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga"
2307 -
2308 - if ! use server; then
2309 - rm -r "${S}"/plugin/handler_socket || die
2310 - fi
2311 -
2312 - cmake-utils_src_prepare
2313 -}
2314 -
2315 -src_configure(){
2316 - # bug 508724 mariadb cannot use ld.gold
2317 - tc-ld-disable-gold
2318 - # Bug #114895, bug #110149
2319 - filter-flags "-O" "-O[01]"
2320 -
2321 - append-cxxflags -felide-constructors
2322 -
2323 - # bug #283926, with GCC4.4, this is required to get correct behavior.
2324 - append-flags -fno-strict-aliasing
2325 -
2326 - if use client-libs ; then
2327 - multilib-minimal_src_configure
2328 - else
2329 - multilib_src_configure
2330 - fi
2331 -}
2332 -
2333 -multilib_src_configure() {
2334 - debug-print-function ${FUNCNAME} "$@"
2335 -
2336 - if ! multilib_is_native_abi && ! use client-libs ; then
2337 - return
2338 - fi
2339 -
2340 - CMAKE_BUILD_TYPE="RelWithDebInfo"
2341 -
2342 - # debug hack wrt #497532
2343 - mycmakeargs=(
2344 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
2345 - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
2346 - -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr"
2347 - -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql"
2348 - -DSYSCONFDIR="${EPREFIX}/etc/mysql"
2349 - -DINSTALL_BINDIR=bin
2350 - -DINSTALL_DOCDIR=share/doc/${PF}
2351 - -DINSTALL_DOCREADMEDIR=share/doc/${PF}
2352 - -DINSTALL_INCLUDEDIR=include/mysql
2353 - -DINSTALL_INFODIR=share/info
2354 - -DINSTALL_LIBDIR=$(get_libdir)
2355 - -DINSTALL_MANDIR=share/man
2356 - -DINSTALL_MYSQLSHAREDIR=share/mariadb
2357 - -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin
2358 - -DINSTALL_SCRIPTDIR=share/mariadb/scripts
2359 - -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql"
2360 - -DINSTALL_SBINDIR=sbin
2361 - -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb"
2362 - -DWITH_COMMENT="Gentoo Linux ${PF}"
2363 - -DWITH_UNIT_TESTS=$(usex test ON OFF)
2364 - -DWITH_LIBEDIT=0
2365 - -DWITH_ZLIB=system
2366 - -DWITHOUT_LIBWRAP=1
2367 - -DENABLED_LOCAL_INFILE=1
2368 - -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock"
2369 - -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock"
2370 - -DWITH_DEFAULT_COMPILER_OPTIONS=0
2371 - -DWITH_DEFAULT_FEATURE_SET=0
2372 - -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)"
2373 - -DENABLE_STATIC_LIBS=$(usex static-libs ON OFF)
2374 - # The build forces this to be defined when cross-compiling. We pass it
2375 - # all the time for simplicity and to make sure it is actually correct.
2376 - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
2377 - -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)"
2378 - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
2379 - -DAUTH_GSSAPI_PLUGIN_TYPE=$(usex kerberos DYNAMIC OFF)
2380 - -DCONC_WITH_EXTERNAL_ZLIB=YES
2381 - -DWITH_EXTERNAL_ZLIB=YES
2382 - -DSUFFIX_INSTALL_DIR=""
2383 - -DWITH_UNITTEST=OFF
2384 - )
2385 - if use test ; then
2386 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test )
2387 - else
2388 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
2389 - fi
2390 -
2391 - if ! use yassl ; then
2392 - mycmakeargs+=( -DWITH_SSL=system )
2393 - else
2394 - mycmakeargs+=( -DWITH_SSL=bundled )
2395 - fi
2396 -
2397 - if ! use client-libs ; then
2398 - mycmakeargs+=( -DWITHOUT_CLIENTLIBS=YES )
2399 - fi
2400 -
2401 - # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION
2402 - # systemtap only works on native ABI bug 530132
2403 - if multilib_is_native_abi; then
2404 - mycmakeargs+=(
2405 - -DWITH_READLINE=$(usex bindist 1 0)
2406 - -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1)
2407 - -DENABLE_DTRACE=$(usex systemtap)
2408 - )
2409 - else
2410 - mycmakeargs+=(
2411 - -DWITHOUT_TOOLS=1
2412 - -DWITH_READLINE=1
2413 - -DNOT_FOR_DISTRIBUTION=0
2414 - -DENABLE_DTRACE=0
2415 - )
2416 - fi
2417 -
2418 - if multilib_is_native_abi && use server ; then
2419 -
2420 - # Federated{,X} must be treated special otherwise they will not be built as plugins
2421 - if ! use extraengine ; then
2422 - mycmakeargs+=(
2423 - -DPLUGIN_FEDERATED=NO
2424 - -DPLUGIN_FEDERATEDX=NO )
2425 - fi
2426 -
2427 - mycmakeargs+=(
2428 - -DWITH_JEMALLOC=$(usex jemalloc system)
2429 - -DWITH_PCRE=system
2430 - -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO)
2431 - -DPLUGIN_SPHINX=$(usex sphinx YES NO)
2432 - -DPLUGIN_TOKUDB=$(usex tokudb YES NO)
2433 - -DPLUGIN_AUTH_PAM=$(usex pam YES NO)
2434 - -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO)
2435 - -DPLUGIN_CASSANDRA=NO
2436 - -DPLUGIN_SEQUENCE=$(usex extraengine YES NO)
2437 - -DPLUGIN_SPIDER=$(usex extraengine YES NO)
2438 - -DPLUGIN_CONNECT=$(usex extraengine YES NO)
2439 - -DCONNECT_WITH_MYSQL=1
2440 - -DCONNECT_WITH_LIBXML2=$(usex xml)
2441 - -DCONNECT_WITH_ODBC=$(usex odbc)
2442 - -DCONNECT_WITH_JDBC=$(usex jdbc)
2443 - # Build failure and autodep wrt bug 639144
2444 - -DCONNECT_WITH_MONGO=OFF
2445 - -DWITH_WSREP=$(usex galera)
2446 - -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF)
2447 - -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF)
2448 - -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF)
2449 - -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO)
2450 - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
2451 - -DWITH_MARIABACKUP=$(usex backup ON OFF)
2452 - -DWITH_LIBARCHIVE=$(usex backup ON OFF)
2453 - -DINSTALL_SQLBENCHDIR=share/mariadb
2454 - -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO)
2455 - # systemd is only linked to for server notification
2456 - -DWITH_SYSTEMD=$(usex systemd yes no)
2457 - -DWITH_NUMA=$(usex numa ON OFF)
2458 - )
2459 -
2460 - # Workaround for MDEV-14524
2461 - use tokudb && mycmakeargs+=( -DTOKUDB_OK=1 )
2462 -
2463 - if use test ; then
2464 - # This is needed for the new client lib which tests a real, open server
2465 - mycmakeargs+=( -DSKIP_TESTS=ON )
2466 - fi
2467 -
2468 - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
2469 - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
2470 - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
2471 - ewarn "You MUST file bugs without these variables set."
2472 -
2473 - mycmakeargs+=(
2474 - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
2475 - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
2476 - )
2477 -
2478 - elif ! use latin1 ; then
2479 - mycmakeargs+=(
2480 - -DDEFAULT_CHARSET=utf8
2481 - -DDEFAULT_COLLATION=utf8_general_ci
2482 - )
2483 - else
2484 - mycmakeargs+=(
2485 - -DDEFAULT_CHARSET=latin1
2486 - -DDEFAULT_COLLATION=latin1_swedish_ci
2487 - )
2488 - fi
2489 - mycmakeargs+=(
2490 - -DEXTRA_CHARSETS=all
2491 - -DMYSQL_USER=mysql
2492 - -DDISABLE_SHARED=$(usex static YES NO)
2493 - -DWITH_DEBUG=$(usex debug)
2494 - -DWITH_EMBEDDED_SERVER=OFF
2495 - -DWITH_PROFILING=$(usex profiling)
2496 - )
2497 -
2498 - if use static; then
2499 - mycmakeargs+=( -DWITH_PIC=1 )
2500 - fi
2501 -
2502 - if use jemalloc || use tcmalloc ; then
2503 - mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
2504 - fi
2505 -
2506 - # Storage engines
2507 - mycmakeargs+=(
2508 - -DWITH_ARCHIVE_STORAGE_ENGINE=1
2509 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1
2510 - -DWITH_CSV_STORAGE_ENGINE=1
2511 - -DWITH_HEAP_STORAGE_ENGINE=1
2512 - -DWITH_INNOBASE_STORAGE_ENGINE=1
2513 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1
2514 - -DWITH_MYISAM_STORAGE_ENGINE=1
2515 - -DWITH_PARTITION_STORAGE_ENGINE=1
2516 - )
2517 -
2518 - else
2519 - mycmakeargs+=(
2520 - -DWITHOUT_SERVER=1
2521 - -DWITH_EMBEDDED_SERVER=OFF
2522 - -DEXTRA_CHARSETS=none
2523 - -DINSTALL_SQLBENCHDIR=
2524 - -DWITH_SYSTEMD=no
2525 - )
2526 - fi
2527 -
2528 - cmake-utils_src_configure
2529 -}
2530 -
2531 -src_compile() {
2532 - if use client-libs ; then
2533 - multilib-minimal_src_compile
2534 - else
2535 - multilib_src_compile
2536 - fi
2537 -}
2538 -
2539 -multilib_src_compile() {
2540 - cmake-utils_src_compile
2541 -}
2542 -
2543 -src_install() {
2544 - local MULTILIB_WRAPPED_HEADERS
2545 - local MULTILIB_CHOST_TOOLS
2546 - if use client-libs ; then
2547 - # headers with ABI specific data
2548 - MULTILIB_WRAPPED_HEADERS=(
2549 - /usr/include/mysql/server/my_config.h
2550 - /usr/include/mysql/server/private/embedded_priv.h
2551 - /usr/include/mysql/server/mysql_version.h
2552 - /usr/include/mariadb/mariadb_version.h
2553 - /usr/include/mysql/mariadb_version.h
2554 - /usr/include/mysql/server/private/probes_mysql_nodtrace.h
2555 - /usr/include/mysql/server/private/probes_mysql_dtrace.h )
2556 -
2557 - # wrap the config scripts
2558 - MULTILIB_CHOST_TOOLS=( /usr/bin/mariadb_config /usr/bin/mysql_config )
2559 - multilib-minimal_src_install
2560 - else
2561 - multilib_src_install
2562 - multilib_src_install_all
2563 - fi
2564 -}
2565 -
2566 -# Intentionally override eclass function
2567 -multilib_src_install() {
2568 -
2569 - cmake-utils_src_install
2570 -
2571 - # Make sure the vars are correctly initialized
2572 - mysql_init_vars
2573 -
2574 - # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used
2575 - if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then
2576 - rm "${ED}/usr/include/mysql/server/private/config.h" || die
2577 - fi
2578 -
2579 - if ! multilib_is_native_abi && use server ; then
2580 - insinto /usr/include/mysql/server/private
2581 - doins "${S}"/sql/*.h
2582 - fi
2583 -
2584 - if use client-libs ; then
2585 - # Install compatible symlinks to libmysqlclient
2586 -# use static-libs && dosym libmariadbclient.a "/usr/$(get_libdir)/libmysqlclient.a"
2587 -# dosym libmariadb.so.3 "/usr/$(get_libdir)/libmysqlclient.so"
2588 - dosym libmariadb.so.3 "/usr/$(get_libdir)/libmysqlclient.so.${SUBSLOT}"
2589 - fi
2590 -
2591 - # Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them.
2592 - find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die
2593 -}
2594 -
2595 -multilib_src_install_all() {
2596 - # Make sure the vars are correctly initialized
2597 - mysql_init_vars
2598 -
2599 - # Convenience links
2600 - einfo "Making Convenience links for mysqlcheck multi-call binary"
2601 - dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
2602 - dosym "mysqlcheck" "/usr/bin/mysqlrepair"
2603 - dosym "mysqlcheck" "/usr/bin/mysqloptimize"
2604 -
2605 - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
2606 - if [[ -d "${ED}/usr/data" ]] ; then
2607 - rm -Rf "${ED}/usr/data" || die
2608 - fi
2609 -
2610 - # Unless they explicitly specific USE=test, then do not install the
2611 - # testsuite. It DOES have a use to be installed, esp. when you want to do a
2612 - # validation of your database configuration after tuning it.
2613 - if ! use test ; then
2614 - rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
2615 - fi
2616 -
2617 - # Configuration stuff
2618 - einfo "Building default configuration ..."
2619 - insinto "${MY_SYSCONFDIR#${EPREFIX}}"
2620 - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
2621 - cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die
2622 - eprefixify "${TMPDIR}/my.cnf"
2623 - doins "${TMPDIR}/my.cnf"
2624 - insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d"
2625 - cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
2626 - eprefixify "${TMPDIR}/50-distro-client.cnf"
2627 - doins "${TMPDIR}/50-distro-client.cnf"
2628 -
2629 - if use server ; then
2630 - mycnf_src="my.cnf.distro-server"
2631 - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
2632 - "${FILESDIR}/${mycnf_src}" \
2633 - > "${TMPDIR}/my.cnf.ok" || die
2634 - if use prefix ; then
2635 - sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
2636 - "${TMPDIR}/my.cnf.ok" || die
2637 - fi
2638 - if use latin1 ; then
2639 - sed -i \
2640 - -e "/character-set/s|utf8|latin1|g" \
2641 - "${TMPDIR}/my.cnf.ok" || die
2642 - fi
2643 - eprefixify "${TMPDIR}/my.cnf.ok"
2644 - newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
2645 -
2646 - einfo "Including support files and sample configurations"
2647 - docinto "support-files"
2648 - local script
2649 - for script in \
2650 - "${S}"/support-files/magic
2651 - do
2652 - [[ -f "$script" ]] && dodoc "${script}"
2653 - done
2654 -
2655 - docinto "scripts"
2656 - for script in "${S}"/scripts/mysql* ; do
2657 - [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
2658 - done
2659 - fi
2660 -
2661 - #Remove mytop if perl is not selected
2662 - [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop"
2663 -}
2664 -
2665 -# Official test instructions:
2666 -# USE='extraengine perl server static-libs' \
2667 -# FEATURES='test userpriv -usersandbox' \
2668 -# ebuild mariadb-X.X.XX.ebuild \
2669 -# digest clean package
2670 -src_test() {
2671 -
2672 - _disable_test() {
2673 - local rawtestname reason
2674 - rawtestname="${1}" ; shift
2675 - reason="${@}"
2676 - ewarn "test '${rawtestname}' disabled: '${reason}'"
2677 - echo ${rawtestname} : ${reason} >> "${T}/disabled.def"
2678 - }
2679 -
2680 - local TESTDIR="${BUILD_DIR}/mysql-test"
2681 - local retstatus_unit
2682 - local retstatus_tests
2683 -
2684 - if ! use server ; then
2685 - einfo "Skipping server tests due to minimal build."
2686 - return 0
2687 - fi
2688 -
2689 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
2690 - # localhost. Also causes weird failures.
2691 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
2692 -
2693 - if [[ $UID -eq 0 ]]; then
2694 - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
2695 - fi
2696 - has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox"
2697 -
2698 - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
2699 -
2700 - # Run CTest (test-units)
2701 - cmake-utils_src_test
2702 - retstatus_unit=$?
2703 -
2704 - # Ensure that parallel runs don't die
2705 - export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
2706 - # Enable parallel testing, auto will try to detect number of cores
2707 - # You may set this by hand.
2708 - # The default maximum is 8 unless MTR_MAX_PARALLEL is increased
2709 - export MTR_PARALLEL="${MTR_PARALLEL:-auto}"
2710 -
2711 - # create directories because mysqladmin might run out of order
2712 - mkdir -p "${T}"/var-tests{,/log} || die
2713 -
2714 - # Run mysql tests
2715 - pushd "${TESTDIR}" > /dev/null || die
2716 -
2717 - touch "${T}/disabled.def"
2718 - # These are failing in MariaDB 10.0 for now and are believed to be
2719 - # false positives:
2720 - #
2721 - # main.mysql_client_test, main.mysql_client_test_nonblock
2722 - # main.mysql_client_test_comp:
2723 - # segfaults at random under Portage only, suspect resource limits.
2724 -
2725 - local t
2726 - for t in plugins.cracklib_password_check plugins.two_password_validations ; do
2727 - _disable_test "$t" "False positive due to varying policies"
2728 - done
2729 -
2730 - for t in main.mysql_client_test main.mysql_client_test_nonblock \
2731 - main.mysql_client_test_comp rpl.rpl_extra_col_master_myisam ; do
2732 - _disable_test "$t" "False positives in Gentoo"
2733 - done
2734 -
2735 - if ! use client-libs ; then
2736 - _disable_test main.plugin_auth "Needs client libraries built"
2737 - fi
2738 -
2739 - _disable_test main.mysql "Bogus error text mismatch failure"
2740 -
2741 - # run mysql-test tests
2742 - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def"
2743 - retstatus_tests=$?
2744 -
2745 - popd > /dev/null || die
2746 -
2747 - # Cleanup is important for these testcases.
2748 - pkill -9 -f "${S}/ndb" 2>/dev/null
2749 - pkill -9 -f "${S}/sql" 2>/dev/null
2750 -
2751 - local failures=""
2752 - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
2753 - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
2754 -
2755 - [[ -z "$failures" ]] || die "Test failures: $failures"
2756 - einfo "Tests successfully completed"
2757 -}
2758 -
2759 -mysql_init_vars() {
2760 - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"}
2761 - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
2762 - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
2763 - MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
2764 -
2765 - if [[ -z "${MY_DATADIR}" ]] ; then
2766 - MY_DATADIR=""
2767 - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
2768 - MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
2769 - | sed -ne '/datadir/s|^--datadir=||p' \
2770 - | tail -n1`
2771 - if [[ -z "${MY_DATADIR}" ]] ; then
2772 - MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
2773 - | sed -e 's/.*=\s*//' \
2774 - | tail -n1`
2775 - fi
2776 - fi
2777 - if [[ -z "${MY_DATADIR}" ]] ; then
2778 - MY_DATADIR="${MY_LOCALSTATEDIR}"
2779 - einfo "Using default MY_DATADIR"
2780 - fi
2781 - elog "MySQL MY_DATADIR is ${MY_DATADIR}"
2782 -
2783 - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
2784 - if [[ -e "${MY_DATADIR}" ]] ; then
2785 - # If you get this and you're wondering about it, see bug #207636
2786 - elog "MySQL datadir found in ${MY_DATADIR}"
2787 - elog "A new one will not be created."
2788 - PREVIOUS_DATADIR="yes"
2789 - else
2790 - PREVIOUS_DATADIR="no"
2791 - fi
2792 - export PREVIOUS_DATADIR
2793 - fi
2794 - else
2795 - if [[ ${EBUILD_PHASE} == "config" ]]; then
2796 - local new_MY_DATADIR
2797 - new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
2798 - | sed -ne '/datadir/s|^--datadir=||p' \
2799 - | tail -n1`
2800 -
2801 - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
2802 - ewarn "MySQL MY_DATADIR has changed"
2803 - ewarn "from ${MY_DATADIR}"
2804 - ewarn "to ${new_MY_DATADIR}"
2805 - MY_DATADIR="${new_MY_DATADIR}"
2806 - fi
2807 - fi
2808 - fi
2809 -
2810 - export MY_SHAREDSTATEDIR MY_SYSCONFDIR
2811 - export MY_LOCALSTATEDIR MY_LOGDIR
2812 - export MY_DATADIR
2813 -}
2814 -
2815 -pkg_config() {
2816 - _getoptval() {
2817 - local mypd="${EROOT}"/usr/bin/my_print_defaults
2818 - local section="$1"
2819 - local flag="--${2}="
2820 - local extra_options="${3}"
2821 - "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp"
2822 - }
2823 - local old_MY_DATADIR="${MY_DATADIR}"
2824 - local old_HOME="${HOME}"
2825 - # my_print_defaults needs to read stuff in $HOME/.my.cnf
2826 - export HOME=${EPREFIX}/root
2827 -
2828 - # Make sure the vars are correctly initialized
2829 - mysql_init_vars
2830 -
2831 - [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
2832 - if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then
2833 - die "Minimal builds do NOT include the MySQL server"
2834 - fi
2835 -
2836 - if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then
2837 - local MY_DATADIR_s="${ROOT}/${MY_DATADIR}"
2838 - MY_DATADIR_s="${MY_DATADIR_s%%/}"
2839 - local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}"
2840 - old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
2841 -
2842 - if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then
2843 - if [[ -d "${MY_DATADIR_s}" ]]; then
2844 - ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
2845 - ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
2846 - else
2847 - elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
2848 - mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
2849 - || die "Moving MY_DATADIR failed"
2850 - fi
2851 - else
2852 - ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
2853 - if [[ -d "${MY_DATADIR_s}" ]]; then
2854 - ewarn "Attempting to use ${MY_DATADIR_s}"
2855 - else
2856 - eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
2857 - die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
2858 - fi
2859 - fi
2860 - fi
2861 -
2862 - local pwd1="a"
2863 - local pwd2="b"
2864 - local maxtry=15
2865 -
2866 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
2867 - local tmp_mysqld_password_source=
2868 -
2869 - for tmp_mysqld_password_source in mysql client; do
2870 - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
2871 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
2872 - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then
2873 - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then
2874 - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
2875 - MYSQL_ROOT_PASSWORD=
2876 - continue
2877 - fi
2878 -
2879 - einfo "Found password in '${tmp_mysqld_password_source}' section!"
2880 - break
2881 - fi
2882 - done
2883 -
2884 - # Sometimes --show is required to display passwords in some implementations of my_print_defaults
2885 - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then
2886 - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
2887 - fi
2888 -
2889 - unset tmp_mysqld_password_source
2890 - fi
2891 - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir)"
2892 - # These are dir+prefix
2893 - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log)"
2894 - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
2895 - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin)"
2896 - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
2897 -
2898 - if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then
2899 - einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
2900 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR"
2901 - fi
2902 - if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then
2903 - einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
2904 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN"
2905 - fi
2906 - if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then
2907 - einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
2908 - install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG"
2909 - fi
2910 -
2911 - if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then
2912 - ewarn "You have already a MySQL database in place."
2913 - ewarn "(${ROOT}/${MY_DATADIR}/*)"
2914 - ewarn "Please rename or delete it if you wish to replace it."
2915 - die "MySQL database already exists!"
2916 - fi
2917 -
2918 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
2919 - # localhost. Also causes weird failures.
2920 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
2921 -
2922 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
2923 -
2924 - einfo "Please provide a password for the mysql 'root' user now"
2925 - einfo "or through the ${HOME}/.my.cnf file."
2926 - ewarn "Avoid [\"'\\_%] characters in the password"
2927 - read -rsp " >" pwd1 ; echo
2928 -
2929 - einfo "Retype the password"
2930 - read -rsp " >" pwd2 ; echo
2931 -
2932 - if [[ "x$pwd1" != "x$pwd2" ]] ; then
2933 - die "Passwords are not the same"
2934 - fi
2935 - MYSQL_ROOT_PASSWORD="${pwd1}"
2936 - unset pwd1 pwd2
2937 - fi
2938 -
2939 - local options
2940 - local sqltmp="$(emktemp)"
2941 -
2942 - # Fix bug 446200. Don't reference host my.cnf, needs to come first,
2943 - # see http://bugs.mysql.com/bug.php?id=31312
2944 - use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
2945 -
2946 - # Figure out which options we need to disable to do the setup
2947 - local helpfile="${TMPDIR}/mysqld-help"
2948 - "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
2949 - for opt in grant-tables host-cache name-resolve networking slave-start \
2950 - federated ssl log-bin relay-log slow-query-log external-locking \
2951 - log-slave-updates \
2952 - ; do
2953 - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
2954 - egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
2955 - done
2956 -
2957 - einfo "Creating the mysql database and setting proper permissions on it ..."
2958 -
2959 - # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
2960 - PID_DIR="${EROOT}/var/run/mysqld"
2961 - if [[ ! -d "${PID_DIR}" ]]; then
2962 - install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
2963 - fi
2964 -
2965 - if [[ ! -d "${MY_DATADIR}" ]]; then
2966 - install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory"
2967 - fi
2968 -
2969 - pushd "${TMPDIR}" &>/dev/null || die
2970 -
2971 - # Filling timezones, see
2972 - # http://dev.mysql.com/doc/mysql/en/time-zone-support.html
2973 - "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null
2974 -
2975 - local cmd=( "${EROOT}usr/share/mariadb/scripts/mysql_install_db" )
2976 - [[ -f "${cmd}" ]] || cmd=( "${EROOT}usr/bin/mysql_install_db" )
2977 - cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" )
2978 - einfo "Command: ${cmd[*]}"
2979 - su -s /bin/sh -c "${cmd[*]}" mysql \
2980 - >"${TMPDIR}"/mysql_install_db.log 2>&1
2981 - if [ $? -ne 0 ]; then
2982 - grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2
2983 - die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log"
2984 - fi
2985 - popd &>/dev/null || die
2986 - [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \
2987 - || die "MySQL databases not installed"
2988 -
2989 - use prefix || options="${options} --user=mysql"
2990 -
2991 - local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock"
2992 - local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid"
2993 - local mysqld="${EROOT}/usr/sbin/mysqld \
2994 - ${options} \
2995 - --log-warnings=0 \
2996 - --basedir=${EROOT}/usr \
2997 - --datadir=${ROOT}/${MY_DATADIR} \
2998 - --max_allowed_packet=8M \
2999 - --net_buffer_length=16K \
3000 - --socket=${socket} \
3001 - --pid-file=${pidfile}
3002 - --tmpdir=${ROOT}/${MYSQL_TMPDIR}"
3003 - #einfo "About to start mysqld: ${mysqld}"
3004 - ebegin "Starting mysqld"
3005 - einfo "Command ${mysqld}"
3006 - ${mysqld} &
3007 - rc=$?
3008 - while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
3009 - maxtry=$((${maxtry}-1))
3010 - echo -n "."
3011 - sleep 1
3012 - done
3013 - eend $rc
3014 -
3015 - if ! [[ -S "${socket}" ]]; then
3016 - die "Completely failed to start up mysqld with: ${mysqld}"
3017 - fi
3018 -
3019 - ebegin "Setting root password"
3020 - # Do this from memory, as we don't want clear text passwords in temp files
3021 - local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES"
3022 - "${EROOT}/usr/bin/mysql" \
3023 - "--socket=${socket}" \
3024 - -hlocalhost \
3025 - -e "${sql}"
3026 - eend $?
3027 -
3028 - if [[ -n "${sqltmp}" ]] ; then
3029 - ebegin "Loading \"zoneinfo\", this step may require a few seconds"
3030 - "${EROOT}/usr/bin/mysql" \
3031 - "--socket=${socket}" \
3032 - -hlocalhost \
3033 - -uroot \
3034 - --password="${MYSQL_ROOT_PASSWORD}" \
3035 - mysql < "${sqltmp}"
3036 - rc=$?
3037 - eend $?
3038 - [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!"
3039 - fi
3040 -
3041 - # Stop the server and cleanup
3042 - einfo "Stopping the server ..."
3043 - kill $(< "${pidfile}" )
3044 - rm -f "${sqltmp}"
3045 - wait %1
3046 - einfo "Done"
3047 -}