File jakarta-commons-fileupload.spec of Package jakarta-commons-fileupload.28093

#
# spec file for package jakarta-commons-fileupload
#
# Copyright (c) 2023 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/
#
# icecream 0


%define base_name fileupload
%define short_name commons-%{base_name}

Name:           jakarta-commons-fileupload
Version:        1.1.1
Release:        0
Summary:        Jakarta Commons FileUpload Package
License:        Apache-2.0
Group:          Development/Libraries/Java
URL:            http://jakarta.apache.org/commons/fileupload/
Source0:        http://www.apache.org/dist/jakarta/commons/fileupload/source/commons-fileupload-1.1.1-src.tar.gz
Patch0:         %{name}-build_xml.patch
Patch1:         %{name}-%{version}-servletapi5.patch
#PATCH-FIX-UPSTREAM: bnc#846174
#DiskFileItem.java part of http://svn.apache.org/viewvc?view=revision&revision=1507048
Patch2:         jakarta-commons-fileupload-CVE-2013-2186.patch
#PATCH-FIX-UPSTREAM: bnc#862781
Patch3:         jakarta-commons-fileupload-CVE-2014-0050-DOS-buffer-overflow.patch
#PATCH-FIX-UPSTREAM: bsc#1128963 CVE-2016-1000031
Patch4:         jakarta-commons-fileupload-CVE-2016-1000031.patch
#PATCH-FIX-UPSTREAM: bsc#986359, CVE-2016-3092 https://github.com/apache/commons-fileupload/commit/e20c04990f7420ca917e96a84cec58b13a1b3d17
Patch5:         jakarta-commons-fileupload-CVE-2016-3092.patch
#PATCH-FIX-UPSTREAM: bsc#986359, CVE-2016-3092 https://github.com/apache/commons-fileupload/commit/774ef160d591b579f703c694002e080f99bcd28b
Patch6:         jakarta-commons-fileupload-CVE-2016-3092-2.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
BuildRequires:  ant
BuildRequires:  ant-junit
BuildRequires:  jakarta-commons-io
BuildRequires:  javapackages-tools
BuildRequires:  junit >= 3.8.1
BuildRequires:  portlet-1.0-api
BuildRequires:  servletapi5
%if %defined suse_version
BuildRequires:  java-devel
BuildRequires:  unzip
%endif
Requires:       javapackages-tools
Requires:       servletapi5
# FIXME: correct on update of fileuploads
Provides:       %{short_name} = 1.1.2
Obsoletes:      %{short_name} <= 1.1.1

%description
The javax.servlet package lacks support for RFC 1867, HTML file upload.
 This package provides a simple-to-use API for working with such data.
The scope of this package is to create a package of Java utility
classes to read multipart/form-data within a
javax.servlet.http.HttpServletRequest.

%package        javadoc
PreReq:         coreutils
Summary:        Javadoc for jakarta-commons-fileupload
Group:          Development/Libraries/Java

%description    javadoc
The javax.servlet package lacks support for rfc 1867, html file upload.
 This package provides a simple to use api for working with such data.
The scope of this package is to create a package of Java utility
classes to read multipart/form-data within a
javax.servlet.http.HttpServletRequest.

This package contains the javadoc documentation for the Jakarta Commons
Fileupload Package.

%prep
%setup -q -n %{short_name}-%{version}
%patch0 -b .build.xml
%patch1 -p0 -b .servletapi5
%patch2 -p0
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
# -----------------------------------------------------------------------------

%build
export CLASSPATH="$(build-classpath commons-io junit portlet-1.0-api \
    servletapi5):${PWD}/target/classes:${PWD}/target/test-classes"
ant \
    -Dbuild.sysclasspath=only \
    -Dfinal.name=%{name}-%{version} \
    -Dservletapi.javadoc=%{_javadocdir}/servletapi5 \
    dist
# -----------------------------------------------------------------------------

%install
%{__rm} -rf $RPM_BUILD_ROOT
# jars
%{__mkdir} -p $RPM_BUILD_ROOT%{_javadir}
%{__cp} -p dist/%{name}-%{version}.jar $RPM_BUILD_ROOT%{_javadir}
(
    cd $RPM_BUILD_ROOT%{_javadir} && \
    for jar in *-%{version}*; do
        %{__ln_s} -f ${jar} `echo $jar | %{__sed} "s|jakarta-||g"`
    done
)
(
    cd $RPM_BUILD_ROOT%{_javadir} && \
    for jar in *-%{version}*; do
        %{__ln_s} -f ${jar} `echo $jar | %{__sed} "s|-%{version}||g"`
    done
)
# javadoc
%{__mkdir} -p $RPM_BUILD_ROOT%{_javadocdir}/%{name}
%{__cp} -pr dist/docs/api/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}

# -----------------------------------------------------------------------------

%files
%defattr(0644,root,root,0755)
%license LICENSE.txt
%doc NOTICE.txt RELEASE-NOTES.txt
%{_javadir}/*

%files javadoc
%defattr(0644,root,root,0755)
%doc %{_javadocdir}/%{name}

%changelog
openSUSE Build Service is sponsored by