snakeyaml/snakeyaml.spec

137 lines
4.4 KiB
RPMSpec

#
# spec file for package snakeyaml
#
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global vertag b28f0b4d87c6
%bcond_with tests
Name: snakeyaml
Version: 1.28
Release: 0
Summary: YAML parser and emitter for the Java programming language
License: Apache-2.0
Group: Development/Libraries/Java
URL: https://bitbucket.org/asomov/snakeyaml/
Source0: https://bitbucket.org/asomov/snakeyaml/get/%{name}-%{version}.tar.bz2
Source1: %{name}-build.xml
# Upstream has forked gdata-java and base64 and refuses [1] to
# consider replacing them by external dependencies. Bundled libraries
# need to be removed and their use replaced by system libraries.
# See rhbz#875777 and http://code.google.com/p/snakeyaml/issues/detail?id=175
#
# Replace use of bundled Base64 implementation with java.util.Base64
Patch0: 0001-replace-bundled-base64coder-with-java.util.Base64.patch
# We don't have gdata-java, use commons-codec instead
Patch1: 0002-Replace-bundled-gdata-java-client-classes-with-commo.patch
BuildRequires: ant
BuildRequires: apache-commons-codec
BuildRequires: fdupes
BuildRequires: java-devel >= 1.8
BuildRequires: javapackages-local
Requires: mvn(commons-codec:commons-codec)
BuildArch: noarch
%if %{with tests}
BuildRequires: ant-junit
BuildRequires: apache-commons-collections
BuildRequires: apache-commons-lang
BuildRequires: hamcrest-core
BuildRequires: joda-time
BuildRequires: junit
BuildRequires: oro
BuildRequires: velocity
# Differently sorted collections make fail some tests that rely on a particular order
BuildConflicts: java >= 9
BuildConflicts: java-devel >= 9
BuildConflicts: java-headless >= 9
%endif
%description
SnakeYAML features:
* a complete YAML 1.1 parser. In particular,
SnakeYAML can parse all examples from the specification.
* Unicode support including UTF-8/UTF-16 input/output.
* high-level API for serializing and deserializing
native Java objects.
* support for all types from the YAML types repository.
* relatively sensible error messages.
%package javadoc
Summary: API documentation for %{name}
Group: Documentation/HTML
%description javadoc
This package contains %{summary}.
%prep
%setup -q -n asomov-%{name}-%{vertag}
cp %{SOURCE1} build.xml
%patch0 -p1
%patch1 -p1
%pom_remove_plugin :cobertura-maven-plugin
%pom_remove_plugin :maven-changes-plugin
%pom_remove_plugin :maven-license-plugin
%pom_remove_plugin :maven-javadoc-plugin
%pom_remove_plugin :maven-site-plugin
sed -i "/<artifactId>spring</s/spring/&-core/" pom.xml
rm -f src/test/java/examples/SpringTest.java
# Replacement for bundled gdata-java-client
%pom_add_dep commons-codec:commons-codec
# fails in rpmbuild only due to different locale
rm src/test/java/org/yaml/snakeyaml/issues/issue67/NonAsciiCharsInClassNameTest.java
# fails after unbundling
rm src/test/java/org/yaml/snakeyaml/issues/issue318/ContextClassLoaderTest.java
# convert CR+LF to LF
sed -i 's/\r//g' LICENSE.txt
%build
mkdir -p lib
build-jar-repository -s lib commons-codec
%if %{with tests}
build-jar-repository -s lib junit hamcrest/core velocity commons-collections commons-lang oro joda-time
%endif
%{ant} \
%if %{without tests}
-Dtest.skip=true \
%endif
clean package javadoc
%install
# jar
install -dm 0755 %{buildroot}%{_javadir}
install -pm 0644 target/%{name}-%{version}.jar %{buildroot}%{_javadir}/%{name}.jar
# pom
install -dm 0755 %{buildroot}%{_mavenpomdir}
install -pm 0644 pom.xml %{buildroot}%{_mavenpomdir}/JPP-%{name}.pom
%add_maven_depmap JPP-%{name}.pom %{name}.jar
# javadoc
install -dm 0755 %{buildroot}%{_javadocdir}/%{name}
cp -pr target/site/apidocs/* %{buildroot}%{_javadocdir}/%{name}/
%fdupes -s %{buildroot}%{_javadocdir}
%files -f .mfiles
%license LICENSE.txt
%files javadoc
%license LICENSE.txt
%{_javadocdir}/%{name}
%changelog