Name:           apache-commons-compress
Version:        1.21
Release:        1
Summary:        Java API for working with compressed files and archivers
License:        ASL 2.0
URL:            http://commons.apache.org/proper/commons-compress/
BuildArch:      noarch
Source0:        http://archive.apache.org/dist/commons/compress/source/commons-compress-%{version}-src.tar.gz
Source1:        http://archive.apache.org/dist/commons/compress/source/commons-compress-%{version}-src.tar.gz.asc
Source2:        %{name}-build.xml
Patch0001:      0001-Remove-Brotli-compressor.patch
Patch0002:      0002-Remove-ZSTD-compressor.patch
Patch0003:      fix_java_8_compatibility.patch
BuildRequires:  ant objectweb-asm3 fdupes java-devel >= 1.8 javapackages-local xz-java
Provides:       commons-compress = %{version}-%{release}
Obsoletes:      commons-compress < %{version}-%{release}
Provides:       jakarta-commons-compress = %{version}-%{release}
Obsoletes:      jakarta-commons-compress < %{version}-%{release}

%description
The Apache Commons Compress library defines an API for working with
ar, cpio, Unix dump, tar, zip, gzip, XZ, Pack200 and bzip2 files.
In version 1.14 read-only support for Brotli decompression has been added,
but it has been removed from this package.

%package help
Summary:        API documentation for apache-commons-compress

Provides:       %{name}-javadoc = %{version}-%{release}
Obsoletes:      %{name}-javadoc < %{version}-%{release}

%description help
This package provides API documentation for apache-commons-compress.

%prep
%autosetup -n commons-compress-%{version}-src -p1
cp %{SOURCE2} build.xml
%pom_remove_dep org.brotli:dec
rm -r src/{main,test}/java/org/apache/commons/compress/compressors/brotli
%pom_remove_dep :zstd-jni
rm -r src/{main,test}/java/org/apache/commons/compress/compressors/zstandard
rm src/test/java/org/apache/commons/compress/compressors/DetectCompressorTestCase.java
%pom_remove_plugin :maven-javadoc-plugin
%pom_xpath_remove "pom:profiles/pom:profile[pom:id[text()='java9+']]"
%pom_remove_parent .
%pom_xpath_inject "pom:project" "<groupId>org.apache.commons</groupId>" .

%build
mkdir -p lib
build-jar-repository -s lib xz-java objectweb-asm3
%{ant} package javadoc

%install
install -dm 0755 %{buildroot}%{_javadir}
install -pm 0644 target/commons-compress-%{version}.jar %{buildroot}%{_javadir}/commons-compress.jar
ln -sf commons-compress.jar %{buildroot}%{_javadir}/%{name}.jar
install -dm 0755 %{buildroot}%{_mavenpomdir}
install -pm 0644 pom.xml %{buildroot}%{_mavenpomdir}/commons-compress.pom
%add_maven_depmap commons-compress.pom commons-compress.jar -a commons:commons-compress,commons-compress:commons-compress
install -dm 0755 %{buildroot}%{_javadocdir}/%{name}
cp -pr target/site/apidocs/* %{buildroot}%{_javadocdir}/%{name}
%fdupes -s %{buildroot}%{_javadocdir}

%files -f .mfiles
%{_javadir}/%{name}.jar
%license LICENSE.txt
%doc NOTICE.txt

%files help
%{_javadocdir}/%{name}
%license LICENSE.txt
%doc NOTICE.txt

%changelog
* Tue Aug 3 2021 houyingchao <houyingchao@huawei.com> - 1.21-1
- Upgrade to 1.21

* Sat Sep 12 2020 leiju <leiju4@huawei.com> - 1.17-4.h2
- Avoid use of internal Mockito API

* Thu Dec 26 2019 Senlin Xia <xiasenlin1@huawei.com> - 1.17-4.h1
- Type:cves
- ID:CVE-2019-12402
- SUG:restart
- DESC:fix bug with CVE-2019-12402

* Wed Dec 4 2019 Tianfei <tianfei16@huawei.com> - 1.17-4
- Package init
