38727c
# Tests are EPEL only
38727c
%bcond_with tests
38727c
38727c
# No Python 3 by default
38727c
%bcond_with python3
7b76a2
7b76a2
%global srcname urllib3
7b76a2
7b76a2
Name:           python-%{srcname}
7f8605
Version:        1.10.2
38727c
Release:        7%{?dist}
7b76a2
Summary:        Python HTTP library with thread-safe connection pooling and file post
7b76a2
7b76a2
License:        MIT
7b76a2
URL:            http://urllib3.readthedocs.org/
38727c
Source0:        https://pypi.python.org/packages/source/u/%{srcname}/%{srcname}-%{version}.tar.gz
7b76a2
7b76a2
# Patch to change default behaviour to check SSL certs for validity
7b76a2
# https://bugzilla.redhat.com/show_bug.cgi?id=855320
7b76a2
Patch0:         python-urllib3-default-ssl-cert-validate.patch
7b76a2
75e569
# Patch for the PoolManager instance to consider additional SSL
75e569
# configuration when providing a pooled connection for a request.
75e569
# https://bugzilla.redhat.com/show_bug.cgi?id=1329395
75e569
# Upstream issue: https://github.com/shazow/urllib3/pull/830
75e569
Patch1: key-connection-pools-off-custom-keys.patch
75e569
f35787
# Support IP address SAN fields.
f35787
# https://bugzilla.redhat.com/show_bug.cgi?id=1434114
f35787
# Upstream: https://github.com/shazow/urllib3/pull/922
f35787
Patch2: Add-support-for-IP-address-SAN-fields.patch
f35787
38727c
# Patch for CVE-2018-20060
38727c
# Cross-host redirect does not remove Authorization header allow
38727c
# for credential exposure
38727c
# Backported without tests!
38727c
# https://bugzilla.redhat.com/show_bug.cgi?id=1649153
38727c
# Upstream: https://github.com/urllib3/urllib3/pull/1346
38727c
Patch3: CVE-2018-20060.patch
38727c
38727c
# Patch for CVE-2019-9740
38727c
# CRLF injection due to not encoding the '\r\n' sequence leading to possible
38727c
# attack on internal service.
38727c
# https://github.com/urllib3/urllib3/pull/1591/commits/c147f359520cab339ec96b3ef96e471c0da261f6
38727c
# https://github.com/urllib3/urllib3/pull/1593/commits/e951dfc83a642b0b5239559cb1c8cc287481f1ae
38727c
# https://bugzilla.redhat.com/show_bug.cgi?id=1700824
38727c
Patch4: CVE-2019-9740.patch
38727c
7b76a2
BuildArch:      noarch
7b76a2
7b76a2
Requires:       ca-certificates
7f8605
7f8605
# Previously bundled things:
7b76a2
Requires:       python-six
7f8605
Requires:       python-backports-ssl_match_hostname
f35787
Requires:       python-ipaddress
7b76a2
7f8605
%if 0%{?rhel} <= 6
7b76a2
BuildRequires:  python-ordereddict
7b76a2
Requires:       python-ordereddict
7b76a2
%endif
7b76a2
7b76a2
BuildRequires:  python2-devel
7f8605
BuildRequires:  python-setuptools
7b76a2
BuildRequires:  python-six
7f8605
BuildRequires:  python-backports-ssl_match_hostname
f35787
BuildRequires:  python-ipaddress
7f8605
# For unittests
38727c
%if %{with tests}
38727c
BuildRequires: python-nose
38727c
BuildRequires: python-tornado
38727c
BuildRequires: python-mock
38727c
%endif
7b76a2
38727c
%{?python_provide:%python_provide %{name}}
7b76a2
7b76a2
%description
7b76a2
Python HTTP module with connection pooling and file POST abilities.
7b76a2
38727c
38727c
%if %{with python3}
7b76a2
%package -n python3-%{srcname}
38727c
Summary:        Python 3 HTTP library with thread-safe connection pooling and file post
38727c
%{?python_provide:%python_provide python3-%{srcname}}
38727c
7b76a2
Requires:       ca-certificates
7b76a2
Requires:       python3-six
38727c
BuildRequires:  python3-devel
38727c
38727c
# For unittests
38727c
%if %{with tests}
38727c
BuildRequires:  python3-nose
38727c
BuildRequires:  python3-six
38727c
BuildRequires:  python3-tornado
38727c
BuildRequires:  python3-mock
38727c
%endif # with tests
38727c
7b76a2
%description -n python3-%{srcname}
7b76a2
Python3 HTTP module with connection pooling and file POST abilities.
38727c
%endif # with python3
7b76a2
7b76a2
7b76a2
%prep
7b76a2
%setup -q -n %{srcname}-%{version}
7b76a2
7f8605
# Drop the dummyserver tests in koji.  They fail there in real builds, but not
7f8605
# in scratch builds (weird).
7f8605
rm -rf test/with_dummyserver/
7b76a2
7b76a2
%patch0 -p1
75e569
%patch1 -p1
f35787
%patch2 -p1
38727c
%patch3 -p1
38727c
%patch4 -p1
7b76a2
7b76a2
7b76a2
%build
38727c
%py2_build
7b76a2
38727c
%if %{with python3}
38727c
%py3_build
38727c
%endif
7b76a2
7b76a2
%install
38727c
%py2_install
7b76a2
38727c
rm -rf %{buildroot}/%{python2_sitelib}/urllib3/packages/six.py*
38727c
rm -rf %{buildroot}/%{python2_sitelib}/urllib3/packages/ssl_match_hostname/
7f8605
38727c
mkdir -p %{buildroot}/%{python2_sitelib}/urllib3/packages/
f6105e
# ovirt composes remove *.py files, leaving only *.pyc files there; this means we have to symlink
f6105e
#  six.py* to make sure urllib3.packages.six will be importable
f6105e
for i in ../../six.py{,o,c}; do
38727c
  ln -s $i %{buildroot}/%{python2_sitelib}/urllib3/packages/
