public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/mysql-connector-python] f45: [rebase 2/4] Rewrite spec and update patches for 26.7.0
@ 2026-09-22 12:14 Michal Schorm
0 siblings, 0 replies; only message in thread
From: Michal Schorm @ 2026-09-22 12:14 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/mysql-connector-python
Branch : f45
Commit : edaae9be1e54ad45d20fe21341f5c5d2a7950d7c
Author : Michal Schorm <mschorm@redhat.com>
Date : 2026-09-22T12:15:09+02:00
Stats : +175/-73 in 3 file(s)
URL : https://src.fedoraproject.org/rpms/mysql-connector-python/c/edaae9be1e54ad45d20fe21341f5c5d2a7950d7c?branch=f45
Log:
[rebase 2/4] Rewrite spec and update patches for 26.7.0
Rebase from 8.0.33 to 26.7.0 (CalVer, released 2026-07-10).
Version 26.7.0 is functionally equivalent to the former 9.7.0
numbering — Oracle switched to CalVer (year.month.minor) starting
with the 26.x series.
Release notes: https://dev.mysql.com/doc/relnotes/connector-python/en/
Changelog: https://dev.mysql.com/doc/relnotes/connector-python/en/news-26-7-0.html
Highlights:
- Source split into two sibling packages: 'mysql-connector-python/'
(classic protocol) and 'mysqlx-connector-python/' (X DevAPI).
Both are built and installed from the same SRPM.
- CalVer versioning adopted (26.y.z = year.month.minor)
- Python >= 3.10 required (dropped 3.8 and 3.9)
- Sphinx docs now require 'sphinxcontrib-jquery' explicitly
Spec changes:
- '%pyproject_wheel' / '%pyproject_buildrequires' now take '-d' to
specify subdirectory for each sub-package
- sitelib-to-sitearch consolidation added: '%pyproject_install' may
split pure Python and C extension files across different directories
- 'mysqlx_connector_python' dist-info added to '%files'
- Man page build updated for split source layout (pushd/popd,
'CPY_BUILD_DIR' env var)
- '%autosetup -p1' replaces '%setup' + manual '%patch'
- '%description' de-duplicated via '%{expand:}' macro
Patches:
- Patch0 'rpath.patch': updated for 26.7.0 source tree — removes
'-Wl,-rpath,$ORIGIN/mysql/vendor' from C extension link flags and
tolerates missing auth plugin directories.
- Patch1 'docs-import.patch': new — fixes Sphinx 'conf.py' version
import for the split source layout using 'importlib.util' fallback.
The X DevAPI C extension ('_mysqlxpb') remains disabled in this commit
(with_mysqlxpb=0) and is enabled separately in [rebase 4/4].
Resolves: rhbz#2504358
Resolves: rhbz#2386866
Co-Authored-By: Claude AI <noreply@anthropic.com>
---
diff --git a/mysql-connector-python-docs-import.patch b/mysql-connector-python-docs-import.patch
new file mode 100644
index 0000000..36d4c5f
--- /dev/null
+++ b/mysql-connector-python-docs-import.patch
@@ -0,0 +1,35 @@
+# Fix man page build with split source layout
+#
+# Starting with version 9.0.0, mysql-connector-python ships as two separate
+# packages inside one source tarball: mysql-connector-python/ (classic API)
+# and mysqlx-connector-python/ (X DevAPI). The sphinx conf.py for man page
+# generation lives in mysqlx-connector-python/docs/mysqlx/ and tries to
+# import mysqlx.version, but the standard sys.path manipulation no longer
+# reaches the mysqlx package in the split layout.
+#
+# Use importlib.util to load version.py directly from the path specified
+# by $CPY_BUILD_DIR, falling back to the normal import for flat layouts.
+
+--- a/mysqlx-connector-python/docs/mysqlx/conf.py 2026-07-10 20:39:31.000000000 +0200
++++ b/mysqlx-connector-python/docs/mysqlx/conf.py 2026-09-22 01:31:47.290934750 +0200
+@@ -28,8 +28,18 @@
+ sys.path.insert(0, os.path.join(cpy_dir, "lib"))
+
+ try:
+- from mysqlx.version import VERSION
+-except ImportError:
++ import importlib.util
++ v_path = os.path.join(
++ os.environ.get("CPY_BUILD_DIR", ""), "mysqlx", "version.py"
++ )
++ if os.path.exists(v_path):
++ spec = importlib.util.spec_from_file_location("mysqlx.version", v_path)
++ ver = importlib.util.module_from_spec(spec)
++ spec.loader.exec_module(ver)
++ VERSION = ver.VERSION
++ else:
++ from mysqlx.version import VERSION
++except Exception:
+ print("Unable to obtain $CPY_BUILD_DIR from the environment.")
+ sys.exit(1)
+
diff --git a/mysql-connector-python-rpath.patch b/mysql-connector-python-rpath.patch
index 7f9e0d0..888d481 100644
--- a/mysql-connector-python-rpath.patch
+++ b/mysql-connector-python-rpath.patch
@@ -1,7 +1,81 @@
-diff -Naur mysql-connector-python-8.0.33-src/cpydist/__init__.py mysql-connector-python_patched/cpydist/__init__.py
---- mysql-connector-python-8.0.33-src/cpydist/__init__.py 2023-03-30 12:58:04.000000000 +0200
-+++ mysql-connector-python_patched/cpydist/__init__.py 2025-07-21 09:21:19.084953101 +0200
-@@ -722,9 +722,6 @@
+# Remove RPATH injection and make plugin discovery non-fatal
+#
+# Fedora's rpminspect rejects binaries with RPATH set to $ORIGIN/mysql/vendor.
+# This path is used by upstream's vendored MySQL client library bundling, which
+# Fedora does not use (we link against the system mysql-devel package instead).
+#
+# Additionally, the authentication plugin discovery raises FileNotFoundError
+# when plugin directories are not found. On Fedora, auth plugins ship in the
+# mysql-server package and are not available during build. Downgrade the error
+# to a warning and skip plugin bundling instead of crashing.
+
+--- a/mysql-connector-python/cpydist/__init__.py 2026-07-10 20:39:31.000000000 +0200
++++ b/mysql-connector-python/cpydist/__init__.py 2026-09-22 01:20:35.844356298 +0200
+@@ -290,40 +290,31 @@
+ break
+ plugin_path = ""
+
+- if not len(plugin_path):
+- searched_paths = ",".join(["/".join(p) for p in expected_plugin_paths])
+- self.log.error(
+- "None of the expected authentication plugins directories exist : %s",
+- searched_paths,
+- )
+- raise FileNotFoundError(
+- f"None of the expected authentication plugins directories exist : {searched_paths}"
+- )
+-
+- plugin_list = [
+- ("LDAP", f"authentication_ldap_sasl_client.{plugin_ext}"),
+- ("Kerberos", f"authentication_kerberos_client.{plugin_ext}"),
+- ("OCI IAM", f"authentication_oci_client.{plugin_ext}"),
+- ("WebAuthn", f"authentication_webauthn_client.{plugin_ext}"),
+- (
+- "OpenID Connect",
+- f"authentication_openid_connect_client.{plugin_ext}",
+- ),
+- ("MySQL Native", f"mysql_native_password.{plugin_ext}"),
+- ]
++ if plugin_path:
++ plugin_list = [
++ ("LDAP", f"authentication_ldap_sasl_client.{plugin_ext}"),
++ ("Kerberos", f"authentication_kerberos_client.{plugin_ext}"),
++ ("OCI IAM", f"authentication_oci_client.{plugin_ext}"),
++ ("WebAuthn", f"authentication_webauthn_client.{plugin_ext}"),
++ (
++ "OpenID Connect",
++ f"authentication_openid_connect_client.{plugin_ext}",
++ ),
++ ("MySQL Native", f"mysql_native_password.{plugin_ext}"),
++ ]
+
+- for plugin_name, plugin_file in plugin_list:
+- plugin_full_path = os.path.join(plugin_path, plugin_file)
+- self.log.debug(
+- "%s plugin_path: '%s'",
+- plugin_name,
+- plugin_full_path,
+- )
+- if os.path.exists(plugin_full_path):
+- bundle_plugin_libs = True
+- vendor_libs.append(
+- (plugin_path, [os.path.join("plugin", plugin_file)])
++ for plugin_name, plugin_file in plugin_list:
++ plugin_full_path = os.path.join(plugin_path, plugin_file)
++ self.log.debug(
++ "%s plugin_path: '%s'",
++ plugin_name,
++ plugin_full_path,
+ )
++ if os.path.exists(plugin_full_path):
++ bundle_plugin_libs = True
++ vendor_libs.append(
++ (plugin_path, [os.path.join("plugin", plugin_file)])
++ )
+
+ # vendor libraries
+ if bundle_plugin_libs and os.name == "nt":
+@@ -655,9 +646,6 @@
# Add extra link args
if self.extra_link_args:
ext.extra_link_args.extend(self.extra_link_args.split())
diff --git a/mysql-connector-python.spec b/mysql-connector-python.spec
index 6e6d7db..6dd5884 100644
--- a/mysql-connector-python.spec
+++ b/mysql-connector-python.spec
@@ -9,86 +9,72 @@
ExcludeArch: %{ix86}
# Tests only run on manual build --with tests
-# Tests rely on MySQL version 5.6
%global with_tests %{?_with_tests:1}%{!?_with_tests:0}
-# The building of the mysqlxb C extension is
-# disabled at the moment as it requires protobuf
-# with version 4.25.3 or higher and we only have
-# 3.19.6 in fedora at the moment, when protobuf is
-# rebased to a sufficient version this condition
-# should either be enabled or removed altogether
-%global with_mysqlxpb 0
+# Build the X DevAPI C extension (_mysqlxpb) with system protobuf
+%global with_mysqlxpb 0
Name: mysql-connector-python
-Version: 8.0.33
+Version: 26.7.0
Release: %autorelease
Summary: MySQL Connector for Python 3
-
License: GPL-2.0-only WITH Universal-FOSS-exception-1.0
-URL: http://dev.mysql.com/doc/connector-python/en/index.html
-# You can get the original tarball from:
-# http://dev.mysql.com/get/Downloads/Connector-python/8.0/%%{name}-%%{version}-src.tar.gz"
-
-# The tarball has to be modified as the fonts are licensed under a copyright
-# and therefore would clash with the allowed licenses for fonts in fedora if
-# they were shipped in the src rpm
-# to modify the tarball to the desired form use the
-# generate-modified-sources.sh script available in this repo
+URL: https://dev.mysql.com/doc/connector-python/en/
+
+# Original URL: https://dev.mysql.com/get/Downloads/Connector-python/%%{name}-%%{version}-src.tar.gz
+# Fonts in mysqlx-connector-python/docs/ are under restrictive copyright
+# (FontAwesome, Roboto Slab, Lato) and must be stripped before shipping.
+# Use 'generate-modified-sources.sh' to create the font-free tarball.
Source0: %{name}-%{version}-src-without-fonts.tar.gz
+# Remove RPATH injection into C extensions — Fedora uses system library paths
Patch0: %{name}-rpath.patch
+# Fix sphinx conf.py version import for the split source layout
+Patch1: %{name}-docs-import.patch
-BuildRequires: python3-devel >= 3
BuildRequires: gcc-c++
-# for building the extension modules
+BuildRequires: make
BuildRequires: mysql-devel
-# for building documentation
-BuildRequires: python3-sphinx
-# for import check (runtime dependency)
BuildRequires: python3-protobuf
-%if %{with_tests}
-# for unittest
-BuildRequires: mysql-server
-%endif
+BuildRequires: python3-sphinx
+BuildRequires: python3-sphinxcontrib-jquery
%if %{with_mysqlxpb}
-BuildRequires: protobuf-devel >= 4.25.3
BuildRequires: protobuf-compiler >= 4.25.3
+BuildRequires: protobuf-devel >= 4.25.3
+%endif
+
+%if %{with_tests}
+BuildRequires: mysql-server
%endif
%generate_buildrequires
-%pyproject_buildrequires
+%pyproject_buildrequires -d mysql-connector-python
+%pyproject_buildrequires -d mysqlx-connector-python
-%global _description\
-MySQL Connector/Python is implementing the MySQL Client/Server protocol\
-completely in Python. No MySQL libraries are needed, and no compilation\
-is necessary to run this Python DB API v2.0 compliant driver.\
-\
-Documentation: http://dev.mysql.com/doc/connector-python/en/index.html\
+%global _description %{expand:
+MySQL Connector/Python is implementing the MySQL Client/Server protocol
+completely in Python. No MySQL libraries are needed, and no compilation
+is necessary to run this Python DB API v2.0 compliant driver.
+Documentation: https://dev.mysql.com/doc/connector-python/en/}
%description %_description
%package -n mysql-connector-python3
-Summary: MySQL Connector for Python 3
+Summary: MySQL Connector for Python 3
%{?python_provide:%python_provide python3-mysql-connector}
-%description -n mysql-connector-python3
-MySQL Connector/Python is implementing the MySQL Client/Server protocol
-completely in Python. No MySQL libraries are needed, and no compilation
-is necessary to run this Python DB API v2.0 compliant driver.
-
-Documentation: http://dev.mysql.com/doc/connector-python/en/index.html
+%description -n mysql-connector-python3 %_description
%prep
-%setup -q -n %{name}-%{version}-src
-chmod -x examples/*py
-%patch -P0 -p1
+%autosetup -p1 -n %{name}-%{version}-src
+chmod -x mysql-connector-python/examples/*py
+
%build
-export MYSQL_CAPI=%{_prefix} # searches for bin/mysql_config in here, enables the extension module
+export MYSQL_CAPI=%{_prefix}
export LDFLAGS="$LDFLAGS -L%{_libdir}/mysql"
%if %{with_mysqlxpb}
@@ -96,47 +82,53 @@ export MYSQLXPB_PROTOBUF=%{_prefix}
export MYSQLXPB_PROTOBUF_INCLUDE_DIR=%{_includedir}
export MYSQLXPB_PROTOBUF_LIB_DIR=%{_libdir}
export MYSQLXPB_PROTOC="%{_bindir}/protoc"
+export PROTOBUF_INCLUDE_DIR=%{_includedir}
+export PROTOBUF_LIB_DIR=%{_libdir}
+export PROTOC="%{_bindir}/protoc"
%endif
-%pyproject_wheel
-#building the man pages
-cd docs/mysqlx
-%{__python3} conf.py
+%pyproject_wheel -d mysql-connector-python
+%pyproject_wheel -d mysqlx-connector-python
+
+# Build man pages from the mysqlx sphinx docs
+export CPY_BUILD_DIR=$PWD/mysqlx-connector-python/lib
+pushd mysqlx-connector-python/docs/mysqlx
+%python3 conf.py
make man BUILDDIR=%{_builddir}
+popd
%install
%pyproject_install
-# create the man dir
-mkdir -p %{buildroot}%{_mandir}/man1
-# install the man page into the man dir with
-# a more fitting name
-install -p -m 0644 %{_builddir}/man/mysqlxconnectorpythondevapireference.1 %{buildroot}%{_mandir}/man1/%{name}3.1
-# remove the source files the man page was generated from
-rm -r docs/mysqlx
+# pyproject_install may place pure Python files in sitelib while
+# C extensions go to sitearch; consolidate everything into sitearch
+if [ "%{python3_sitelib}" != "%{python3_sitearch}" ] && \
+ [ -d "%{buildroot}%{python3_sitelib}" ]; then
+ cp -a %{buildroot}%{python3_sitelib}/* %{buildroot}%{python3_sitearch}/
+ rm -r %{buildroot}%{python3_sitelib}
+fi
+
+mkdir -p %{buildroot}%{_mandir}/man1
+install -p -m 0644 %{_builddir}/man/mysqlxconnectorpythondevapireference.1 \
+ %{buildroot}%{_mandir}/man1/%{name}3.1
%check
%py3_check_import mysql mysqlx
%if %{with_tests}
-# known failed tests
-# bugs.BugOra14201459.test_error1426
-
-%{__python3} unittests.py \
- --with-mysql=%{_prefix} \
- --verbosity=1
+pushd mysql-connector-python
+%python3 unittests.py --with-mysql=%{_prefix} --verbosity=1
+popd
%else
-: echo test suite disabled, need '--with tests' option
+: test suite disabled, pass '--with tests' to enable
%endif
%files -n mysql-connector-python3
-%doc CHANGES.txt README* docs
-%doc examples
+%doc CHANGES.txt README.rst README.txt CONTRIBUTING.md SECURITY.md
+%doc mysql-connector-python/examples
%license LICENSE.txt
-# can't just use %%{python3_sitearch}/* as the packaging
-# guidelines dont' allow it
%{python3_sitearch}/mysql/
%{python3_sitearch}/mysqlx/
%{python3_sitearch}/_mysql_connector%{python3_ext_suffix}
@@ -144,6 +136,7 @@ rm -r docs/mysqlx
%{python3_sitearch}/_mysqlxpb%{python3_ext_suffix}
%endif
%{python3_sitearch}/mysql_connector_python-%{version}.dist-info/
+%{python3_sitearch}/mysqlx_connector_python-%{version}.dist-info/
%{_mandir}/man1/%{name}3.1.*
%changelog
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-22 12:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-22 12:14 [rpms/mysql-connector-python] f45: [rebase 2/4] Rewrite spec and update patches for 26.7.0 Michal Schorm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox