Gus Kenion 2025-01-27 13:52:18 +00:00 committed by Git OBS Bridge
commit e5baf8836a
10 changed files with 1669 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

14
javac-check.patch Normal file
View File

@ -0,0 +1,14 @@
Description: Disable the JDK check
Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: not-needed
--- a/build.xml
+++ b/build.xml
@@ -400,7 +400,7 @@ See also com.mysql.cj.conf.PropertyDefin
<!-- Initialize the build directory and check requirements for compiling the driver code. -->
- <target name="-init" depends="-extra-libs-check, -compiler-check, -copy-files, -copy-notices-commercial, -copy-notices-gpl, -init-info-files">
+ <target name="-init" depends="-extra-libs-check, -copy-files, -copy-notices-commercial, -copy-notices-gpl, -init-info-files">
<!-- The following is needed as the classpath can't be modified dynamically, and not having this library present causes the build to fail. -->
<available property="com.mysql.cj.c3p0Present" classname="com.mchange.v2.c3p0.QueryConnectionTester" classpathref="com.mysql.cj.build.classpath" />
</target>

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6135c92ccc2859538e909650597034f1a9247941f4513411305a1ff79eaab7d5
size 2060757

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b63aa5991ee9bce9388458d4656145da361581f226d43e5101d8934cc79f87fa
size 2066548

View File

@ -0,0 +1,39 @@
--- a/src/main/protocol-impl/java/com/mysql/cj/protocol/a/NativeAuthenticationProvider.java
+++ b/src/main/protocol-impl/java/com/mysql/cj/protocol/a/NativeAuthenticationProvider.java
@@ -48,7 +48,6 @@ import com.mysql.cj.protocol.a.NativeCon
import com.mysql.cj.protocol.a.NativeConstants.StringSelfDataType;
import com.mysql.cj.protocol.a.authentication.AuthenticationKerberosClient;
import com.mysql.cj.protocol.a.authentication.AuthenticationLdapSaslClientPlugin;
-import com.mysql.cj.protocol.a.authentication.AuthenticationOciClient;
import com.mysql.cj.protocol.a.authentication.AuthenticationOpenidConnectClient;
import com.mysql.cj.protocol.a.authentication.AuthenticationWebAuthnClient;
import com.mysql.cj.protocol.a.authentication.CachingSha2PasswordPlugin;
@@ -249,7 +248,6 @@ public class NativeAuthenticationProvide
pluginsToInit.add(new MysqlOldPasswordPlugin());
pluginsToInit.add(new AuthenticationLdapSaslClientPlugin());
pluginsToInit.add(new AuthenticationKerberosClient());
- pluginsToInit.add(new AuthenticationOciClient());
pluginsToInit.add(new AuthenticationWebAuthnClient());
pluginsToInit.add(new AuthenticationOpenidConnectClient());
--- a/src/main/resources/com/mysql/cj/LocalizedErrorMessages.properties
+++ b/src/main/resources/com/mysql/cj/LocalizedErrorMessages.properties
@@ -40,18 +40,6 @@ AuthenticationOpenidConnect.MissingIdTok
AuthenticationOpenidConnect.FailReadIdTokenFile=Failed reading the OpenID Identity Token file specified in the connection property ''idTokenFile''.
AuthenticationOpenidConnect.InvalidIdTokenFile=The file specified in the connection property ''idTokenFile'' contains an invalid OpenID Identity Token.
-AuthenticationOciClientPlugin.ConfigFileNotFound=OCI configuration file not found.
-AuthenticationOciClientPlugin.OciSdkNotFound=The OCI SDK cannot be found or it is not installed.
-AuthenticationOciClientPlugin.OciConfigFileError=The OCI configuration file cannot be read.
-AuthenticationOciClientPlugin.ProfileNotFound=The specified profile is not found in the OCI configuration file.
-AuthenticationOciClientPlugin.OciConfigFileMissingEntry=The OCI configuration file does not contain a ''fingerprint'' or ''key_file'' entry.
-AuthenticationOciClientPlugin.PrivateKeyNotFound=The private key cannot be found at the location referenced in the OCI configuration entry ''key_file''.
-AuthenticationOciClientPlugin.FailedReadingPrivateKey=Failed reading the private key file referenced in the OCI configuration entry ''key_file''.
-AuthenticationOciClientPlugin.PrivateKeyNotValid=The OCI configuration entry ''key_file'' does not reference a valid key file.
-AuthenticationOciClientPlugin.SecurityTokenFileNotFound=The security token file cannot be found at the location referenced in the OCI configuration entry ''security_token_file''.
-AuthenticationOciClientPlugin.SecurityTokenTooBig=Invalid security token file. File size above 10 KB.
-AuthenticationOciClientPlugin.FailedReadingSecurityTokenFile=Failed reading the security token file referenced in the OCI configuration entry ''security_token_file''.
-
AuthenticationProvider.BadAuthenticationPlugin=Unable to load authentication plugin ''{0}''.
AuthenticationProvider.BadDefaultAuthenticationPlugin=Improper value "{0}" for property ''defaultAuthenticationPlugin''.
AuthenticationProvider.DefaultAuthenticationPluginIsNotListed=Default authentication plugin "{0}" is neither one of the built-in plugins nor one of the plugins listed in ''authenticationPlugins''.

