Source: libdbi-drivers Version: 0.9.0-9 Tags: patch Usertags: origin-ubuntu ubuntu-patch
Hi there, I would like to propose a patch to implement support for using MySQL when running the test_mysql.sh script. Even though Debian uses MariaDB as its default database, we still ship MySQL and some users might prefer it. The Ubuntu libdbi-drivers package carries a similar version of this patch, but with the opposite problem: because Ubuntu's default database is MySQL, the patch doesn't support MariaDB. I am working towards having a single version of the patch which can work with both databases. This patch does not change the current behaviour of the script: it still works normally with MariaDB. I also tested building libdbi-drivers using MySQL, and the package now builds fine (it was failing before). I'm providing a debdiff attached to this message, without a changelog entry. Thanks a lot for considering this! -- Sergio GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36 Please send encrypted e-mail if possible https://sergiodj.net/
diff -Nru libdbi-drivers-0.9.0/debian/patches/fix-mysql-test.patch libdbi-drivers-0.9.0/debian/patches/fix-mysql-test.patch --- libdbi-drivers-0.9.0/debian/patches/fix-mysql-test.patch 1969-12-31 19:00:00.000000000 -0500 +++ libdbi-drivers-0.9.0/debian/patches/fix-mysql-test.patch 2020-05-15 15:37:26.000000000 -0400 @@ -0,0 +1,56 @@ +Description: Fix build errors with MySQL 8.0 + The mysql_install_db script has been removed, and replaced with + the --initialize options for mysqld. + Also add -uroot to mysqladmin calls so package can be built without + root. +Author: Lars Tangvald <lars.tangv...@oracle.com> +Forwarded: no +Last-Update: 2019-07-16 + +Index: libdbi-drivers-0.9.0/tests/test_mysql.sh +=================================================================== +--- libdbi-drivers-0.9.0.orig/tests/test_mysql.sh 2020-05-22 00:06:19.128004409 -0400 ++++ libdbi-drivers-0.9.0/tests/test_mysql.sh 2020-05-22 00:07:58.055128289 -0400 +@@ -36,8 +36,23 @@ + B=`basename "$MYTMPDIR"` + ABSMYTMPDIR="`cd \"$D\" 2>/dev/null && pwd || echo \"$D\"`/$B" + +-# --force is needed because buildd's can't resolve their own hostnames to ips +-mysql_install_db --no-defaults --datadir=${ABSMYTMPDIR} --force --skip-name-resolve --user=${ME} ++if $MYMYSQLD --help 2>&1 | grep -q MariaDB 2>&1 > /dev/null; then ++ is_mariadb=yes ++else ++ is_mariadb=no ++fi ++ ++if [ $is_mariadb = "yes" ]; then ++ # --force is needed because buildd's can't resolve their own hostnames to ips ++ mysql_install_db --no-defaults --datadir=${ABSMYTMPDIR} --force --skip-name-resolve --user=${ME} ++ $MYMYSQLD --no-defaults --skip-grant --user=${ME} --socket=${ABSMYTMPDIR}/mysql.sock --datadir=${ABSMYTMPDIR} --skip-networking & ++else ++ $MYMYSQLD --no-defaults --initialize-insecure --user=${ME} --datadir=${ABSMYTMPDIR} ++ $MYMYSQLD --no-defaults --skip-grant --user=${ME} --socket=${ABSMYTMPDIR}/mysql.sock --datadir=${ABSMYTMPDIR} --skip-networking & ++fi ++ ++ ++$MYMYSQLD --no-defaults --initialize-insecure --user=${ME} --datadir=${ABSMYTMPDIR} + $MYMYSQLD --no-defaults --skip-grant --user=${ME} --socket=${ABSMYTMPDIR}/mysql.sock --datadir=${ABSMYTMPDIR} --skip-networking & + + # mysqld needs some time to come up to speed. This avoids irritating error messages from the subsequent loop +@@ -49,7 +64,7 @@ + + echo -n pinging mysqld. + attempts=0 +-while ! mysqladmin --socket=${ABSMYTMPDIR}/mysql.sock ping ; do ++while ! mysqladmin -uroot --socket=${ABSMYTMPDIR}/mysql.sock ping ; do + sleep 3 + attempts=$((attempts+1)) + if [ ${attempts} -gt 10 ] ; then +@@ -71,6 +86,6 @@ + + ecode=$? + +-mysqladmin --socket=${ABSMYTMPDIR}/mysql.sock shutdown ++mysqladmin -uroot --socket=${ABSMYTMPDIR}/mysql.sock shutdown + rm -rf ${ABSMYTMPDIR} + exit ${ecode} diff -Nru libdbi-drivers-0.9.0/debian/patches/series libdbi-drivers-0.9.0/debian/patches/series --- libdbi-drivers-0.9.0/debian/patches/series 2020-02-28 12:08:27.000000000 -0500 +++ libdbi-drivers-0.9.0/debian/patches/series 2020-05-15 15:37:26.000000000 -0400 @@ -8,3 +8,4 @@ pgsql_precision.patch test_exception_failure.patch test_mariadb_date_tz.patch +fix-mysql-test.patch diff -Nru libdbi-drivers-0.9.0/debian/test_mysql.sh libdbi-drivers-0.9.0/debian/test_mysql.sh --- libdbi-drivers-0.9.0/debian/test_mysql.sh 2020-02-08 03:47:26.000000000 -0500 +++ libdbi-drivers-0.9.0/debian/test_mysql.sh 2020-05-15 15:37:26.000000000 -0400 @@ -26,9 +26,21 @@ MYTEMP_DIR=`mktemp -d` ME=`whoami` -# --force is needed because buildd's can't resolve their own hostnames to ips -mysql_install_db --no-defaults --datadir=${MYTEMP_DIR} --force --skip-name-resolve --user=${ME} -/usr/sbin/mysqld --no-defaults --skip-grant --user=${ME} --socket=${MYTEMP_DIR}/mysql.sock --datadir=${MYTEMP_DIR} --skip-networking & +# Check if we're running under MariaDB or MySQL. +if /usr/bin/mysqladmin 2>&1 | grep -q MariaDB 2>&1 > /dev/null; then + is_mariadb=yes +else + is_mariadb=no +fi + +if [ "$is_mariadb" = "yes" ]; then + # --force is needed because buildd's can't resolve their own hostnames to ips + mysql_install_db --no-defaults --datadir=${MYTEMP_DIR} --force --skip-name-resolve --user=${ME} + /usr/sbin/mysqld --no-defaults --skip-grant --user=${ME} --socket=${MYTEMP_DIR}/mysql.sock --datadir=${MYTEMP_DIR} --skip-networking & +else + /usr/sbin/mysqld --no-defaults --initialize-insecure --user=${ME} --datadir=${MYTEMP_DIR} + /usr/sbin/mysqld --no-defaults --user=${ME} --socket=${MYTEMP_DIR}/mysql.sock --datadir=${MYTEMP_DIR} --skip-networking & +fi # This sets the path of the MySQL socket for any libmysql-client users, which includes # the ./tests/test_dbi client @@ -36,7 +48,7 @@ echo -n pinging mysqld. attempts=0 -while ! /usr/bin/mysqladmin --socket=${MYTEMP_DIR}/mysql.sock ping ; do +while ! /usr/bin/mysqladmin -uroot --socket=${MYTEMP_DIR}/mysql.sock ping ; do sleep 3 attempts=$((attempts+1)) if [ ${attempts} -gt 10 ] ; then @@ -57,6 +69,6 @@ ecode=$? -/usr/bin/mysqladmin --socket=${MYTEMP_DIR}/mysql.sock shutdown +/usr/bin/mysqladmin -uroot --socket=${MYTEMP_DIR}/mysql.sock shutdown rm -rf ${MYTEMP_DIR} exit ${ecode}
signature.asc
Description: PGP signature