Add OpenJDK bindings in a separate configuration file

Resolves: RHEL-62405
This commit is contained in:
Marián Konček 2024-10-21 20:20:18 +02:00
parent 58758d3788
commit 3aadab94ac
3 changed files with 27 additions and 13 deletions

View File

@ -1,5 +1,5 @@
From e00b30674254bb4fc31ad2114eec808791b0d1dc Mon Sep 17 00:00:00 2001 From e00b30674254bb4fc31ad2114eec808791b0d1dc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mari=C3=A1n=20Kon=C4=8Dek?= <mkoncek@redhat.com> From: Marián Konček <mkoncek@redhat.com>
Date: Wed, 16 Oct 2024 13:06:34 +0200 Date: Wed, 16 Oct 2024 13:06:34 +0200
Subject: [PATCH] Disable SecurityManager for Java 18+ Subject: [PATCH] Disable SecurityManager for Java 18+

View File

@ -34,7 +34,7 @@
Name: ant Name: ant
Version: 1.10.9 Version: 1.10.9
Release: 9%{?dist} Release: 10%{?dist}
Summary: Java build tool Summary: Java build tool
Summary(it): Tool per la compilazione di programmi java Summary(it): Tool per la compilazione di programmi java
Summary(fr): Outil de compilation pour java Summary(fr): Outil de compilation pour java
@ -83,6 +83,7 @@ BuildRequires: junit5
Requires: %{name}-lib = %{version}-%{release} Requires: %{name}-lib = %{version}-%{release}
Requires: %{name}-jdk-binding = %{version}-%{release} Requires: %{name}-jdk-binding = %{version}-%{release}
Suggests: %{name}-openjdk17 = %{version}-%{release} Suggests: %{name}-openjdk17 = %{version}-%{release}
# Require full javapackages-tools since the ant script uses # Require full javapackages-tools since the ant script uses
# /usr/share/java-utils/java-functions # /usr/share/java-utils/java-functions
Requires: javapackages-tools Requires: javapackages-tools
@ -320,6 +321,8 @@ Javadoc for %{name}.
%description javadoc -l fr %description javadoc -l fr
Javadoc pour %{name}. Javadoc pour %{name}.
%endif
%package openjdk8 %package openjdk8
Summary: OpenJDK 8 binding for Ant Summary: OpenJDK 8 binding for Ant
RemovePathPostfixes: -openjdk8 RemovePathPostfixes: -openjdk8
@ -368,8 +371,6 @@ Conflicts: ant-jdk-binding
%description openjdk21 %description openjdk21
Configures Ant to run with OpenJDK 21. Configures Ant to run with OpenJDK 21.
%endif
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
%prep %prep
@ -401,20 +402,21 @@ build-jar-repository -s -p lib/optional antlr bcel javamail/mailapi jdepend juni
%endif %endif
# fix hardcoded paths in ant script and conf # 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:/etc/ant.d:%{_sysconfdir}/ant.d:g' \
-e 's:/usr/share/ant:%{_datadir}/ant:g' \ -e 's:/usr/share/ant:%{_datadir}/ant:g' \
-e 's:/usr/bin/build-classpath:%{_bindir}/build-classpath:g' \ -e 's:/usr/bin/build-classpath:%{_bindir}/build-classpath:g' \
-e 's:/usr/share/java-utils/java-functions:%{_javadir}-utils/java-functions: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 # Remove unnecessary JARs from the classpath
sed -i 's/jaxp_parser_impl//;s/xml-commons-apis//' src/script/ant sed -i 's/jaxp_parser_impl//;s/xml-commons-apis//' src/script/ant
# Fix file-not-utf8 rpmlint warning # 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 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 mv LICENSE.utf8 LICENSE
# We want a hard dep on antlr # 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/ ln -sf %{_bindir}/ant $RPM_BUILD_ROOT%{ant_home}/bin/
cp -p src/script/antRun $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 # JDK bindings for ant.conf
install -d -m 755 $RPM_BUILD_ROOT%{_javaconfdir}/ install -d -m 755 $RPM_BUILD_ROOT%{_javaconfdir}/
## For Java 1.8 prefer jvm ## For Java 1.8 prefer jvm
install -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_javaconfdir}/ant.conf-openjdk8
echo ' echo '
if [ -d %{_jvmlibdir}/java-1.8.0-openjdk ]; then if [ -d %{_jvmlibdir}/java-1.8.0-openjdk ]; then
JAVA_HOME=%{_jvmlibdir}/java-1.8.0-openjdk JAVA_HOME=%{_jvmlibdir}/java-1.8.0-openjdk
else else
JAVA_HOME=%{_jvmlibdir}/jre-1.8.0-openjdk JAVA_HOME=%{_jvmlibdir}/jre-1.8.0-openjdk
fi fi
' >>$RPM_BUILD_ROOT%{_javaconfdir}/ant.conf-openjdk8 ' >$RPM_BUILD_ROOT%{_javaconfdir}/ant.conf-openjdk8
sed '$a JAVA_HOME=%{_jvmlibdir}/jre-11-openjdk' %{SOURCE2} >$RPM_BUILD_ROOT%{_javaconfdir}/ant.conf-openjdk11 echo 'JAVA_HOME=%{_jvmlibdir}/jre-11-openjdk' >$RPM_BUILD_ROOT%{_javaconfdir}/ant.conf-openjdk11
sed '$a JAVA_HOME=%{_jvmlibdir}/jre-17-openjdk' %{SOURCE2} >$RPM_BUILD_ROOT%{_javaconfdir}/ant.conf-openjdk17 echo 'JAVA_HOME=%{_jvmlibdir}/jre-17-openjdk' >$RPM_BUILD_ROOT%{_javaconfdir}/ant.conf-openjdk17
sed '$a JAVA_HOME=%{_jvmlibdir}/jre-21-openjdk' %{SOURCE2} >$RPM_BUILD_ROOT%{_javaconfdir}/ant.conf-openjdk21 echo 'JAVA_HOME=%{_jvmlibdir}/jre-21-openjdk' >$RPM_BUILD_ROOT%{_javaconfdir}/ant.conf-openjdk21
# OPT_JAR_LIST fragments # OPT_JAR_LIST fragments
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d
@ -571,6 +576,7 @@ LC_ALL=C.UTF-8 %{ant} -Doffline=true test
%files %files
%doc KEYS README WHATSNEW %doc KEYS README WHATSNEW
%license LICENSE NOTICE %license LICENSE NOTICE
%config(noreplace) %{_sysconfdir}/%{name}.conf
%attr(0755,root,root) %{_bindir}/ant %attr(0755,root,root) %{_bindir}/ant
%dir %{ant_home}/bin %dir %{ant_home}/bin
%{ant_home}/bin/ant %{ant_home}/bin/ant
@ -707,6 +713,10 @@ LC_ALL=C.UTF-8 %{ant} -Doffline=true test
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
%changelog %changelog
* Fri Nov 08 2024 Marián Konček <mkoncek@redhat.com> - 1.10.9-10
- Add OpenJDK bindings in a separate configuration file
- Resolves: RHEL-62405
* Wed Oct 16 2024 Marián Konček <mkoncek@redhat.com> - 1.10.9-9 * Wed Oct 16 2024 Marián Konček <mkoncek@redhat.com> - 1.10.9-9
- Add OpenJDK bindings - Add OpenJDK bindings
- Resolves: RHEL-62405 - Resolves: RHEL-62405

View File

@ -17,4 +17,8 @@ else
# ANT_HOME for rpm layout # ANT_HOME for rpm layout
ANT_HOME=/usr/share/ant ANT_HOME=/usr/share/ant
if [ -z "$JAVA_HOME" ] ; then
. /etc/java/ant.conf
fi
fi fi