/[gentoo-x86]/eclass/mysql-v2.eclass
Gentoo

Diff of /eclass/mysql-v2.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.24 Revision 1.25
1# Copyright 1999-2012 Gentoo Foundation 1# Copyright 1999-2012 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/mysql-v2.eclass,v 1.24 2013/02/13 00:40:57 robbat2 Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/mysql-v2.eclass,v 1.25 2013/06/26 19:31:49 jmbsvicetto Exp $
4 4
5# @ECLASS: mysql-v2.eclass 5# @ECLASS: mysql-v2.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Maintainers: 7# Maintainers:
8# - MySQL Team <mysql-bugs@gentoo.org> 8# - MySQL Team <mysql-bugs@gentoo.org>
9# - Robin H. Johnson <robbat2@gentoo.org> 9# - Robin H. Johnson <robbat2@gentoo.org>
10# - Jorge Manuel B. S. Vicetto <jmbsvicetto@gentoo.org> 10# - Jorge Manuel B. S. Vicetto <jmbsvicetto@gentoo.org>
11# @BLURB: This eclass provides most of the functions for mysql ebuilds 11# @BLURB: This eclass provides most of the functions for mysql ebuilds
12# @DESCRIPTION: 12# @DESCRIPTION:
13# The mysql-v2.eclass is the base eclass to build the mysql and 13# The mysql-v2.eclass is the base eclass to build the mysql and
14# alternative projects (mariadb) ebuilds. 14# alternative projects (mariadb and percona) ebuilds.
15# This eclass uses the mysql-autotools and mysql-cmake eclasses for the 15# This eclass uses the mysql-autotools and mysql-cmake eclasses for the
16# specific bits related to the build system. 16# specific bits related to the build system.
17# It provides the src_unpack, src_prepare, src_configure, src_compile, 17# It provides the src_unpack, src_prepare, src_configure, src_compile,
18# src_install, pkg_preinst, pkg_postinst, pkg_config and pkg_postrm 18# src_install, pkg_preinst, pkg_postinst, pkg_config and pkg_postrm
19# phase hooks. 19# phase hooks.
42 42
43# @ECLASS-VARIABLE: MYSQL_EXTRAS_VER 43# @ECLASS-VARIABLE: MYSQL_EXTRAS_VER
44# @DESCRIPTION: 44# @DESCRIPTION:
45# The version of the MYSQL_EXTRAS repo to use to build mysql 45# The version of the MYSQL_EXTRAS repo to use to build mysql
46# Use "none" to disable it's use 46# Use "none" to disable it's use
47[[ "${MY_EXTRAS_VER}" == "live" ]] && MYSQL_EXTRAS="git-2" 47[[ ${MY_EXTRAS_VER} == "live" ]] && MYSQL_EXTRAS="git-2"
48 48
49inherit eutils flag-o-matic gnuconfig ${MYSQL_EXTRAS} ${BUILD_INHERIT} mysql_fx versionator toolchain-funcs 49inherit eutils flag-o-matic gnuconfig ${MYSQL_EXTRAS} ${BUILD_INHERIT} mysql_fx versionator toolchain-funcs
50 50
51# 51#
52# Supported EAPI versions and export functions 52# Supported EAPI versions and export functions
53# 53#
54 54
55case "${EAPI:-0}" in 55case "${EAPI:-0}" in
56 3|4|5) ;; 56 4|5) ;;
57 *) die "Unsupported EAPI: ${EAPI}" ;; 57 *) die "Unsupported EAPI: ${EAPI}" ;;
58esac 58esac
59 59
60EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_install pkg_preinst pkg_postinst pkg_config pkg_postrm 60EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_install pkg_preinst pkg_postinst pkg_config pkg_postrm
61 61
65 65
66# Shorten the path because the socket path length must be shorter than 107 chars 66# Shorten the path because the socket path length must be shorter than 107 chars
67# and we will run a mysql server during test phase 67# and we will run a mysql server during test phase
68S="${WORKDIR}/mysql" 68S="${WORKDIR}/mysql"
69 69
70[[ "${MY_EXTRAS_VER}" == "latest" ]] && MY_EXTRAS_VER="20090228-0714Z" 70[[ ${MY_EXTRAS_VER} == "latest" ]] && MY_EXTRAS_VER="20090228-0714Z"
71if [[ "${MY_EXTRAS_VER}" == "live" ]]; then 71if [[ ${MY_EXTRAS_VER} == "live" ]]; then
72 EGIT_PROJECT=mysql-extras 72 EGIT_PROJECT=mysql-extras
73 EGIT_REPO_URI="git://git.overlays.gentoo.org/proj/mysql-extras.git" 73 EGIT_REPO_URI="git://git.overlays.gentoo.org/proj/mysql-extras.git"
74fi 74fi
75 75
76# @ECLASS-VARIABLE: MYSQL_PV_MAJOR 76# @ECLASS-VARIABLE: MYSQL_PV_MAJOR
111# @DEFAULT_UNSET 111# @DEFAULT_UNSET
112# @DESCRIPTION: 112# @DESCRIPTION:
113# Designation by PERCONA for a MySQL version to apply an XTRADB release 113# Designation by PERCONA for a MySQL version to apply an XTRADB release
114 114
115# Work out the default SERVER_URI correctly 115# Work out the default SERVER_URI correctly
116if [ -z "${SERVER_URI}" ]; then 116if [[ -z ${SERVER_URI} ]]; then
117 [ -z "${MY_PV}" ] && MY_PV="${PV//_/-}" 117 [[ -z ${MY_PV} ]] && MY_PV="${PV//_/-}"
118 if [ "${PN}" == "mariadb" ]; then 118 if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]]; then
119 MARIA_FULL_PV="$(replace_version_separator 3 '-' ${MY_PV})" 119 MARIA_FULL_PV=$(replace_version_separator 3 '-' ${MY_PV})
120 MARIA_FULL_P="${PN}-${MARIA_FULL_PV}" 120 MARIA_FULL_P="${PN}-${MARIA_FULL_PV}"
121 SERVER_URI=" 121 SERVER_URI="
122 http://ftp.osuosl.org/pub/mariadb/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz 122 http://ftp.osuosl.org/pub/mariadb/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz
123 http://ftp.rediris.es/mirror/MariaDB/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz 123 http://ftp.rediris.es/mirror/MariaDB/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz
124 http://maria.llarian.net/download/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz 124 http://maria.llarian.net/download/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz
125 http://launchpad.net/maria/${MYSQL_PV_MAJOR}/ongoing/+download/${MARIA_FULL_P}.tar.gz 125 http://launchpad.net/maria/${MYSQL_PV_MAJOR}/ongoing/+download/${MARIA_FULL_P}.tar.gz
126 http://mirrors.fe.up.pt/pub/${PN}/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz 126 http://mirrors.fe.up.pt/pub/${PN}/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz
127 http://ftp-stud.hs-esslingen.de/pub/Mirrors/${PN}/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz 127 http://ftp-stud.hs-esslingen.de/pub/Mirrors/${PN}/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz
128 " 128 "
129 if [[ ${PN} == "mariadb-galera" ]]; then
130 MY_SOURCEDIR="${PN%%-galera}-${MARIA_FULL_PV}"
131 fi
132 elif [[ ${PN} == "percona-server" ]]; then
133 PERCONA_PN="Percona-Server"
134 MIRROR_PV=$(get_version_component_range 1-2 ${PV})
135 MY_PV=$(get_version_component_range 1-3 ${PV})
136 MY_PATCH=$(get_version_component_range 4 ${PV})
137 SERVER_URI="http://www.percona.com/redir/downloads/${PERCONA_PN}-${MIRROR_PV}/LATEST/source/${PERCONA_PN}-${MY_PV}-rel30.${MY_PATCH}.tar.gz"
138# http://www.percona.com/redir/downloads/Percona-Server-5.5/LATEST/source/Percona-Server-5.5.30-rel30.2.tar.gz
129 else 139 else
130 URI_DIR="MySQL" 140 URI_DIR="MySQL"
131 URI_FILE="mysql" 141 URI_FILE="mysql"
132 URI_A="${URI_FILE}-${MY_PV}.tar.gz" 142 URI_A="${URI_FILE}-${MY_PV}.tar.gz"
133 MIRROR_PV=$(get_version_component_range 1-2 ${PV}) 143 MIRROR_PV=$(get_version_component_range 1-2 ${PV})
139 149
140# Define correct SRC_URIs 150# Define correct SRC_URIs
141SRC_URI="${SERVER_URI}" 151SRC_URI="${SERVER_URI}"
142 152
143# Gentoo patches to MySQL 153# Gentoo patches to MySQL
144[[ ${MY_EXTRAS_VER} != live ]] && [[ ${MY_EXTRAS_VER} != none ]] \ 154if [[ ${MY_EXTRAS_VER} != "live" && ${MY_EXTRAS_VER} != "none" ]]; then
145&& SRC_URI="${SRC_URI} 155 SRC_URI="${SRC_URI}
146 mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 156 mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
147 http://g3nt8.org/patches/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 157 http://g3nt8.org/patches/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
148 http://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 158 http://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
149 http://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" 159 http://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
160fi
150 161
151DESCRIPTION="A fast, multi-threaded, multi-user SQL database server." 162DESCRIPTION="A fast, multi-threaded, multi-user SQL database server."
152HOMEPAGE="http://www.mysql.com/" 163HOMEPAGE="http://www.mysql.com/"
153if [[ "${PN}" == "mariadb" ]]; then 164if [[ ${PN} == "mariadb" ]]; then
154 HOMEPAGE="http://mariadb.org/" 165 HOMEPAGE="http://mariadb.org/"
155 DESCRIPTION="An enhanced, drop-in replacement for MySQL" 166 DESCRIPTION="An enhanced, drop-in replacement for MySQL"
167fi
168if [[ ${PN} == "mariadb-galera" ]]; then
169 HOMEPAGE="http://mariadb.org/"
170 DESCRIPTION="An enhanced, drop-in replacement for MySQL with Galera Replication"
171fi
172if [[ ${PN} == "percona-server" ]]; then
173 HOMEPAGE="http://www.percona.com/software/percona-server"
174 DESCRIPTION="An enhanced, drop-in replacement fro MySQL from the Percona team"
156fi 175fi
157LICENSE="GPL-2" 176LICENSE="GPL-2"
158SLOT="0" 177SLOT="0"
159 178
160case "${BUILD}" in 179case "${BUILD}" in
170 189
171IUSE="${IUSE} extraengine" 190IUSE="${IUSE} extraengine"
172IUSE="${IUSE} cluster" 191IUSE="${IUSE} cluster"
173 192
174IUSE="${IUSE} max-idx-128" 193IUSE="${IUSE} max-idx-128"
175IUSE="${IUSE} berkdb"
176IUSE="${IUSE} +community profiling" 194IUSE="${IUSE} +community profiling"
177 195
178[[ ${PN} == "mariadb" ]] \ 196if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]]; then
179&& mysql_check_version_range "5.1.38 to 5.3.99" \ 197 mysql_check_version_range "5.1.38 to 5.3.99" && IUSE="${IUSE} libevent"
180&& IUSE="${IUSE} libevent" 198 mysql_version_is_at_least "5.2" && IUSE="${IUSE} oqgraph"
181 199 mysql_version_is_at_least "5.2.5" && IUSE="${IUSE} sphinx"
182[[ ${PN} == "mariadb" ]] \ 200 mysql_version_is_at_least "5.2.10" && IUSE="${IUSE} pam"
183&& mysql_version_is_at_least "5.2" \ 201fi
184&& IUSE="${IUSE} oqgraph"
185
186[[ ${PN} == "mariadb" ]] \
187&& mysql_version_is_at_least "5.2.5" \
188&& IUSE="${IUSE} sphinx"
189
190[[ ${PN} == "mariadb" ]] \
191&& mysql_version_is_at_least "5.2.10" \
192&& IUSE="${IUSE} pam"
193 202
194if mysql_version_is_at_least "5.5"; then 203if mysql_version_is_at_least "5.5"; then
195 REQUIRED_USE="tcmalloc? ( !jemalloc ) jemalloc? ( !tcmalloc )" 204 REQUIRED_USE="tcmalloc? ( !jemalloc ) jemalloc? ( !tcmalloc )"
196 IUSE="${IUSE} jemalloc tcmalloc" 205 IUSE="${IUSE} jemalloc tcmalloc"
197fi 206fi
198 207
208if mysql_version_is_at_least "5.5.7"; then
209 IUSE="${IUSE} systemtap"
210fi
211
212if [[ ${PN} == "percona-server" ]]; then
213 mysql_version_is_at_least "5.5.10" && IUSE="${IUSE} pam"
214fi
215
199REQUIRED_USE="${REQUIRED_USE} minimal? ( !cluster !extraengine !embedded ) static? ( !ssl )" 216REQUIRED_USE="${REQUIRED_USE} minimal? ( !cluster !extraengine !embedded ) static? ( !ssl )"
200
201mysql_version_is_at_least "5.5.7" \
202&& IUSE="${IUSE} systemtap"
203 217
204# 218#
205# DEPENDENCIES: 219# DEPENDENCIES:
206# 220#
207 221
214 >=sys-apps/texinfo-4.7-r1 228 >=sys-apps/texinfo-4.7-r1
215 >=sys-libs/readline-4.1 229 >=sys-libs/readline-4.1
216 >=sys-libs/zlib-1.2.3 230 >=sys-libs/zlib-1.2.3
217" 231"
218 232
219[[ ${PN} == mariadb ]] \ 233if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] ; then
220&& mysql_check_version_range "5.1.38 to 5.3.99" \ 234 mysql_check_version_range "5.1.38 to 5.3.99" && DEPEND="${DEPEND} libevent? ( >=dev-libs/libevent-1.4 )"
221&& DEPEND="${DEPEND} libevent? ( >=dev-libs/libevent-1.4 )" 235 mysql_version_is_at_least "5.2" && DEPEND="${DEPEND} oqgraph? ( >=dev-libs/boost-1.40.0 )"
236 mysql_version_is_at_least "5.2.5" && DEPEND="${DEPEND} sphinx? ( app-misc/sphinx )"
237 mysql_version_is_at_least "5.2.10" && DEPEND="${DEPEND} !minimal? ( pam? ( virtual/pam ) )"
238 # Bug 441700 MariaDB >=5.3 include custom mytop
239 mysql_version_is_at_least "5.3" && DEPEND="${DEPEND} perl? ( !dev-db/mytop )"
240fi
222 241
223# Having different flavours at the same time is not a good idea 242# Having different flavours at the same time is not a good idea
224for i in "mysql" "mariadb" ; do 243for i in "mysql" "mariadb" "mariadb-galera" "percona-server"; do
225 [[ ${i} == ${PN} ]] || 244 [[ ${i} == ${PN} ]] ||
226 DEPEND="${DEPEND} !dev-db/${i}" 245 DEPEND="${DEPEND} !dev-db/${i}"
227done 246done
228 247
229[[ "${PN}" == "mariadb" ]] \
230&& mysql_version_is_at_least "5.2" \
231&& DEPEND="${DEPEND} oqgraph? ( >=dev-libs/boost-1.40.0 )"
232
233[[ "${PN}" == "mariadb" ]] \
234&& mysql_version_is_at_least "5.2.5" \
235&& DEPEND="${DEPEND} sphinx? ( app-misc/sphinx )"
236
237[[ "${PN}" == "mariadb" ]] \
238&& mysql_version_is_at_least "5.2.10" \
239&& DEPEND="${DEPEND} !minimal? ( pam? ( virtual/pam ) )"
240
241# Bug 441700 MariaDB >=5.3 include custom mytop
242[[ "${PN}" == "mariadb" ]] \
243&& mysql_version_is_at_least "5.3" \
244&& DEPEND="${DEPEND} perl? ( !dev-db/mytop )"
245
246mysql_version_is_at_least "5.5.7" \
247&& DEPEND="${DEPEND} systemtap? ( >=dev-util/systemtap-1.3 )" \
248&& DEPEND="${DEPEND} kernel_linux? ( dev-libs/libaio )"
249
250mysql_version_is_at_least "5.5" \ 248if mysql_version_is_at_least "5.5" ; then
251&& DEPEND="${DEPEND} jemalloc? ( dev-libs/jemalloc )" 249 DEPEND="${DEPEND} jemalloc? ( dev-libs/jemalloc )"
252
253mysql_version_is_at_least "5.5" \
254&& DEPEND="${DEPEND} tcmalloc? ( dev-util/google-perftools )" 250 DEPEND="${DEPEND} tcmalloc? ( dev-util/google-perftools )"
251fi
252
253if mysql_version_is_at_least "5.5.7" ; then
254 DEPEND="${DEPEND} systemtap? ( >=dev-util/systemtap-1.3 )"
255 DEPEND="${DEPEND} kernel_linux? ( dev-libs/libaio )"
256fi
255 257
256# prefix: first need to implement something for #196294 258# prefix: first need to implement something for #196294
257RDEPEND="${DEPEND} 259RDEPEND="${DEPEND}
258 !minimal? ( !prefix? ( dev-db/mysql-init-scripts ) ) 260 !minimal? ( !prefix? ( dev-db/mysql-init-scripts ) )
259 selinux? ( sec-policy/selinux-mysql ) 261 selinux? ( sec-policy/selinux-mysql )
260" 262"
261 263
264if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] ; then
262# Bug 455016 Add dependancies of mytop 265 # Bug 455016 Add dependencies of mytop
263[[ "${PN}" == "mariadb" ]] \
264&& mysql_version_is_at_least "5.3" \ 266 if mysql_version_is_at_least "5.3" ; then
265&& RDEPEND="${RDEPEND} perl? ( 267 RDEPEND="${RDEPEND} perl? (
266 virtual/perl-Getopt-Long 268 virtual/perl-Getopt-Long
267 dev-perl/TermReadKey 269 dev-perl/TermReadKey
268 virtual/perl-Term-ANSIColor 270 virtual/perl-Term-ANSIColor
269 virtual/perl-Time-HiRes ) " 271 virtual/perl-Time-HiRes ) "
272 fi
273fi
270 274
271DEPEND="${DEPEND} 275DEPEND="${DEPEND}
272 virtual/yacc 276 virtual/yacc
273" 277"
274 278
276 280
277# compile-time-only 281# compile-time-only
278DEPEND="${DEPEND} >=dev-util/cmake-2.4.3" 282DEPEND="${DEPEND} >=dev-util/cmake-2.4.3"
279 283
280# compile-time-only 284# compile-time-only
281mysql_version_is_at_least "5.5.8" \ 285if mysql_version_is_at_least "5.5.8" ; then
282&& DEPEND="${DEPEND} >=dev-util/cmake-2.6.3" 286 DEPEND="${DEPEND} >=dev-util/cmake-2.6.3"
287fi
283 288
284# dev-perl/DBD-mysql is needed by some scripts installed by MySQL 289# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
285PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )" 290PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
286 291
287# For other stuff to bring us in 292# For other stuff to bring us in
293 298
294# MariaDB has integrated PBXT 299# MariaDB has integrated PBXT
295# PBXT_VERSION means that we have a PBXT patch for this PV 300# PBXT_VERSION means that we have a PBXT patch for this PV
296# PBXT was only introduced after 5.1.12 301# PBXT was only introduced after 5.1.12
297pbxt_patch_available() { 302pbxt_patch_available() {
298 [[ ${PN} != "mariadb" ]] \ 303 [[ ${PN} != "mariadb" && ${PN} != "mariadb-galera" && ( -n "${PBXT_VERSION}" ) ]]
299 && [[ -n "${PBXT_VERSION}" ]]
300 return $? 304 return $?
301} 305}
302 306
303pbxt_available() { 307pbxt_available() {
304 pbxt_patch_available || [[ ${PN} == "mariadb" ]] 308 pbxt_patch_available || [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]]
305 return $? 309 return $?
306} 310}
307 311
308# Get the percona tarball if XTRADB_VER and PERCONA_VER are both set 312# Get the percona tarball if XTRADB_VER and PERCONA_VER are both set
309# MariaDB has integrated XtraDB 313# MariaDB has integrated XtraDB
310# XTRADB_VERS means that we have a XTRADB patch for this PV 314# XTRADB_VERS means that we have a XTRADB patch for this PV
311# XTRADB was only introduced after 5.1.26 315# XTRADB was only introduced after 5.1.26
312xtradb_patch_available() { 316xtradb_patch_available() {
313 [[ ${PN} != "mariadb" ]] \ 317 [[ ${PN} != "mariadb" && ${PN} != "mariadb-galera"
314 && [[ -n "${XTRADB_VER}" && -n "${PERCONA_VER}" ]] 318 && ( -n "${XTRADB_VER}" ) && ( -n "${PERCONA_VER}" ) ]]
315 return $? 319 return $?
316} 320}
317
318 321
319if pbxt_patch_available; then 322if pbxt_patch_available; then
320 323
321 PBXT_P="pbxt-${PBXT_VERSION}" 324 PBXT_P="pbxt-${PBXT_VERSION}"
322 PBXT_SRC_URI="http://www.primebase.org/download/${PBXT_P}.tar.gz mirror://sourceforge/pbxt/${PBXT_P}.tar.gz" 325 PBXT_SRC_URI="http://www.primebase.org/download/${PBXT_P}.tar.gz mirror://sourceforge/pbxt/${PBXT_P}.tar.gz"
323 SRC_URI="${SRC_URI} pbxt? ( ${PBXT_SRC_URI} )" 326 SRC_URI="${SRC_URI} pbxt? ( ${PBXT_SRC_URI} )"
324
325fi 327fi
326 328
327# PBXT_NEWSTYLE means pbxt is in storage/ and gets enabled as other plugins 329# PBXT_NEWSTYLE means pbxt is in storage/ and gets enabled as other plugins
328# vs. built outside the dir 330# vs. built outside the dir
329if pbxt_available; then 331if pbxt_available; then
391 fi 393 fi
392 fi 394 fi
393 fi 395 fi
394 396
395 # Check for USE flag problems in pkg_setup 397 # Check for USE flag problems in pkg_setup
396 if ! mysql_version_is_at_least "5.2" \ 398 if ! mysql_version_is_at_least "5.2" && use debug ; then
397 && use debug ; then
398 # Also in package.use.mask 399 # Also in package.use.mask
399 die "Bug #344885: Upstream has broken USE=debug for 5.1 series >=5.1.51" 400 die "Bug #344885: Upstream has broken USE=debug for 5.1 series >=5.1.51"
400 fi 401 fi
401 402
402 # This should come after all of the die statements 403 # This should come after all of the die statements
494 && dodoc "${script}" 495 && dodoc "${script}"
495 done 496 done
496 497
497 docinto "scripts" 498 docinto "scripts"
498 for script in scripts/mysql* ; do 499 for script in scripts/mysql* ; do
499 [[ -f "${script}" ]] \ 500 if [[ -f "${script}" && "${script%.sh}" == "${script}" ]]; then
500 && [[ "${script%.sh}" == "${script}" ]] \
501 && dodoc "${script}" 501 dodoc "${script}"
502 fi
502 done 503 done
503 504
504 if [ ${PN} == "mariadb" ] \ 505 if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] \
505 && mysql_version_is_at_least "5.2.10" && use pam ; then 506 && mysql_version_is_at_least "5.2.10" && use pam ; then
506 einfo 507 einfo
507 elog "This install includes the PAM authentication plugin." 508 elog "This install includes the PAM authentication plugin."
508 elog "To activate and configure the PAM plugin, please read:" 509 elog "To activate and configure the PAM plugin, please read:"
509 elog "https://kb.askmonty.org/en/pam-authentication-plugin/" 510 elog "https://kb.askmonty.org/en/pam-authentication-plugin/"
510 einfo 511 einfo
534 elog " name char(64) binary DEFAULT '' NOT NULL," 535 elog " name char(64) binary DEFAULT '' NOT NULL,"
535 elog " dl char(128) DEFAULT '' NOT NULL," 536 elog " dl char(128) DEFAULT '' NOT NULL,"
536 elog " PRIMARY KEY (name)" 537 elog " PRIMARY KEY (name)"
537 elog " ) CHARACTER SET utf8 COLLATE utf8_bin;" 538 elog " ) CHARACTER SET utf8 COLLATE utf8_bin;"
538 fi 539 fi
539
540 mysql_check_version_range "4.0 to 5.0.99.99" \
541 && use berkdb \
542 && elog "Berkeley DB support is deprecated and will be removed in future versions!"
543} 540}
544 541
545# @FUNCTION: mysql-v2_getopt 542# @FUNCTION: mysql-v2_getopt
546# @DESCRIPTION: 543# @DESCRIPTION:
547# Use my_print_defaults to extract specific config options 544# Use my_print_defaults to extract specific config options
585 local MY_DATADIR_s="${ROOT}/${MY_DATADIR}" 582 local MY_DATADIR_s="${ROOT}/${MY_DATADIR}"
586 MY_DATADIR_s="${MY_DATADIR_s%%/}" 583 MY_DATADIR_s="${MY_DATADIR_s%%/}"
587 local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}" 584 local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}"
588 old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}" 585 old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
589 586
590 if [[ -d "${old_MY_DATADIR_s}" ]] && [[ "${old_MY_DATADIR_s}" != / ]]; then 587 if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then
591 if [[ -d "${MY_DATADIR_s}" ]]; then 588 if [[ -d "${MY_DATADIR_s}" ]]; then
592 ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist" 589 ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
593 ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}" 590 ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
594 else 591 else
595 elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}" 592 elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
668 local help_tables="${ROOT}${MY_SHAREDSTATEDIR}/fill_help_tables.sql" 665 local help_tables="${ROOT}${MY_SHAREDSTATEDIR}/fill_help_tables.sql"
669 [[ -r "${help_tables}" ]] \ 666 [[ -r "${help_tables}" ]] \
670 && cp "${help_tables}" "${TMPDIR}/fill_help_tables.sql" \ 667 && cp "${help_tables}" "${TMPDIR}/fill_help_tables.sql" \
671 || touch "${TMPDIR}/fill_help_tables.sql" 668 || touch "${TMPDIR}/fill_help_tables.sql"
672 help_tables="${TMPDIR}/fill_help_tables.sql" 669 help_tables="${TMPDIR}/fill_help_tables.sql"
673 670
674 # Figure out which options we need to disable to do the setup 671 # Figure out which options we need to disable to do the setup
675 helpfile="${TMPDIR}/mysqld-help" 672 helpfile="${TMPDIR}/mysqld-help"
676 ${EROOT}/usr/sbin/mysqld --verbose --help >"${helpfile}" 2>/dev/null 673 ${EROOT}/usr/sbin/mysqld --verbose --help >"${helpfile}" 2>/dev/null
677 for opt in grant-tables host-cache name-resolve networking slave-start bdb \ 674 for opt in grant-tables host-cache name-resolve networking slave-start \
678 federated innodb ssl log-bin relay-log slow-query-log external-locking \ 675 federated innodb ssl log-bin relay-log slow-query-log external-locking \
679 ndbcluster log-slave-updates \ 676 ndbcluster log-slave-updates \
680 ; do 677 ; do
681 optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" 678 optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
682 egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}" 679 egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
688 use prefix || options="${options} --user=mysql" 685 use prefix || options="${options} --user=mysql"
689 686
690 pushd "${TMPDIR}" &>/dev/null 687 pushd "${TMPDIR}" &>/dev/null
691 #cmd="'${EROOT}/usr/share/mysql/scripts/mysql_install_db' '--basedir=${EPREFIX}/usr' ${options}" 688 #cmd="'${EROOT}/usr/share/mysql/scripts/mysql_install_db' '--basedir=${EPREFIX}/usr' ${options}"
692 cmd=${EROOT}usr/share/mysql/scripts/mysql_install_db 689 cmd=${EROOT}usr/share/mysql/scripts/mysql_install_db
693 [ -f ${cmd} ] || cmd=${EROOT}usr/bin/mysql_install_db 690 [[ -f ${cmd} ]] || cmd=${EROOT}usr/bin/mysql_install_db
694 cmd="'$cmd' '--basedir=${EPREFIX}/usr' ${options}" 691 cmd="'$cmd' '--basedir=${EPREFIX}/usr' ${options}"
695 einfo "Command: $cmd" 692 einfo "Command: $cmd"
696 eval $cmd \ 693 eval $cmd \
697 >"${TMPDIR}"/mysql_install_db.log 2>&1 694 >"${TMPDIR}"/mysql_install_db.log 2>&1
698 if [ $? -ne 0 ]; then 695 if [ $? -ne 0 ]; then
713 cat "${help_tables}" >> "${sqltmp}" 710 cat "${help_tables}" >> "${sqltmp}"
714 fi 711 fi
715 712
716 einfo "Creating the mysql database and setting proper" 713 einfo "Creating the mysql database and setting proper"
717 einfo "permissions on it ..." 714 einfo "permissions on it ..."
715
716 # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
717 PID_DIR="${EROOT}/var/run/mysqld"
718 if [[ ! -d "${PID_DIR}" ]]; then
719 mkdir "${PID_DIR}"
720 chown mysql:mysql "${PID_DIR}"
721 chmod 755 "${PID_DIR}"
722 fi
718 723
719 local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock" 724 local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock"
720 local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid" 725 local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid"
721 local mysqld="${EROOT}/usr/sbin/mysqld \ 726 local mysqld="${EROOT}/usr/sbin/mysqld \
722 ${options} \ 727 ${options} \
761 -uroot \ 766 -uroot \
762 --password="${MYSQL_ROOT_PASSWORD}" \ 767 --password="${MYSQL_ROOT_PASSWORD}" \
763 mysql < "${sqltmp}" 768 mysql < "${sqltmp}"
764 rc=$? 769 rc=$?
765 eend $? 770 eend $?
766 [ $rc -ne 0 ] && ewarn "Failed to load zoneinfo!" 771 [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!"
767 772
768 # Stop the server and cleanup 773 # Stop the server and cleanup
769 einfo "Stopping the server ..." 774 einfo "Stopping the server ..."
770 kill $(< "${pidfile}" ) 775 kill $(< "${pidfile}" )
771 rm -f "${sqltmp}" 776 rm -f "${sqltmp}"

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.25

  ViewVC Help
Powered by ViewVC 1.1.20