Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-auth/libnss-mysql/, sys-auth/libnss-mysql/files/
Date: Thu, 26 Mar 2020 21:34:01
Message-Id: 1585258424.8515ca38ffc7da23296958f80ed6f0cef6ad86fb.whissi@gentoo
commit:     8515ca38ffc7da23296958f80ed6f0cef6ad86fb
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 26 21:32:40 2020 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Thu Mar 26 21:33:44 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8515ca38

sys-auth/libnss-mysql: fix building against MariaDB 10.2+ and MySQL 8

Closes: https://github.com/gentoo/gentoo/pull/15083
Closes: https://bugs.gentoo.org/693392
Package-Manager: Portage-2.3.96, Repoman-2.3.22
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 .../libnss-mysql-1.5_p20060915-mariadb10.2.patch   | 35 ++++++++++++
 .../libnss-mysql-1.5_p20060915-multiarch.patch     | 21 ++++++++
 .../libnss-mysql-1.5_p20060915-r5.ebuild           | 62 ++++++++++++++++++++++
 3 files changed, 118 insertions(+)

diff --git a/sys-auth/libnss-mysql/files/libnss-mysql-1.5_p20060915-mariadb10.2.patch b/sys-auth/libnss-mysql/files/libnss-mysql-1.5_p20060915-mariadb10.2.patch
new file mode 100644
index 00000000000..b669d01c79f
--- /dev/null
+++ b/sys-auth/libnss-mysql/files/libnss-mysql-1.5_p20060915-mariadb10.2.patch
@@ -0,0 +1,35 @@
+--- a/src/mysql.c
++++ b/src/mysql.c
+@@ -196,6 +196,7 @@
+   int retval;
+   sql_server_t *server = &conf.sql.server;
+   unsigned int port;
++  my_bool reconnect = 1;
+ 
+   DENTER
+ 
+@@ -238,8 +239,9 @@
+           DSRETURN (NSS_UNAVAIL)
+         }
+       ci.valid = ntrue;
+-      ci.link.reconnect = 0; /* Safety: We can't let MySQL assume socket is
+-                                still valid; see _nss_mysql_validate_socket */
++      /* Safety: We can't let MySQL assume socket is still valid;
++         see _nss_mysql_validate_socket */
++      mysql_options(&ci.link, MYSQL_OPT_RECONNECT, &reconnect); 
+       DSRETURN (NSS_SUCCESS)
+     }
+   _nss_mysql_log (LOG_ALERT, "Connection to server '%s' failed: %s",
+--- a/src/nss_mysql.h
++++ b/src/nss_mysql.h
+@@ -72,6 +72,10 @@ typedef nss_status_t NSS_STATUS;
+ /* Default initializers */
+ #define DEF_TIMEOUT         3
+
++#if !defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 80001
++#define my_bool bool
++#endif
++
+ #ifdef DEBUG
+ void _nss_mysql_debug (char *fmt, ...);
+ #define DEBUG_FILE "/tmp/libnss-mysql-debug.log"

diff --git a/sys-auth/libnss-mysql/files/libnss-mysql-1.5_p20060915-multiarch.patch b/sys-auth/libnss-mysql/files/libnss-mysql-1.5_p20060915-multiarch.patch
new file mode 100644
index 00000000000..3a85b601b7e
--- /dev/null
+++ b/sys-auth/libnss-mysql/files/libnss-mysql-1.5_p20060915-multiarch.patch
@@ -0,0 +1,21 @@
+--- libnss-mysql-1.5/acinclude.m4
++++ libnss-mysql-1.5.sal/acinclude.m4
+@@ -80,6 +80,18 @@
+     fi
+ done
+ 
++dnl Test also $libdir path
++if test -f "$libdir/libmysqlclient.so"
++then
++    MYSQL_LIB_DIR="$libdir"
++    break
++fi
++if test -f "$libdir/mysql/libmysqlclient.so"
++then
++    MYSQL_LIB_DIR="$libdir/mysql"
++    break
++fi
++
+ if test -n "$MYSQL_LIB_DIR"
+ then
+     AC_MSG_RESULT([$MYSQL_LIB_DIR])

diff --git a/sys-auth/libnss-mysql/libnss-mysql-1.5_p20060915-r5.ebuild b/sys-auth/libnss-mysql/libnss-mysql-1.5_p20060915-r5.ebuild
new file mode 100644
index 00000000000..090feab7685
--- /dev/null
+++ b/sys-auth/libnss-mysql/libnss-mysql-1.5_p20060915-r5.ebuild
@@ -0,0 +1,62 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools
+
+KEYWORDS="amd64 ppc ~sparc x86"
+
+DESCRIPTION="NSS MySQL Library"
+HOMEPAGE="http://libnss-mysql.sourceforge.net/"
+SRC_URI="http://libnss-mysql.sourceforge.net/snapshot/${PN}-${PV/1.5_p/}.tgz"
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="debug"
+
+DEPEND="dev-db/mysql-connector-c:="
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}/${PN}"
+
+DOCS=( AUTHORS DEBUGGING FAQ INSTALL NEWS README THANKS
+	TODO UPGRADING ChangeLog
+)
+
+PATCHES=(
+	"${FILESDIR}"/${P}-no-automagic-debug.diff
+	"${FILESDIR}"/${PN}-1.5_p20060915-multiarch.patch
+	"${FILESDIR}"/${PN}-1.5_p20060915-mariadb10.2.patch
+)
+
+src_prepare() {
+	default
+
+	mv configure.{in,ac} || die
+
+	eautoreconf
+}
+
+src_configure() {
+	# Usually, authentication libraries don't belong into usr.
+	# But here, it's required that the lib is in the same dir
+	# as libmysql, because else failures may occur on boot if
+	# udev tries to access a user / group that doesn't exist
+	# on the system before /usr is mounted.
+	econf --libdir="/usr/$(get_libdir)" \
+		$(use_enable debug)
+}
+
+src_install() {
+	default
+
+	find "${ED}" -name '*.la' -delete || die
+
+	newdoc sample/README README.sample
+
+	local subdir
+	for subdir in sample/{linux,freebsd,complex,minimal} ; do
+		docinto "${subdir}"
+		dodoc "${subdir}/"{*.sql,*.cfg}
+	done
+}