commit:     0daa60575ea81e0c514806b3c37c6610a3e4defa
Author:     Brian Evans <grknight <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 24 17:18:13 2018 +0000
Commit:     Brian Evans <grknight <AT> gentoo <DOT> org>
CommitDate: Mon Sep 24 17:18:13 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0daa6057

dev-db/mysql: Restore pkg_config options confused from 5.7

5.6.40-r2 and 5.6.41 were back copied from 5.7
Unfortunately pkg_config was not checked and failures occured trying to run it

The relevant parts are restored here

Bug: https://bugs.gentoo.org/666992
Signed-off-by: Brian Evans <grknight <AT> gentoo.org>
Package-Manager: Portage-2.3.50, Repoman-2.3.10

 dev-db/mysql/mysql-5.6.40-r2.ebuild | 32 ++++++++++++++++++++++++++------
 dev-db/mysql/mysql-5.6.41.ebuild    | 32 ++++++++++++++++++++++++++------
 2 files changed, 52 insertions(+), 12 deletions(-)

diff --git a/dev-db/mysql/mysql-5.6.40-r2.ebuild 
b/dev-db/mysql/mysql-5.6.40-r2.ebuild
index b81a2ec567e..0c029e84c7a 100644
--- a/dev-db/mysql/mysql-5.6.40-r2.ebuild
+++ b/dev-db/mysql/mysql-5.6.40-r2.ebuild
@@ -131,8 +131,8 @@ pkg_preinst() {
        # Here we need to see if the implementation switched client libraries
        # We check if this is a new instance of the package and a client 
library already exists
        local SHOW_ABI_MESSAGE libpath
-       if use client-libs && [[ -z ${REPLACING_VERSIONS} && -e 
"${EROOT}usr/$(get_libdir)/libmysqlclient.so" ]] ; then
-               libpath=$(readlink 
"${EROOT}usr/$(get_libdir)/libmysqlclient.so")
+       if use client-libs && [[ -z ${REPLACING_VERSIONS} && -e 
"${EROOT%/}/usr/$(get_libdir)/libmysqlclient.so" ]] ; then
+               libpath=$(readlink 
"${EROOT%/}/usr/$(get_libdir)/libmysqlclient.so")
                elog "Due to ABI changes when switching between different 
client libraries,"
                elog "revdep-rebuild must find and rebuild all packages linking 
to libmysqlclient."
                elog "Please run: revdep-rebuild --library ${libpath}"
@@ -672,6 +672,12 @@ pkg_config() {
        # see http://bugs.mysql.com/bug.php?id=31312
        use prefix && options="${options} 
'--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
 
+       local help_tables="${EROOT%/}${MY_SHAREDSTATEDIR}/fill_help_tables.sql"
+       [[ -r "${help_tables}" ]] \
+       && cp "${help_tables}" "${TMPDIR}/fill_help_tables.sql" \
+       || touch "${TMPDIR}/fill_help_tables.sql"
+       help_tables="${TMPDIR}/fill_help_tables.sql"
+
        # Figure out which options we need to disable to do the setup
        local helpfile="${TMPDIR%/}/mysqld-help"
        "${EROOT%/}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
@@ -699,13 +705,14 @@ pkg_config() {
 
        # Filling timezones, see
        # http://dev.mysql.com/doc/mysql/en/time-zone-support.html
-       echo "USE mysql;" >"${sqltmp}"
        "${EROOT%/}/usr/bin/mysql_tzinfo_to_sql" 
"${EROOT%/}/usr/share/zoneinfo" >> "${sqltmp}" 2>/dev/null
        chown mysql "${sqltmp}" || die
 
-       # --initialize-insecure will not set root password
-       # --initialize would set a random one in the log which we don't need as 
we set it ourselves
-       local cmd=( "${EROOT%/}/usr/sbin/mysqld" "--initialize-insecure" 
"--init-file='${sqltmp}'" )
+       local cmd=( "${EROOT%/}/usr/share/mysql/scripts/mysql_install_db" )
+       [[ -f "${cmd}" ]] || cmd=( "${EROOT%/}/usr/bin/mysql_install_db" )
+       if [[ -r "${help_tables}" ]] ; then
+               cat "${help_tables}" >> "${sqltmp}"
+       fi
        cmd+=( "--basedir=${EPREFIX%/}/usr" ${options} 
"--datadir=${ROOT%/}${MY_DATADIR}" "--tmpdir=${ROOT%/}${MYSQL_TMPDIR}" )
        einfo "Command: ${cmd[*]}"
        su -s /bin/sh -c "${cmd[*]}" mysql \
@@ -759,6 +766,19 @@ pkg_config() {
                -e "${sql}"
        eend $?
 
+       if [[ -n "${sqltmp}" ]] ; then
+               ebegin "Loading \"zoneinfo\", this step may require a few 
seconds"
+               "${EROOT%/}/usr/bin/mysql" \
+                       --socket="${socket}" \
+                       -hlocalhost \
+                       -uroot \
+                       --password="${MYSQL_ROOT_PASSWORD}" \
+                       mysql < "${sqltmp}"
+               rc=$?
+               eend $?
+               [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!"
+       fi
+
        # Stop the server and cleanup
        einfo "Stopping the server ..."
        kill $(< "${pidfile}" )

diff --git a/dev-db/mysql/mysql-5.6.41.ebuild b/dev-db/mysql/mysql-5.6.41.ebuild
index 7ec34a50aad..da6e2f0d67a 100644
--- a/dev-db/mysql/mysql-5.6.41.ebuild
+++ b/dev-db/mysql/mysql-5.6.41.ebuild
@@ -131,8 +131,8 @@ pkg_preinst() {
        # Here we need to see if the implementation switched client libraries
        # We check if this is a new instance of the package and a client 
library already exists
        local SHOW_ABI_MESSAGE libpath
-       if use client-libs && [[ -z ${REPLACING_VERSIONS} && -e 
"${EROOT}usr/$(get_libdir)/libmysqlclient.so" ]] ; then
-               libpath=$(readlink 
"${EROOT}usr/$(get_libdir)/libmysqlclient.so")
+       if use client-libs && [[ -z ${REPLACING_VERSIONS} && -e 
"${EROOT%/}/usr/$(get_libdir)/libmysqlclient.so" ]] ; then
+               libpath=$(readlink 
"${EROOT%/}/usr/$(get_libdir)/libmysqlclient.so")
                elog "Due to ABI changes when switching between different 
client libraries,"
                elog "revdep-rebuild must find and rebuild all packages linking 
to libmysqlclient."
                elog "Please run: revdep-rebuild --library ${libpath}"
@@ -672,6 +672,12 @@ pkg_config() {
        # see http://bugs.mysql.com/bug.php?id=31312
        use prefix && options="${options} 
'--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
 
+       local help_tables="${EROOT%/}${MY_SHAREDSTATEDIR}/fill_help_tables.sql"
+       [[ -r "${help_tables}" ]] \
+       && cp "${help_tables}" "${TMPDIR}/fill_help_tables.sql" \
+       || touch "${TMPDIR}/fill_help_tables.sql"
+       help_tables="${TMPDIR}/fill_help_tables.sql"
+
        # Figure out which options we need to disable to do the setup
        local helpfile="${TMPDIR%/}/mysqld-help"
        "${EROOT%/}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
@@ -699,13 +705,14 @@ pkg_config() {
 
        # Filling timezones, see
        # http://dev.mysql.com/doc/mysql/en/time-zone-support.html
-       echo "USE mysql;" >"${sqltmp}"
        "${EROOT%/}/usr/bin/mysql_tzinfo_to_sql" 
"${EROOT%/}/usr/share/zoneinfo" >> "${sqltmp}" 2>/dev/null
        chown mysql "${sqltmp}" || die
 
-       # --initialize-insecure will not set root password
-       # --initialize would set a random one in the log which we don't need as 
we set it ourselves
-       local cmd=( "${EROOT%/}/usr/sbin/mysqld" "--initialize-insecure" 
"--init-file='${sqltmp}'" )
+       local cmd=( "${EROOT%/}/usr/share/mysql/scripts/mysql_install_db" )
+       [[ -f "${cmd}" ]] || cmd=( "${EROOT%/}/usr/bin/mysql_install_db" )
+       if [[ -r "${help_tables}" ]] ; then
+               cat "${help_tables}" >> "${sqltmp}"
+       fi
        cmd+=( "--basedir=${EPREFIX%/}/usr" ${options} 
"--datadir=${ROOT%/}${MY_DATADIR}" "--tmpdir=${ROOT%/}${MYSQL_TMPDIR}" )
        einfo "Command: ${cmd[*]}"
        su -s /bin/sh -c "${cmd[*]}" mysql \
@@ -759,6 +766,19 @@ pkg_config() {
                -e "${sql}"
        eend $?
 
+       if [[ -n "${sqltmp}" ]] ; then
+               ebegin "Loading \"zoneinfo\", this step may require a few 
seconds"
+               "${EROOT%/}/usr/bin/mysql" \
+                       --socket="${socket}" \
+                       -hlocalhost \
+                       -uroot \
+                       --password="${MYSQL_ROOT_PASSWORD}" \
+                       mysql < "${sqltmp}"
+               rc=$?
+               eend $?
+               [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!"
+       fi
+
        # Stop the server and cleanup
        einfo "Stopping the server ..."
        kill $(< "${pidfile}" )

Reply via email to