# Scripts: RPM's Workhorse # http://ftp.rpm.org/max-rpm/s1-rpm-inside-scripts.html # cref: # rpm -ql redhat-rpm-config # /usr/lib/rpm/macros %{?_pgnd_macros} %global _owner pgnd %global _build_timestamp %( date +%%Y%%m%%d_%%H%%M%%S --utc ) # Conditional Builds: Using %%bcond_with and %%bcond_without # https://rpm-software-management.github.io/rpm/manual/conditionalbuilds.html#using-bcond_with-and-bcond_without # https://github.com/rpm-software-management/rpm/pull/2405 # opt to build with PKGNAME (`--with PKGNAME`); default is to build without it # %%bcond_with gnutls # opt to build without PKGNAME (`--without PKGNAME`); default is to build with it # %%bcond_without PKGNAME # MARIADB CONNECTOR-J # https://mariadb.com/kb/en/about-mariadb-connector-j/ # https://github.com/mariadb-corporation/mariadb-connector-j # https://mariadb.com/kb/en/installing-mariadb-connectorj/#installing-mariadb-connectorj-from-source %define _mdbcj_name mariadb-connector-j %define _mdbcj_pkgnm %{_mdbcj_name} %define _mdbcj_projurl https://github.com/mariadb-corporation/mariadb-connector-j.git %define _mdbcj_apiurl https://api.github.com/repos/mariadb-corporation/mariadb-connector-j %define _mdbcj_branch 3.3.1 %define _mdbcj_comment MariaDB Connector-J # https://spdx.org/licenses/LGPL-2.1-or-later.html %global _mdbcj_license LGPL-2.1-or-later # Downloading a Tarball from GitHub # https://www.baeldung.com/linux/github-download-tarball # https://stackoverflow.com/questions/39885600/changing-name-of-top-level-directory-when-downloading-a-tarball-from-github # https://github.com///archive/.tar.gz # source retrieved by `spectool` from `dnf install rpmdevtools` # check: # spectool --dry-run ./mariadb-connector-j.spec # _using_forges_hosted_revision_control # https://docs.fedoraproject.org/en-US/packaging-guidelines/SourceURL/#_multiple_sources_example # get tarball @ wget https://api.github.com/repos/mariadb-corporation/mariadb-connector-j/tarball/3.3.1 # /usr/lib/rpm/macros.d/macros.forge # /usr/lib/rpm/macros.d/macros.go-srpm %global forgeurl0 %{_mdbcj_projurl} %global branch0 %{_mdbcj_branch} %global commit0 %( git ls-remote %{forgeurl0} | grep /%{_mdbcj_branch}$ | cut -f1 | cut -c1-7) %global forgesource0 %{_mdbcj_apiurl}/tarball/%{_mdbcj_branch} %global forgesetupargs0 -n mariadb-corporation-mariadb-connector-j-%{commit0} %global archivename0 mariadb-corporation-mariadb-connector-j-%{commit0} %global archiveext0 tar.gz %global archiveurl0 %{_mdbcj_apiurl}/tarball/%{_mdbcj_branch} %forgemeta -i -a # %%global dist .%%{_owner}_%%{_build_timestamp}.fc%%{fedora} %global dist .%{_build_timestamp}.%{_owner}.fc%{fedora} # NEVRA (n-e:v-r.a) Name: %{_mdbcj_pkgnm} Epoch: 0 Version: %{scm0}_%{_mdbcj_branch} Release: 0%{?dist} BuildArch: noarch ExclusiveArch: %{java_arches} noarch Summary: %{_mdbcj_comment} License: %{_mdbcj_license} URL: %{forgeurl0} Source0: %{forgesource0} Patch0: 01-waffle-jna.patch # https://docs.fedoraproject.org/en-US/java-packaging-howto/maven/ %global xmvn_bootstrap 1 %global _without_tests 1 %global _without_javadoc 1 BuildRequires: maven-local BuildRequires: jna BuildRequires: jna-contrib BuildRequires: mvn(net.java.dev.jna:jna) BuildRequires: mvn(net.java.dev.jna:jna-platform) BuildRequires: mvn(com.google.code.maven-replacer-plugin:replacer) BuildRequires: mvn(org.apache.felix:maven-bundle-plugin) BuildRequires: mvn(org.codehaus.mojo:build-helper-maven-plugin) BuildRequires: mvn(org.osgi:osgi.cmpn) BuildRequires: mvn(org.osgi:osgi.core) # Packaging:Conflicts # https://fedoraproject.org/wiki/Packaging:Conflicts Obsoletes: %{_mdbcj_pkgnm} <= %{version} Provides: %{_mdbcj_pkgnm} = %{version} Conflicts: mariadb-java-client %description %{_mdbcj_comment} %prep echo '##### STARTING PREP #####' %forgesetup -a %pom_remove_dep com.github.waffle:waffle-jna %pom_remove_dep software.amazon.awssdk:bom %pom_remove_dep software.amazon.awssdk:rds %pom_remove_dep org.junit:junit-bom %pom_remove_dep org.junit.jupiter:junit-jupiter-engine %pom_remove_dep org.slf4j:slf4j-api %pom_add_dep net.java.dev.jna:jna %pom_add_dep net.java.dev.jna:jna-platform %pom_add_dep org.slf4j:slf4j-api %pom_change_dep -r :org.osgi.core org.osgi:osgi.core %pom_change_dep -r :org.osgi.compendium org.osgi:osgi.cmpn rm -r src/main/java/org/mariadb/jdbc/plugin/credential/aws # removing dependencies and 'provides', which mariadb-java-client cannot process from module-info.java sed -i '/aws/d' src/main/java9/module-info.java sed -i '/waffle/d' src/main/java9/module-info.java # removing missing dependencies form META-INF, so that the mariadb-java-client module would be valid sed -i '/aws/d' src/main/resources/META-INF/services/org.mariadb.jdbc.plugin.CredentialPlugin sed -i '/aws/d' src/test/resources/META-INF/services/org.mariadb.jdbc.plugin.CredentialPlugin rm -f src/main/java/org/mariadb/jdbc/plugin/authentication/addon/gssapi/WindowsNativeSspiAuthentication.java %patch -P 0 -p2 %mvn_file org.mariadb.jdbc:mariadb-java-client mariadb-java-client %mvn_alias org.mariadb.jdbc:mariadb-java-client mariadb:mariadb-connector-java %pom_remove_plugin org.jacoco:jacoco-maven-plugin %pom_remove_plugin org.apache.maven.plugins:maven-source-plugin %pom_remove_plugin org.sonatype.plugins:nexus-staging-maven-plugin %pom_remove_plugin -r :maven-gpg-plugin %pom_remove_plugin -r :maven-javadoc-plugin %build # https://docs.fedoraproject.org/en-US/java-packaging-howto/manpage_mvn_build/ %mvn_build %install %mvn_install %files -f .mfiles %doc README.md %license LICENSE %changelog * Thu Dec 5 2024 pgnd _ - bump 1733414169