f6105e
done
38727c
ln -s ../../backports/ssl_match_hostname %{buildroot}/%{python2_sitelib}/urllib3/packages/ssl_match_hostname
7f8605
7b76a2
# dummyserver is part of the unittest framework
38727c
rm -rf %{buildroot}%{python2_sitelib}/dummyserver
7b76a2
38727c
%if %{with python3}
38727c
%py3_install
7b76a2
7b76a2
# dummyserver is part of the unittest framework
7b76a2
rm -rf %{buildroot}%{python3_sitelib}/dummyserver
38727c
%endif # with python3
7b76a2
38727c
%if %{with tests}
38727c
%check
38727c
nosetests-%{python2_version}
7b76a2
38727c
%if %{with python3}
38727c
nosetests-%{python3_version}
38727c
%endif # with python3
38727c
%endif # with tests
7b76a2
7b76a2
%files
38727c
%doc CHANGES.rst README.rst CONTRIBUTORS.txt
38727c
%license LICENSE.txt
38727c
%{python2_sitelib}/urllib3*
7b76a2
38727c
%if %{with python3}
7b76a2
%files -n python3-%{srcname}
38727c
%doc CHANGES.rst README.rst CONTRIBUTORS.txt
38727c
%license LICENSE.txt
38727c
%{python3_sitelib}/urllib3*
38727c
%endif # with python3
7b76a2
7b76a2
%changelog
38727c
* Fri May 03 2019 Miro Hrončok <mhroncok@redhat.com> - 1.10.2-7
38727c
- Provide python2-urllib3
38727c
- Add patch for CVE-2019-11236
38727c
Resolves: rhbz#1703360
38727c
38727c
* Mon Mar 04 2019 Lumír Balhar <lbalhar@redhat.com> - 1.10.2-6
38727c
- Source URL switched to HTTPS protocol
38727c
- Add patch for CVE-2018-20060
38727c
Resolves: rhbz#1658471
38727c
f35787
* Wed Oct 11 2017 Iryna Shcherbina <ishcherb@redhat.com> - 1.10.2-5
f35787
- Add patch to support IP address SAN fields.
f35787
Resolves: rhbz#1434114
f35787
f35787
* Thu Sep 14 2017 Charalampos Stratakis <cstratak@redhat.com> - 1.10.2-4
f35787
- Update patch to find ca_certs in the correct location.
f35787
Resolves: rhbz#1450213
f35787
75e569
* Mon Jan 23 2017 Iryna Shcherbina <ishcherb@redhat.com> - 1.10.2-3
75e569
- Fix PoolManager instance to take into account new SSL configuration
75e569
Resolves: rhbz#1329395
75e569
f6105e
* Mon Jul 27 2015 bkabrda <bkabrda@redhat.com> - 1.10.2-2
f6105e
- Fix the way we unbundle six to make ovirt work even when they remove .py files
75e569
Resolves: rhbz#1247093
f6105e
7f8605
* Mon Apr 13 2015 Matej Stuchlik <mstuchli@redhat.com> - 1.10.2-1
7f8605
- Update to 1.10.2
75e569
Resolves: rhbz#1226901
7b76a2
7b76a2
* Fri Mar  1 2013 Toshio Kuratomi <toshio@fedoraproject.org> - 1.5-5
7b76a2
- Unbundling finished!
7b76a2
7b76a2
* Fri Mar 01 2013 Ralph Bean <rbean@redhat.com> - 1.5-4
7b76a2
- Upstream patch to fix Accept header when behind a proxy.
7b76a2
- Reorganize patch numbers to more clearly distinguish them.
7b76a2
7b76a2
* Wed Feb 27 2013 Ralph Bean <rbean@redhat.com> - 1.5-3
7b76a2
- Renamed patches to python-urllib3-*
7b76a2
- Fixed ssl check patch to use the correct cert path for Fedora.
7b76a2
- Included dependency on ca-certificates
7b76a2
- Cosmetic indentation changes to the .spec file.
7b76a2
7b76a2
* Tue Feb  5 2013 Toshio Kuratomi <toshio@fedoraproject.org> - 1.5-2
7b76a2
- python3-tornado BR and run all unittests on python3
7b76a2
7b76a2
* Mon Feb 04 2013 Toshio Kuratomi <toshio@fedoraproject.org> 1.5-1
7b76a2
- Initial fedora build.
7b76a2