Gentoo Archives: gentoo-commits

From: Brian Evans <grknight@×××××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/mysql:master commit in: eclass/
Date: Wed, 30 Apr 2014 20:39:24
Message-Id: 1398890339.a6fc813816f0115c3911dce9db9d6ed66acaedac.grknight.pub@gentoo
commit:     a6fc813816f0115c3911dce9db9d6ed66acaedac
Author:     Brian Evans <grknight <AT> tuffmail <DOT> com>
AuthorDate: Wed Apr 30 20:38:59 2014 +0000
Commit:     Brian Evans <grknight <AT> lavabit <DOT> com>
CommitDate: Wed Apr 30 20:38:59 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/mysql.git;a=commit;h=a6fc8138

[eclass] Fix pkg_config for mysql 5.6+ (needs InnoDB)

Signed-off-by: Brian Evans <grknight <AT> tuffmail.com>

---
 eclass/mysql-multilib.eclass | 29 +++++++++++++++++------------
 eclass/mysql-v2.eclass       | 31 ++++++++++++++++++-------------
 2 files changed, 35 insertions(+), 25 deletions(-)

diff --git a/eclass/mysql-multilib.eclass b/eclass/mysql-multilib.eclass
index 28df036..d89e15a 100644
--- a/eclass/mysql-multilib.eclass
+++ b/eclass/mysql-multilib.eclass
@@ -747,7 +747,7 @@ mysql-multilib_pkg_config() {
 	helpfile="${TMPDIR}/mysqld-help"
 	${EROOT}/usr/sbin/mysqld --verbose --help >"${helpfile}" 2>/dev/null
 	for opt in grant-tables host-cache name-resolve networking slave-start \
-		federated innodb ssl log-bin relay-log slow-query-log external-locking \
+		federated ssl log-bin relay-log slow-query-log external-locking \
 		ndbcluster log-slave-updates \
 		; do
 		optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
@@ -763,6 +763,22 @@ mysql-multilib_pkg_config() {
 	use prefix && [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] \
 		&& options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
 
+	# MySQL 5.6+ needs InnoDB
+	if [[ ${PN} == "mysql" || ${PN} == "percona-server" ]] ; then
+		mysql_version_is_at_least "5.6" || options="${options} --loose-skip-innodb"
+	fi
+
+	einfo "Creating the mysql database and setting proper"
+	einfo "permissions on it ..."
+
+	# Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
+	PID_DIR="${EROOT}/var/run/mysqld"
+	if [[ ! -d "${PID_DIR}" ]]; then
+		mkdir -p "${PID_DIR}"
+		chown mysql:mysql "${PID_DIR}"
+		chmod 755 "${PID_DIR}"
+	fi
+
 	pushd "${TMPDIR}" &>/dev/null
 	#cmd="'${EROOT}/usr/share/mysql/scripts/mysql_install_db' '--basedir=${EPREFIX}/usr' ${options}"
 	cmd=${EROOT}usr/share/mysql/scripts/mysql_install_db
@@ -789,17 +805,6 @@ mysql-multilib_pkg_config() {
 		cat "${help_tables}" >> "${sqltmp}"
 	fi
 
-	einfo "Creating the mysql database and setting proper"
-	einfo "permissions on it ..."
-
-	# Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
-	PID_DIR="${EROOT}/var/run/mysqld"
-	if [[ ! -d "${PID_DIR}" ]]; then
-		mkdir "${PID_DIR}"
-		chown mysql:mysql "${PID_DIR}"
-		chmod 755 "${PID_DIR}"
-	fi
-
 	local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock"
 	local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid"
 	local mysqld="${EROOT}/usr/sbin/mysqld \

diff --git a/eclass/mysql-v2.eclass b/eclass/mysql-v2.eclass
index 15faf6c..5a7a6f7 100644
--- a/eclass/mysql-v2.eclass
+++ b/eclass/mysql-v2.eclass
@@ -764,7 +764,7 @@ mysql-v2_pkg_config() {
 	helpfile="${TMPDIR}/mysqld-help"
 	${EROOT}/usr/sbin/mysqld --verbose --help >"${helpfile}" 2>/dev/null
 	for opt in grant-tables host-cache name-resolve networking slave-start \
-		federated innodb ssl log-bin relay-log slow-query-log external-locking \
+		federated ssl log-bin relay-log slow-query-log external-locking \
 		ndbcluster log-slave-updates \
 		; do
 		optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
@@ -780,11 +780,27 @@ mysql-v2_pkg_config() {
 	use prefix && [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] \
 		&& options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
 
+	# MySQL 5.6+ needs InnoDB
+	if [[ ${PN} == "mysql" || ${PN} == "percona-server" ]] ; then
+		mysql_version_is_at_least "5.6" || options="${options} --loose-skip-innodb"
+	fi
+
+	einfo "Creating the mysql database and setting proper"
+	einfo "permissions on it ..."
+
+	# Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
+	PID_DIR="${EROOT}/var/run/mysqld"
+	if [[ ! -d "${PID_DIR}" ]]; then
+		mkdir -p "${PID_DIR}"
+		chown mysql:mysql "${PID_DIR}"
+		chmod 755 "${PID_DIR}"
+	fi
+
 	pushd "${TMPDIR}" &>/dev/null
 	#cmd="'${EROOT}/usr/share/mysql/scripts/mysql_install_db' '--basedir=${EPREFIX}/usr' ${options}"
 	cmd=${EROOT}usr/share/mysql/scripts/mysql_install_db
 	[[ -f ${cmd} ]] || cmd=${EROOT}usr/bin/mysql_install_db
-	cmd="'$cmd' '--basedir=${EPREFIX}/usr' ${options}"
+	cmd="'$cmd' '--basedir=${EPREFIX}/usr' ${options} '--datadir=${EROOT}/${MY_DATADIR}'"
 	einfo "Command: $cmd"
 	eval $cmd \
 		>"${TMPDIR}"/mysql_install_db.log 2>&1
@@ -806,17 +822,6 @@ mysql-v2_pkg_config() {
 		cat "${help_tables}" >> "${sqltmp}"
 	fi
 
-	einfo "Creating the mysql database and setting proper"
-	einfo "permissions on it ..."
-
-	# Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
-	PID_DIR="${EROOT}/var/run/mysqld"
-	if [[ ! -d "${PID_DIR}" ]]; then
-		mkdir "${PID_DIR}"
-		chown mysql:mysql "${PID_DIR}"
-		chmod 755 "${PID_DIR}"
-	fi
-
 	local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock"
 	local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid"
 	local mysqld="${EROOT}/usr/sbin/mysqld \