View File

@ -0,0 +1,43 @@
--- a/src/main/core-impl/java/com/mysql/cj/NativeSession.java
+++ b/src/main/core-impl/java/com/mysql/cj/NativeSession.java
@@ -40,7 +40,6 @@ import java.util.stream.Collectors;
import java.util.stream.Stream;
import com.mysql.cj.conf.HostInfo;
-import com.mysql.cj.conf.PropertyDefinitions.OpenTelemetry;
import com.mysql.cj.conf.PropertyKey;
import com.mysql.cj.conf.PropertySet;
import com.mysql.cj.conf.RuntimeProperty;
@@ -54,7 +53,6 @@ import com.mysql.cj.exceptions.MysqlErro
import com.mysql.cj.exceptions.OperationCancelledException;
import com.mysql.cj.interceptors.QueryInterceptor;
import com.mysql.cj.log.Log;
-import com.mysql.cj.otel.OpenTelemetryHandler;
import com.mysql.cj.protocol.ColumnDefinition;
import com.mysql.cj.protocol.NetworkResources;
import com.mysql.cj.protocol.ProtocolEntityFactory;
@@ -110,24 +108,7 @@ public class NativeSession extends CoreS
public NativeSession(HostInfo hostInfo, PropertySet propSet) {
super(hostInfo, propSet);
-
- // Check Telemetry option.
- RuntimeProperty<OpenTelemetry> openTelemetry = this.propertySet.getEnumProperty(PropertyKey.openTelemetry);
- if (openTelemetry.getValue() == OpenTelemetry.PREFERRED || openTelemetry.getValue() == OpenTelemetry.REQUIRED) {
- if (!OpenTelemetryHandler.isOpenTelemetryApiAvailable()) {
- if (openTelemetry.getValue() == OpenTelemetry.REQUIRED) {
- throw ExceptionFactory.createException(Messages.getString("Connection.OtelApiNotFound"));
- }
- if (openTelemetry.isExplicitlySet()) {
- getLog().logInfo(Messages.getString("Connection.OtelApiNotFound"));
- }
setTelemetryHandler(NoopTelemetryHandler.getInstance());
- } else {
- setTelemetryHandler(new OpenTelemetryHandler());
- }
- } else {
- setTelemetryHandler(NoopTelemetryHandler.getInstance());
- }
}
public void connect(HostInfo hi, String user, String password, String database, int loginTimeout, TransactionEventHandler transactionManager)

1384
mysql-connector-java.changes Normal file

File diff suppressed because it is too large Load Diff

139
mysql-connector-java.spec Normal file
View File

