[packages/python-mysql-connector] - rel 2; don't return fields as binary incorrectly - https://bugs.mysql.com/bug.php?id=90585; almost
arekm
arekm at pld-linux.org
Mon May 28 08:56:38 CEST 2018
commit 8ac2eab1adad5cff986a2b5ff041d6b100a27327
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Mon May 28 08:56:22 2018 +0200
- rel 2; don't return fields as binary incorrectly - https://bugs.mysql.com/bug.php?id=90585; almost working test suite
binary-bug-90585.patch | 20 ++++++++++++++++++++
python-mysql-connector.spec | 45 ++++++++++++++++++++++++++++++++++++++++-----
tests.patch | 28 ++++++++++++++++++++++++++++
3 files changed, 88 insertions(+), 5 deletions(-)
---
diff --git a/python-mysql-connector.spec b/python-mysql-connector.spec
index e5a83b0..3f3e880 100644
--- a/python-mysql-connector.spec
+++ b/python-mysql-connector.spec
@@ -2,7 +2,8 @@
# - c extension build is done in install phase (http://bugs.mysql.com/bug.php?id=78621)
#
# Conditional build:
-%bcond_with tests # build with tests (requires mysql server)
+%bcond_with tests # build with tests (requires mysql server)
+%bcond_without python2 # build without python2
%bcond_without python3 # build without python3
%define pname mysql-connector
@@ -11,20 +12,30 @@ Name: python-%{pname}
# check documentation to see which version is GA (we don't want devel releases)
# https://dev.mysql.com/downloads/connector/python/
Version: 8.0.11
-Release: 1
+Release: 2
License: GPL v2
Group: Libraries/Python
Source0: http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-%{version}.zip
# Source0-md5: d47704b39d794b287d146c3d772ab896
Patch0: 32bit.patch
+Patch1: binary-bug-90585.patch
+Patch2: tests.patch
URL: http://dev.mysql.com/doc/connector-python/en/
BuildRequires: mysql-devel
BuildRequires: protobuf-devel
+%if %{with python2}
BuildRequires: python-devel
BuildRequires: python-modules
-%{?with_python3:BuildRequires: python3-modules}
+%endif
+%if %{with python3}
+BuildRequires: python3-devel
+BuildRequires: python3-modules
+%endif
BuildRequires: rpm-pythonprov
BuildRequires: rpmbuild(macros) >= 1.710
+%if %{with tests}
+BuildRequires: mysql
+%endif
Requires: python-modules
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -48,18 +59,38 @@ driver. An interface to the popular MySQL database server for Python.
%prep
%setup -q -n mysql-connector-python-%{version}
%patch0 -p1
+%patch1 -p1
+%patch2 -p1
%build
export MYSQLXPB_PROTOC=%{_bindir}/protoc
export MYSQLXPB_PROTOBUF_INCLUDE_DIR=%{_includedir}
export MYSQLXPB_PROTOBUF_LIB_DIR=%{_libdir}
+%if %{with python2}
%py_build
-%{?with_tests:%{__python} setup.py test}
+%if %{with tests}
+export PYTHONPATH="$(pwd)/$(ls -1d build-2/lib*)"
+%{__python} unittests.py \
+ --verbosity 1 \
+ --keep --stats \
+ --skip-install \
+ --with-mysql=%{_prefix} \
+ --with-mysql-share=%{_datadir}/mysql
+%endif
+%endif
%if %{with python3}
%py3_build
-%{?with_tests:%{__python3} setup.py test}
+%if %{with tests}
+export PYTHONPATH="$(pwd)/$(ls -1d build-3/lib*)"
+%{__python3} unittests.py \
+ --verbosity 1 \
+ --keep --stats \
+ --skip-install \
+ --with-mysql=%{_prefix} \
+ --with-mysql-share=%{_datadir}/mysql
+%endif
%endif
%install
@@ -70,9 +101,11 @@ export MYSQLXPB_PROTOC=%{_bindir}/protoc
export MYSQLXPB_PROTOBUF_INCLUDE_DIR=%{_includedir}
export MYSQLXPB_PROTOBUF_LIB_DIR=%{_libdir}
+%if %{with python2}
%py_install \
--with-mysql-capi=%{_prefix}
%py_postclean
+%endif
%if %{with python3}
%py3_install \
@@ -82,6 +115,7 @@ export MYSQLXPB_PROTOBUF_LIB_DIR=%{_libdir}
%clean
rm -rf $RPM_BUILD_ROOT
+%if %{with python2}
%files
%defattr(644,root,root,755)
%doc CHANGES.txt README.txt
@@ -109,6 +143,7 @@ rm -rf $RPM_BUILD_ROOT
%if "%{py_ver}" > "2.4"
%{py_sitedir}/mysql_connector_python-*.egg-info
%endif
+%endif
%if %{with python3}
%files -n python3-%{pname}
diff --git a/binary-bug-90585.patch b/binary-bug-90585.patch
new file mode 100644
index 0000000..f6b6ca8
--- /dev/null
+++ b/binary-bug-90585.patch
@@ -0,0 +1,20 @@
+--- mysql-connector-python-8.0.11/src/mysql_capi_conversion.c~ 2018-04-10 14:35:30.000000000 +0200
++++ mysql-connector-python-8.0.11/src/mysql_capi_conversion.c 2018-05-28 08:13:02.693638891 +0200
+@@ -734,7 +734,7 @@ pytomy_decimal(PyObject *obj)
+ @param use_unicode return Unicode
+
+ @return Converted string
+- @retval PyUnicode if not BINARY_FLAG
++ @retval PyUnicode if not binary charset
+ @retval PyBytes Python v3 if not use_unicode
+ @retval PyString Python v2 if not use_unicode
+ @retval NULL Exception
+@@ -756,7 +756,7 @@ mytopy_string(const char *data, const un
+ return NULL;
+ }
+
+- if (!(flags & BINARY_FLAG) && use_unicode && strcmp(charset, "binary") != 0)
++ if (use_unicode && strcmp(charset, "binary") != 0)
+ {
+ return PyUnicode_Decode(data, length, charset, NULL);
+ }
diff --git a/tests.patch b/tests.patch
new file mode 100644
index 0000000..5023b99
--- /dev/null
+++ b/tests.patch
@@ -0,0 +1,28 @@
+--- mysql-connector-python-8.0.11/tests/mysqld.py~ 2018-04-10 14:35:30.000000000 +0200
++++ mysql-connector-python-8.0.11/tests/mysqld.py 2018-05-28 08:25:18.652587431 +0200
+@@ -185,24 +185,7 @@ class MySQLServerBase(object):
+ """
+
+ # Locate mysqld, mysql binaries
+- LOGGER.info("Locating mysql binaries (could take a while)")
+- files_to_find = [EXEC_MYSQL, EXEC_MYSQLD]
+- for root, dirs, files in os.walk(self._basedir):
+- if self._sbindir:
+- break
+- for afile in files:
+- if (afile == EXEC_MYSQLD and
+- os.access(os.path.join(root, afile), 0)):
+- self._sbindir = root
+- files_to_find.remove(EXEC_MYSQLD)
+- elif (afile == EXEC_MYSQL and
+- os.access(os.path.join(root, afile), 0)):
+- self._bindir = root
+- files_to_find.remove(EXEC_MYSQL)
+-
+- if not files_to_find:
+- break
+-
++ self._sbindir = '/usr/sbin'
+
+ if not self._sbindir:
+ raise MySQLBootstrapError(
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/python-mysql-connector.git/commitdiff/8ac2eab1adad5cff986a2b5ff041d6b100a27327
More information about the pld-cvs-commit
mailing list