Summary:             Official JDBC driver for MySQL
Name:                mysql-connector-java
Version:             8.0.33
Release:             1
Epoch:               1
License:             GPLv2 with exceptions
URL:                 http://dev.mysql.com/downloads/connector/j/
Source0:             https://github.com/mysql/mysql-connector-j/archive/%{version}/%{name}-%{version}.tar.gz
Source1:             https://repo.maven.apache.org/maven2/mysql/mysql-connector-java/8.0.33/mysql-connector-java-8.0.33.pom

Patch2:              remove-authentication-plugin.patch
Patch3:              remove-StatementsTest.patch

BuildArch:           noarch
BuildRequires:       maven-local apache-commons-logging
BuildRequires:       hibernate java-devel >= 1:1.6.0 javapackages-local jta >= 1.0 
BuildRequires:       java-17-openjdk-devel
BuildRequires:       mvn(org.junit.jupiter:junit-jupiter-api)
BuildRequires:       mvn(com.google.protobuf:protobuf-java)
BuildRequires:       mvn(org.junit.platform:junit-platform-engine)
BuildRequires:       mvn(org.apache.maven.surefire:surefire-junit-platform)
BuildRequires:       mvn(org.hamcrest:hamcrest)
BuildRequires:       mvn(javassist:javassist)
BuildRequires:       mvn(org.slf4j:slf4j-api)
BuildRequires:       mvn(com.mchange:c3p0)
BuildRequires:       mvn(org.eclipse.aether:aether-connector-basic)
BuildRequires:       mvn(org.eclipse.aether:aether-transport-wagon)
BuildRequires:       mvn(org.apache.maven.wagon:wagon-http)
BuildRequires:       mvn(org.apache.maven.wagon:wagon-provider-api)
Requires:            jta >= 1.0 slf4j

%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.

%package javadoc
Summary:             Javadoc for mysql-connector-java
%description javadoc
Javadoc for mysql-connector-java

%prep
%autosetup -p1 -n mysql-connector-j-%{version}

for file in README README.md; do
 sed -i.orig 's|\r||g' $file
 touch -r $file.orig $file
 rm $file.orig
done
sed -i 's/>@.*</>%{version}</' src/build/misc/pom.xml
cp %{SOURCE1} ./pom.xml

%build
export CLASSPATH=$(build-classpath jdbc-stdext jta junit slf4j commons-logging.jar)
rm -rf src/main/user-impl/java/com/mysql/cj/jdbc/integration/jboss
rm src/test/java/testsuite/regression/StatementRegressionTest.java
%mvn_build -b --xmvn-javadoc

%install
%mvn_file mysql:mysql-connector-java %{name}
%mvn_install

%files -f .mfiles
%doc CHANGES README README.md
%license LICENSE

%files javadoc -f .mfiles-javadoc
%license LICENSE

%changelog
* Wed Jan 17 2024 Ge Wang <wang__ge@126.com> - 1:8.0.33-1
- UPgrade to 8.0.33

* Tue Sep 26 2023 xu_ping <707078654@qq.com> - 1:8.0.30-1
- Upgrade to 8.0.30

* Fri Feb 25 2022 houyingchao <houyingchao@huawei.com> - 1:8.0.16-1
- Upgrade to 8.0.16
- Fix CVE-2019-2692

* Fri Jul 24 2020 leiju <leiju4@huawei.com> - 1:8.0.15-1
- Package init
