Install with XMvn

- Remove alternatives
This commit is contained in:
Michael Simacek 2017-02-23 15:36:35 +01:00
parent 03599472aa
commit 12bb1e46d0

View File

@ -32,32 +32,30 @@
Name: xalan-j2
Version: 2.7.1
Release: 29%{?dist}
Release: 30%{?dist}
Epoch: 0
Summary: Java XSLT processor
# src/org/apache/xpath/domapi/XPathStylesheetDOM3Exception.java is W3C
License: ASL 2.0 and W3C
URL: http://xalan.apache.org/
Source0: http://archive.apache.org/dist/xml/xalan-j/xalan-j_2_7_1-src.tar.gz
Source1: %{name}-serializer-MANIFEST.MF
Source2: http://repo1.maven.org/maven2/xalan/xalan/2.7.1/xalan-2.7.1.pom
Source3: http://repo1.maven.org/maven2/xalan/serializer/2.7.1/serializer-2.7.1.pom
Source4: xsltc-%{version}.pom
Source5: %{name}-MANIFEST.MF
Patch0: %{name}-noxsltcdeps.patch
# Fix CVE-2014-0107: insufficient constraints in secure processing
# feature (oCERT-2014-002). Generated form upstream revisions 1581058
# and 1581426.
Patch2: %{name}-CVE-2014-0107.patch
URL: http://xalan.apache.org/
BuildArch: noarch
Provides: jaxp_transform_impl
Requires: xerces-j2
Requires(post): chkconfig
Requires(preun): chkconfig
BuildRequires: javapackages-local
BuildRequires: java-devel
BuildRequires: ant
BuildRequires: apache-parent
BuildRequires: bcel
BuildRequires: java_cup
BuildRequires: regexp
@ -68,6 +66,10 @@ BuildRequires: xml-commons-apis >= 0:1.3
BuildRequires: xml-stylebook
BuildRequires: zip
Requires: xerces-j2
Provides: jaxp_transform_impl
%description
Xalan is an XSLT processor for transforming XML documents into HTML,
text, or other XML document types. It implements the W3C Recommendations
@ -94,7 +96,6 @@ Documentation for %{name}.
%package javadoc
Summary: Javadoc for %{name}
BuildRequires: java-javadoc
%description javadoc
Javadoc for %{name}.
@ -129,8 +130,12 @@ sed -i '/class-path/I d' $(find -iname '*manifest*')
sed -i 's/\r//' KEYS LICENSE.txt NOTICE.txt xdocs/style/resources/script.js \
xdocs/sources/xsltc/README* `find -name '*.sh'`
%mvn_file :xalan %{name} jaxp_transform_impl
%mvn_file :serializer %{name}-serializer
%mvn_file :xsltc xsltc
%mvn_package :xsltc xsltc
%build
if [ ! -e "$JAVA_HOME" ] ; then export JAVA_HOME="%{java_home}" ; fi
pushd lib
ln -sf $(build-classpath java_cup-runtime) runtime.jar
ln -sf $(build-classpath bcel) BCEL.jar
@ -156,8 +161,6 @@ ant \
samples \
servlet
%install
# inject OSGi manifests
mkdir -p META-INF
cp -p %{SOURCE1} META-INF/MANIFEST.MF
@ -167,28 +170,12 @@ cp -p %{SOURCE5} META-INF/MANIFEST.MF
touch META-INF/MANIFEST.MF
zip -u build/xalan-interpretive.jar META-INF/MANIFEST.MF
# jars
install -d -m 755 $RPM_BUILD_ROOT%{_javadir}
install -p -m 644 build/xalan-interpretive.jar \
$RPM_BUILD_ROOT%{_javadir}/%{name}.jar
install -p -m 644 build/xsltc.jar \
$RPM_BUILD_ROOT%{_javadir}/xsltc.jar
install -p -m 644 build/serializer.jar \
$RPM_BUILD_ROOT%{_javadir}/%{name}-serializer.jar
%mvn_artifact %{SOURCE2} build/xalan-interpretive.jar
%mvn_artifact %{SOURCE3} build/serializer.jar
%mvn_artifact %{SOURCE4} build/xsltc.jar
# POMs
install -d -m 755 $RPM_BUILD_ROOT%{_mavenpomdir}
install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_mavenpomdir}/JPP-%{name}.pom
install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT%{_mavenpomdir}/JPP-%{name}-serializer.pom
install -p -m 644 %{SOURCE4} $RPM_BUILD_ROOT%{_mavenpomdir}/JPP-xsltc.pom
%add_maven_depmap JPP-%{name}.pom %{name}.jar
%add_maven_depmap JPP-%{name}-serializer.pom %{name}-serializer.jar
%add_maven_depmap -f xsltc JPP-xsltc.pom xsltc.jar
# javadoc
install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name}
cp -pr build/docs/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}
rm -rf build/docs/apidocs
%install
%mvn_install -J build/docs/apidocs
# demo
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/%{name}
@ -201,25 +188,13 @@ cp -pr samples $RPM_BUILD_ROOT%{_datadir}/%{name}
# fix link between manual and javadoc
(cd build/docs; ln -sf %{_javadocdir}/%{name} apidocs)
# jaxp_transform_impl ghost symlink
ln -s %{_sysconfdir}/alternatives \
$RPM_BUILD_ROOT%{_javadir}/jaxp_transform_impl.jar
%post
update-alternatives --install %{_javadir}/jaxp_transform_impl.jar \
jaxp_transform_impl %{_javadir}/%{name}.jar 30
%preun
{
[ $1 = 0 ] || exit 0
update-alternatives --remove jaxp_transform_impl %{_javadir}/%{name}.jar
} >/dev/null 2>&1 || :
# alternatives removed in f26
update-alternatives --remove jaxp_transform_impl %{_javadir}/%{name}.jar &>/dev/null || :
%files -f .mfiles
%license LICENSE.txt NOTICE.txt
%doc KEYS readme.html
%ghost %{_javadir}/jaxp_transform_impl.jar
%files xsltc -f .mfiles-xsltc
%license LICENSE.txt NOTICE.txt
@ -236,6 +211,10 @@ update-alternatives --install %{_javadir}/jaxp_transform_impl.jar \
%{_datadir}/%{name}
%changelog
* Thu Feb 23 2017 Michael Simacek <msimacek@redhat.com> - 0:2.7.1-30
- Install with XMvn
- Remove alternatives
* Tue Feb 07 2017 Michael Simacek <msimacek@redhat.com> - 0:2.7.1-29
- Build against glassfish-servlet-api