From 3aadab94ac45567ee3078084724bde2419dcb37c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Kon=C4=8Dek?= Date: Mon, 21 Oct 2024 20:20:18 +0200 Subject: [PATCH] Add OpenJDK bindings in a separate configuration file Resolves: RHEL-62405 --- ...-Disable-SecurityManager-for-Java-18.patch | 2 +- ant.spec | 34 ++++++++++++------- apache-ant-1.8.ant.conf | 4 +++ 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/0001-Disable-SecurityManager-for-Java-18.patch b/0001-Disable-SecurityManager-for-Java-18.patch index 07bdf05..8bb3898 100644 --- a/0001-Disable-SecurityManager-for-Java-18.patch +++ b/0001-Disable-SecurityManager-for-Java-18.patch @@ -1,5 +1,5 @@ From e00b30674254bb4fc31ad2114eec808791b0d1dc Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Mari=C3=A1n=20Kon=C4=8Dek?= +From: Marián Konček Date: Wed, 16 Oct 2024 13:06:34 +0200 Subject: [PATCH] Disable SecurityManager for Java 18+ diff --git a/ant.spec b/ant.spec index 041ab15..4c4e419 100644 --- a/ant.spec +++ b/ant.spec @@ -34,7 +34,7 @@ Name: ant Version: 1.10.9 -Release: 9%{?dist} +Release: 10%{?dist} Summary: Java build tool Summary(it): Tool per la compilazione di programmi java Summary(fr): Outil de compilation pour java @@ -83,6 +83,7 @@ BuildRequires: junit5 Requires: %{name}-lib = %{version}-%{release} Requires: %{name}-jdk-binding = %{version}-%{release} Suggests: %{name}-openjdk17 = %{version}-%{release} + # Require full javapackages-tools since the ant script uses # /usr/share/java-utils/java-functions Requires: javapackages-tools @@ -320,6 +321,8 @@ Javadoc for %{name}. %description javadoc -l fr Javadoc pour %{name}. +%endif + %package openjdk8 Summary: OpenJDK 8 binding for Ant RemovePathPostfixes: -openjdk8 @@ -368,8 +371,6 @@ Conflicts: ant-jdk-binding %description openjdk21 Configures Ant to run with OpenJDK 21. -%endif - # ----------------------------------------------------------------------------- %prep @@ -401,20 +402,21 @@ build-jar-repository -s -p lib/optional antlr bcel javamail/mailapi jdepend juni %endif # fix hardcoded paths in ant script and conf -sed -e 's:/etc/ant.conf:%{_javaconfdir}/ant.conf:g' \ +cp -p %{SOURCE2} %{name}.conf +sed -e 's:/etc/ant.conf:%{_sysconfdir}/ant.conf:g' \ -e 's:/etc/ant.d:%{_sysconfdir}/ant.d:g' \ -e 's:/usr/share/ant:%{_datadir}/ant:g' \ -e 's:/usr/bin/build-classpath:%{_bindir}/build-classpath:g' \ -e 's:/usr/share/java-utils/java-functions:%{_javadir}-utils/java-functions:g' \ - -i src/script/ant %{SOURCE2} + -i src/script/ant %{name}.conf # Remove unnecessary JARs from the classpath sed -i 's/jaxp_parser_impl//;s/xml-commons-apis//' src/script/ant # Fix file-not-utf8 rpmlint warning -iconv KEYS -f iso-8859-1 -t utf-8 -o KEYS.utf8 +iconv KEYS -f iso-8859-1 -t utf-8 >KEYS.utf8 mv KEYS.utf8 KEYS -iconv LICENSE -f iso-8859-1 -t utf-8 -o LICENSE.utf8 +iconv LICENSE -f iso-8859-1 -t utf-8 >LICENSE.utf8 mv LICENSE.utf8 LICENSE # We want a hard dep on antlr @@ -509,20 +511,23 @@ cp -p src/script/ant $RPM_BUILD_ROOT%{_bindir}/ ln -sf %{_bindir}/ant $RPM_BUILD_ROOT%{ant_home}/bin/ cp -p src/script/antRun $RPM_BUILD_ROOT%{ant_home}/bin/ +# default ant.conf +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir} +cp -p %{name}.conf $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.conf + # JDK bindings for ant.conf install -d -m 755 $RPM_BUILD_ROOT%{_javaconfdir}/ ## For Java 1.8 prefer jvm -install -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_javaconfdir}/ant.conf-openjdk8 echo ' if [ -d %{_jvmlibdir}/java-1.8.0-openjdk ]; then JAVA_HOME=%{_jvmlibdir}/java-1.8.0-openjdk else JAVA_HOME=%{_jvmlibdir}/jre-1.8.0-openjdk fi -' >>$RPM_BUILD_ROOT%{_javaconfdir}/ant.conf-openjdk8 -sed '$a JAVA_HOME=%{_jvmlibdir}/jre-11-openjdk' %{SOURCE2} >$RPM_BUILD_ROOT%{_javaconfdir}/ant.conf-openjdk11 -sed '$a JAVA_HOME=%{_jvmlibdir}/jre-17-openjdk' %{SOURCE2} >$RPM_BUILD_ROOT%{_javaconfdir}/ant.conf-openjdk17 -sed '$a JAVA_HOME=%{_jvmlibdir}/jre-21-openjdk' %{SOURCE2} >$RPM_BUILD_ROOT%{_javaconfdir}/ant.conf-openjdk21 +' >$RPM_BUILD_ROOT%{_javaconfdir}/ant.conf-openjdk8 +echo 'JAVA_HOME=%{_jvmlibdir}/jre-11-openjdk' >$RPM_BUILD_ROOT%{_javaconfdir}/ant.conf-openjdk11 +echo 'JAVA_HOME=%{_jvmlibdir}/jre-17-openjdk' >$RPM_BUILD_ROOT%{_javaconfdir}/ant.conf-openjdk17 +echo 'JAVA_HOME=%{_jvmlibdir}/jre-21-openjdk' >$RPM_BUILD_ROOT%{_javaconfdir}/ant.conf-openjdk21 # OPT_JAR_LIST fragments mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d @@ -571,6 +576,7 @@ LC_ALL=C.UTF-8 %{ant} -Doffline=true test %files %doc KEYS README WHATSNEW %license LICENSE NOTICE +%config(noreplace) %{_sysconfdir}/%{name}.conf %attr(0755,root,root) %{_bindir}/ant %dir %{ant_home}/bin %{ant_home}/bin/ant @@ -707,6 +713,10 @@ LC_ALL=C.UTF-8 %{ant} -Doffline=true test # ----------------------------------------------------------------------------- %changelog +* Fri Nov 08 2024 Marián Konček - 1.10.9-10 +- Add OpenJDK bindings in a separate configuration file +- Resolves: RHEL-62405 + * Wed Oct 16 2024 Marián Konček - 1.10.9-9 - Add OpenJDK bindings - Resolves: RHEL-62405 diff --git a/apache-ant-1.8.ant.conf b/apache-ant-1.8.ant.conf index e169839..bff40df 100644 --- a/apache-ant-1.8.ant.conf +++ b/apache-ant-1.8.ant.conf @@ -17,4 +17,8 @@ else # ANT_HOME for rpm layout ANT_HOME=/usr/share/ant + + if [ -z "$JAVA_HOME" ] ; then + . /etc/java/ant.conf + fi fi