@ -0,0 +1,139 @@
#
# spec file for package mysql-connector-java
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define new_name mysql-connector-j
Name: mysql-connector-java
Version: 9.2.0
Release: 0
Summary: Official JDBC Driver for MySQL
License: GPL-2.0-or-later
Group: Development/Languages/Java
URL: https://dev.mysql.com/downloads/connector/j/
Source0: https://github.com/mysql/mysql-connector-j/archive/refs/tags/%{version}.tar.gz#:/%{name}-%{version}.tar.gz
Patch0: javac-check.patch
# NOTE: Oracle OCI is not packaged yet
# The patch doesn't remove the file AuthenticationOciClient.java
# therefore it's removed during prep phase
Patch1: %{name}-remove-oci-support.patch
Patch2: reproducible-build.patch
Patch3: %{name}-remove-opentelemetry-support.patch
BuildRequires: ant
BuildRequires: ant-contrib
BuildRequires: apache-commons-logging
BuildRequires: geronimo-jta-1_1-api
BuildRequires: git
BuildRequires: java-devel >= 1.8
BuildRequires: javapackages-local >= 6
BuildRequires: javassist >= 3.28.0
BuildRequires: junit
BuildRequires: protobuf-devel >= 26
BuildRequires: protobuf-java >= 26
BuildRequires: slf4j
BuildRequires: xz
Requires: jta >= 1.0
Requires: slf4j
Provides: mm.mysql = %{version}
Obsoletes: mm.mysql < %{version}
# we'll be providing the new package name until this one is deprecated
Provides: %{new_name}
# manual is no longer distributed
Provides: %{name}-manual = %{version}
Obsoletes: %{name}-manual < %{version}
BuildArch: noarch
%if 0%{?suse_version} < 1500
BuildRequires: log4j
Requires: log4j
%else
BuildRequires: reload4j
Requires: reload4j
%endif
%description
MySQL Connector/J is a native Java driver that converts JDBC (Java
Database Connectivity) calls into the network protocol used by the
MySQL database. It lets developers working with the Java programming
language easily build programs and applets that interact with MySQL and
connect all corporate data, even in a heterogeneous environment. MySQL
Connector/J is a Type IV JDBC driver and has a complete JDBC feature
set that supports the capabilities of MySQL.
%prep
%setup -q -n mysql-connector-j-%{version}
%patch -P 0 -p1
%patch -P 1 -p1
%patch -P 2 -p1
%patch -P 3 -p1
# remove OCI support
rm -rf src/main/protocol-impl/java/com/mysql/cj/protocol/a/authentication/AuthenticationOciClient.java
# remove OpenTelemetry support
rm -rf src/main/core-impl/java/com/mysql/cj/otel/OpenTelemetryHandler.java
rm -rf src/main/core-impl/java/com/mysql/cj/otel/OpenTelemetrySpan.java
rm -rf src/main/core-impl/java/com/mysql/cj/otel/OpenTelemetryScope.java
# extra libs
mkdir -p lib
mkdir -p src/lib
ln -f -s %{_datadir}/java/ant/ant-contrib.jar lib/ant-contrib.jar
ln -f -s %{_datadir}/java/slf4j/api.jar lib/slf4j-api.jar
ln -s %{_datadir}/java/javassist.jar lib/javassist.jar
ln -s %{_datadir}/java/protobuf.jar lib/protobuf.jar
%build
export CLASSPATH=$(build-classpath \
ant-contrib \
commons-logging \
slf4j \
jdbc-stdext \
jta \
junit \
reload4j \
protobuf)
ant \
-Dsnapshot.version= \
-Dcom.mysql.jdbc.extra.libs=lib \
-Dant.java.version=1.8 \
-Dant.build.javac.source=1.8 \
-Dant.build.javac.target=1.8 \
-Dcom.mysql.cj.build.jdk.javac=javac \
-Dcom.mysql.cj.build.jdk.java=java \
build
%install
install -d -m 755 %{buildroot}%{_javadir}
install build/%{new_name}-%{version}-SNAPSHOT/%{new_name}-%{version}-SNAPSHOT.jar %{buildroot}%{_javadir}/%{new_name}.jar
ln -sf %{_javadir}/%{new_name}.jar %{buildroot}%{_javadir}/%{name}.jar
rm -rf %{buildroot}%{new_name}-%{version}/docs/release-test-output
install -d -m 755 %{buildroot}%{_mavenpomdir}
# Install the Maven build information as new name
%{mvn_install_pom} build/%{new_name}-%{version}-SNAPSHOT/pom.xml %{buildroot}%{_mavenpomdir}/JPP-%{new_name}.pom
sed -i 's/-SNAPSHOT//' %{buildroot}%{_mavenpomdir}/JPP-%{new_name}.pom
%add_maven_depmap JPP-%{new_name}.pom %{new_name}.jar -a "com.mysql:%{name}","mysql:%{name}"
%files -f .mfiles
%{_javadir}/%{name}.jar
%license LICENSE
%doc CHANGES README
%changelog

20
reproducible-build.patch Normal file
View File

@ -0,0 +1,20 @@
--- a/src/main/core-api/java/com/mysql/cj/conf/PropertyDefinitions.java
+++ b/src/main/core-api/java/com/mysql/cj/conf/PropertyDefinitions.java
@@ -21,7 +21,7 @@
package com.mysql.cj.conf;
import java.util.Collections;
-import java.util.HashMap;
+import java.util.TreeMap;
import java.util.Map;
import com.mysql.cj.Messages;
@@ -899,7 +899,7 @@ public class PropertyDefinitions {
//
};
- HashMap<PropertyKey, PropertyDefinition<?>> propertyKeyToPropertyDefinitionMap = new HashMap<>();
+ TreeMap<PropertyKey, PropertyDefinition<?>> propertyKeyToPropertyDefinitionMap = new TreeMap<>();
for (PropertyDefinition<?> pdef : pdefs) {
propertyKeyToPropertyDefinitionMap.put(pdef.getPropertyKey(), pdef);
}