Expand conditionals

This commit is contained in:
Mikolaj Izdebski 2021-05-14 12:54:39 +02:00
parent 893881587c
commit abbad1c3f6

View File

@ -28,10 +28,6 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# #
%bcond_without tests
%bcond_with javadoc
%bcond_without junit5
%global ant_home %{_datadir}/ant %global ant_home %{_datadir}/ant
Name: ant Name: ant
@ -73,13 +69,11 @@ BuildRequires: mvn(xml-resolver:xml-resolver)
BuildRequires: mvn(org.hamcrest:hamcrest-core) BuildRequires: mvn(org.hamcrest:hamcrest-core)
BuildRequires: mvn(org.hamcrest:hamcrest-library) BuildRequires: mvn(org.hamcrest:hamcrest-library)
%if %{with junit5}
BuildRequires: junit5 BuildRequires: junit5
%endif
# Theoretically Ant might be usable with just JRE, but typical Ant # Theoretically Ant might be usable with just JRE, but typical Ant
# workflow requires full JDK, so we recommend it here. # workflow requires full JDK, so we recommend it here.
%{?fedora:Recommends}%{!?fedora:Requires}: java-devel >= 1:1.8.0 Recommends: java-devel >= 1:1.8.0
Requires: %{name}-lib = %{version}-%{release} Requires: %{name}-lib = %{version}-%{release}
# Require full javapackages-tools since the ant script uses # Require full javapackages-tools since the ant script uses
@ -185,19 +179,6 @@ Optional commons net tasks for %{name}.
%description commons-net -l fr %description commons-net -l fr
Taches commons net optionelles pour %{name}. Taches commons net optionelles pour %{name}.
# Disable because we don't ship the dependencies
%if 0
%package jai
Summary: Optional jai tasks for %{name}
Requires: %{name} = %{epoch}:%{version}-%{release}
%description jai
Optional jai tasks for %{name}.
%description jai -l fr
Taches jai optionelles pour %{name}.
%endif
%package apache-bcel %package apache-bcel
Summary: Optional apache bcel tasks for %{name} Summary: Optional apache bcel tasks for %{name}
Requires: %{name} = %{version}-%{release} Requires: %{name} = %{version}-%{release}
@ -295,7 +276,6 @@ Optional junit tasks for %{name}.
%description junit -l fr %description junit -l fr
Taches junit optionelles pour %{name}. Taches junit optionelles pour %{name}.
%if %{with junit5}
%package junit5 %package junit5
Summary: Optional junit5 tasks for %{name} Summary: Optional junit5 tasks for %{name}
Requires: %{name} = %{version}-%{release} Requires: %{name} = %{version}-%{release}
@ -305,7 +285,6 @@ Optional junit5 tasks for %{name}.
%description junit5 -l fr %description junit5 -l fr
Taches junit5 optionelles pour %{name}. Taches junit5 optionelles pour %{name}.
%endif
%package testutil %package testutil
Summary: Test utility classes for %{name} Summary: Test utility classes for %{name}
@ -361,10 +340,7 @@ rm src/tests/junit/org/apache/tools/ant/types/selectors/SignedSelectorTest.java
src/tests/junit/org/apache/tools/mail/MailMessageTest.java src/tests/junit/org/apache/tools/mail/MailMessageTest.java
#install jars #install jars
build-jar-repository -s -p lib/optional antlr bcel javamail/mailapi jdepend junit log4j/log4j-1.2-api oro regexp bsf commons-logging commons-net jsch xalan-j2 xml-commons-resolver xalan-j2-serializer hamcrest/core hamcrest/library xz-java build-jar-repository -s -p lib/optional antlr bcel javamail/mailapi jdepend junit log4j/log4j-1.2-api oro regexp bsf commons-logging commons-net jsch xalan-j2 xml-commons-resolver xalan-j2-serializer hamcrest/core hamcrest/library xz-java junit5 opentest4j
%if %{with junit5}
build-jar-repository -s -p lib/optional junit5 opentest4j
%endif
# fix hardcoded paths in ant script and conf # fix hardcoded paths in ant script and conf
cp -p %{SOURCE2} %{name}.conf cp -p %{SOURCE2} %{name}.conf
@ -387,10 +363,6 @@ mv LICENSE.utf8 LICENSE
# We want a hard dep on antlr # We want a hard dep on antlr
%pom_xpath_remove pom:optional src/etc/poms/ant-antlr/pom.xml %pom_xpath_remove pom:optional src/etc/poms/ant-antlr/pom.xml
%if %{without junit5}
%pom_xpath_inject 'target[@name="javadocs"]/javadoc/packageset' '<exclude name="**/junitlauncher"/>' build.xml
%endif
# fix javamail dependency coordinates (remove once javamail is updated) # fix javamail dependency coordinates (remove once javamail is updated)
%pom_change_dep -r com.sun.mail:jakarta.mail javax.mail:mail src/etc/poms/ant-javamail/pom.xml %pom_change_dep -r com.sun.mail:jakarta.mail javax.mail:mail src/etc/poms/ant-javamail/pom.xml
@ -398,11 +370,7 @@ mv LICENSE.utf8 LICENSE
%pom_change_dep log4j:log4j org.apache.logging.log4j:log4j-1.2-api:2.13.3 src/etc/poms/ant-apache-log4j/pom.xml %pom_change_dep log4j:log4j org.apache.logging.log4j:log4j-1.2-api:2.13.3 src/etc/poms/ant-apache-log4j/pom.xml
%build %build
%{ant} jars test-jar %{ant} jars test-jar javadocs
%if %with javadoc
%{ant} javadocs
%endif
# typeset the manpage # typeset the manpage
mkdir man mkdir man
@ -411,9 +379,6 @@ xmlto man man/%{name}.xml -o man
#remove empty jai and netrexx jars. Due to missing dependencies they contain only manifests. #remove empty jai and netrexx jars. Due to missing dependencies they contain only manifests.
rm -fr build/lib/ant-jai.jar build/lib/ant-netrexx.jar rm -fr build/lib/ant-jai.jar build/lib/ant-netrexx.jar
%if %{without junit5}
rm -f build/lib/ant-junitlauncher.jar
%endif
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
%install %install
@ -482,7 +447,6 @@ echo "rhino bsf ant/ant-apache-bsf" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/ap
echo "xml-commons-resolver ant/ant-apache-resolver" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/apache-resolver echo "xml-commons-resolver ant/ant-apache-resolver" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/apache-resolver
echo "apache-commons-logging ant/ant-commons-logging" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/commons-logging echo "apache-commons-logging ant/ant-commons-logging" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/commons-logging
echo "apache-commons-net ant/ant-commons-net" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/commons-net echo "apache-commons-net ant/ant-commons-net" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/commons-net
#echo "jai ant/ant-jai" > $RPM_BUILD_ROOT%%{_sysconfdir}/%%{name}.d/jai
echo "bcel ant/ant-apache-bcel" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/apache-bcel echo "bcel ant/ant-apache-bcel" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/apache-bcel
echo "log4j/log4j-1.2-api log4j/log4j-api log4j/log4j-core ant/ant-apache-log4j" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/apache-log4j echo "log4j/log4j-1.2-api log4j/log4j-api log4j/log4j-core ant/ant-apache-log4j" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/apache-log4j
echo "oro ant/ant-apache-oro" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/apache-oro echo "oro ant/ant-apache-oro" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/apache-oro
@ -494,18 +458,13 @@ echo "jdepend ant/ant-jdepend" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/jdepend
echo "jsch ant/ant-jsch" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/jsch echo "jsch ant/ant-jsch" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/jsch
echo "junit hamcrest/core ant/ant-junit" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/junit echo "junit hamcrest/core ant/ant-junit" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/junit
echo "junit hamcrest/core ant/ant-junit4" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/junit4 echo "junit hamcrest/core ant/ant-junit4" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/junit4
echo "junit5 hamcrest/core junit opentest4j ant/ant-junitlauncher" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/junitlauncher
echo "testutil ant/ant-testutil" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/testutil echo "testutil ant/ant-testutil" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/testutil
echo "xz-java ant/ant-xz" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/xz echo "xz-java ant/ant-xz" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/xz
%if %{with junit5}
echo "junit5 hamcrest/core junit opentest4j ant/ant-junitlauncher" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/junitlauncher
%endif
%if %with javadoc
# javadoc # javadoc
mkdir -p $RPM_BUILD_ROOT%{_javadocdir}/%{name} mkdir -p $RPM_BUILD_ROOT%{_javadocdir}/%{name}
cp -pr build/javadocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name} cp -pr build/javadocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}
%endif
# fix link between manual and javadoc # fix link between manual and javadoc
(cd manual; ln -sf %{_javadocdir}/%{name} api) (cd manual; ln -sf %{_javadocdir}/%{name} api)
@ -514,10 +473,8 @@ cp -pr build/javadocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}
install -d -m 755 %{buildroot}%{_mandir}/man1/ install -d -m 755 %{buildroot}%{_mandir}/man1/
install -p -m 644 man/%{name}.1 %{buildroot}%{_mandir}/man1/%{name}.1 install -p -m 644 man/%{name}.1 %{buildroot}%{_mandir}/man1/%{name}.1
%if %with tests
%check %check
LC_ALL=C.UTF-8 %{ant} test LC_ALL=C.UTF-8 %{ant} test
%endif
%files %files
%doc KEYS README WHATSNEW %doc KEYS README WHATSNEW
@ -574,13 +531,6 @@ LC_ALL=C.UTF-8 %{ant} test
%{ant_home}/lib/%{name}-commons-net.jar %{ant_home}/lib/%{name}-commons-net.jar
%config(noreplace) %{_sysconfdir}/%{name}.d/commons-net %config(noreplace) %{_sysconfdir}/%{name}.d/commons-net
# Disable as we dont ship the dependencies
%if 0
%files jai -f .mfiles-jai
%{ant_home}/lib/%{name}-jai.jar
%config(noreplace) %{_sysconfdir}/%{name}.d/jai
%endif
%files apache-bcel -f .mfiles-apache-bcel %files apache-bcel -f .mfiles-apache-bcel
%{ant_home}/lib/%{name}-apache-bcel.jar %{ant_home}/lib/%{name}-apache-bcel.jar
%config(noreplace) %{_sysconfdir}/%{name}.d/apache-bcel %config(noreplace) %{_sysconfdir}/%{name}.d/apache-bcel
@ -631,11 +581,9 @@ LC_ALL=C.UTF-8 %{ant} test
%{ant_home}/etc/junit-frames-saxon.xsl %{ant_home}/etc/junit-frames-saxon.xsl
%{ant_home}/etc/junit-noframes-saxon.xsl %{ant_home}/etc/junit-noframes-saxon.xsl
%if %{with junit5}
%files junit5 -f .mfiles-junitlauncher %files junit5 -f .mfiles-junitlauncher
%{ant_home}/lib/%{name}-junitlauncher.jar %{ant_home}/lib/%{name}-junitlauncher.jar
%config(noreplace) %{_sysconfdir}/%{name}.d/junitlauncher %config(noreplace) %{_sysconfdir}/%{name}.d/junitlauncher
%endif
%files testutil -f .mfiles-testutil %files testutil -f .mfiles-testutil
%{ant_home}/lib/%{name}-testutil.jar %{ant_home}/lib/%{name}-testutil.jar
@ -649,11 +597,9 @@ LC_ALL=C.UTF-8 %{ant} test
%license LICENSE NOTICE %license LICENSE NOTICE
%doc manual/* %doc manual/*
%if %with javadoc
%files javadoc %files javadoc
%license LICENSE NOTICE %license LICENSE NOTICE
%{_javadocdir}/%{name} %{_javadocdir}/%{name}
%endif
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------