diff --git a/Dockerfile b/Dockerfile index 0424680..53ccc67 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,7 +26,7 @@ RUN if [ -n "$COPR_REPO" ]; then dnf copr enable -y $COPR_REPO; fi # Install LDAP SDK runtime dependencies RUN dnf install -y dogtag-ldapjdk \ - && dnf remove -y dogtag-* --noautoremove \ + && rpm -e --nodeps $(rpm -qa | grep -E "^java-|^dogtag-") \ && dnf clean all \ && rm -rf /var/cache/dnf diff --git a/ldapjdk.spec b/ldapjdk.spec index 3802b25..e8302a4 100644 --- a/ldapjdk.spec +++ b/ldapjdk.spec @@ -53,10 +53,28 @@ ExclusiveArch: %{java_arches} noarch # Java ################################################################################ +%if 0%{?rhel} + %define java_devel java-17-openjdk-devel %define java_headless java-17-openjdk-headless %define java_home %{_jvmdir}/jre-17-openjdk +%else + +# Use Java 21 on Fedora 40+, otherwise use Java 17. +%global java_devel java-devel >= 1:17 +%global java_headless java-headless >= 1:17 + +# Don't use find since it might not work well with local builds. +# find {_jvmdir} -maxdepth 1 | grep "jre-[0-9]\+$" +%global java_home %( + source /usr/share/java-utils/java-functions; + _prefer_jre=true; + set_jvm; + echo $JAVA_HOME) + +%endif + ################################################################################ # Build Dependencies ################################################################################ diff --git a/tests/bin/tools-test.sh b/tests/bin/tools-test.sh index 801bc8e..49ad054 100755 --- a/tests/bin/tools-test.sh +++ b/tests/bin/tools-test.sh @@ -1,6 +1,5 @@ #!/bin/bash -JAVA_HOME=/usr/lib/jvm/jre-17-openjdk CLASSPATH=/usr/share/java/ldapjdk.jar:/usr/share/java/ldaptools.jar:/usr/share/java/slf4j/slf4j-api.jar:/usr/share/java/slf4j/slf4j-jdk14.jar echo "Checking Root DSE"