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