diff --git a/.gitignore b/.gitignore index 130a371..90ee852 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /pymongo-2.3.tar.gz /pymongo-2.5.tar.gz /pymongo-2.5.2.tar.gz +/pymongo-3.0.3.tar.gz diff --git a/0001-Serverless-test-suite-workaround.patch b/0001-Serverless-test-suite-workaround.patch new file mode 100644 index 0000000..5481571 --- /dev/null +++ b/0001-Serverless-test-suite-workaround.patch @@ -0,0 +1,41 @@ +From bc392400e5d53c8f65b7adb1bc1dd2e88a4d510b Mon Sep 17 00:00:00 2001 +From: Haikel Guemar +Date: Thu, 1 Oct 2015 11:26:44 +0200 +Subject: [PATCH 1/2] Serverless test suite workaround + +--- + test/__init__.py | 10 +++------- + 1 file changed, 3 insertions(+), 7 deletions(-) + +diff --git a/test/__init__.py b/test/__init__.py +index 62e6bdf..d06120d 100644 +--- a/test/__init__.py ++++ b/test/__init__.py +@@ -366,12 +366,6 @@ def setup(): + + def teardown(): + c = client_context.client +- c.drop_database("pymongo-pooling-tests") +- c.drop_database("pymongo_test") +- c.drop_database("pymongo_test1") +- c.drop_database("pymongo_test2") +- c.drop_database("pymongo_test_mike") +- c.drop_database("pymongo_test_bernie") + if client_context.auth_enabled and not client_context.user_provided: + c.admin.remove_user(db_user) + +@@ -386,8 +380,10 @@ class PymongoTestRunner(unittest.TextTestRunner): + return result + + +-def test_cases(suite): ++def test_cases(suite=None): + """Iterator over all TestCases within a TestSuite.""" ++ if suite is None: ++ return + for suite_or_case in suite._tests: + if isinstance(suite_or_case, unittest.TestCase): + # unittest.TestCase +-- +2.5.0 + diff --git a/0002-Use-ssl_match_hostname-from-backports.patch b/0002-Use-ssl_match_hostname-from-backports.patch new file mode 100644 index 0000000..a3ea38a --- /dev/null +++ b/0002-Use-ssl_match_hostname-from-backports.patch @@ -0,0 +1,39 @@ +From d6d5496f555e1bdb3d5f4ca44a0141ce3bd80074 Mon Sep 17 00:00:00 2001 +From: Haikel Guemar +Date: Thu, 1 Oct 2015 11:45:17 +0200 +Subject: [PATCH 2/2] Use ssl_match_hostname from backports + +--- + pymongo/errors.py | 2 +- + pymongo/pool.py | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/pymongo/errors.py b/pymongo/errors.py +index bcd0df5..82bfd5f 100644 +--- a/pymongo/errors.py ++++ b/pymongo/errors.py +@@ -19,7 +19,7 @@ from bson.errors import * + try: + from ssl import CertificateError + except ImportError: +- from pymongo.ssl_match_hostname import CertificateError ++ from backports.ssl_match_hostname import CertificateError + + + class PyMongoError(Exception): +diff --git a/pymongo/pool.py b/pymongo/pool.py +index e557ab5..50593bd 100644 +--- a/pymongo/pool.py ++++ b/pymongo/pool.py +@@ -45,7 +45,7 @@ try: + from ssl import match_hostname, CertificateError + except ImportError: + # These don't require the ssl module +- from pymongo.ssl_match_hostname import match_hostname, CertificateError ++ from backports.ssl_match_hostname import match_hostname, CertificateError + + + def _raise_connection_failure(address, error): +-- +2.5.0 + diff --git a/python-pymongo.spec b/python-pymongo.spec index 6ad5b54..d867b7a 100644 --- a/python-pymongo.spec +++ b/python-pymongo.spec @@ -1,7 +1,11 @@ -%if 0%{?fedora} > 17 +%if 0%{?fedora} %global with_python3 1 -%else -%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} +%endif + +%if 0%{?rhel} && 0%{?rhel} <= 6 +%{!?__python2: %global __python2 /usr/bin/python2} +%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} +%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} %endif # Fix private-shared-object-provides error @@ -11,8 +15,8 @@ } Name: python-pymongo -Version: 2.5.2 -Release: 7%{?dist} +Version: 3.0.3 +Release: 1%{?dist} Summary: Python driver for MongoDB Group: Development/Languages @@ -20,6 +24,8 @@ Group: Development/Languages License: ASL 2.0 and MIT URL: http://api.mongodb.org/python Source0: http://pypi.python.org/packages/source/p/pymongo/pymongo-%{version}.tar.gz +Patch01: 0001-Serverless-test-suite-workaround.patch +Patch02: 0002-Use-ssl_match_hostname-from-backports.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires: python-bson = %{version}-%{release} @@ -29,6 +35,11 @@ Obsoletes: pymongo <= 2.1.1-4 BuildRequires: python2-devel BuildRequires: python-nose BuildRequires: python-setuptools +%if 0%{?rhel} && 0%{?rhel} <= 6 +BuildRequires: python-unittest2 +%endif +BuildRequires: python-backports-ssl_match_hostname +Requires: python-backports-ssl_match_hostname %if 0%{?with_python3} BuildRequires: python-tools @@ -97,7 +108,11 @@ contains the python3 version of this module. %prep %setup -q -n pymongo-%{version} +%patch01 -p1 -b .test +%patch02 -p1 -b .ssl rm -r pymongo.egg-info +# remove bundled ssl.mast_hostname code +rm pymongo/ssl_match_hostname.py %if 0%{?with_python3} rm -rf %{py3dir} @@ -106,7 +121,7 @@ cp -a . %{py3dir} %endif # with_python3 %build -CFLAGS="%{optflags}" %{__python} setup.py build +CFLAGS="%{optflags}" %{__python2} setup.py build %if 0%{?with_python3} pushd %{py3dir} @@ -116,11 +131,17 @@ popd %install rm -rf %{buildroot} -%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT +%{__python2} setup.py install --skip-build --root $RPM_BUILD_ROOT +# Fix permissions +chmod 755 %{buildroot}%{python2_sitearch}/bson/*.so +chmod 755 %{buildroot}%{python2_sitearch}/pymongo/*.so %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT +# Fix permissions +chmod 755 %{buildroot}%{python3_sitearch}/bson/*.so +chmod 755 %{buildroot}%{python3_sitearch}/pymongo/*.so popd %endif # with_python3 @@ -130,8 +151,8 @@ rm -rf %{buildroot} %files %defattr(-,root,root,-) %doc LICENSE PKG-INFO README.rst doc -%{python_sitearch}/pymongo -%{python_sitearch}/pymongo-%{version}-*.egg-info +%{python2_sitearch}/pymongo +%{python2_sitearch}/pymongo-%{version}-*.egg-info %if 0%{?with_python3} %files -n python3-pymongo @@ -144,7 +165,7 @@ rm -rf %{buildroot} %files gridfs %defattr(-,root,root,-) %doc LICENSE PKG-INFO README.rst doc -%{python_sitearch}/gridfs +%{python2_sitearch}/gridfs %if 0%{?with_python3} %files -n python3-pymongo-gridfs @@ -156,7 +177,7 @@ rm -rf %{buildroot} %files -n python-bson %defattr(-,root,root,-) %doc LICENSE PKG-INFO README.rst doc -%{python_sitearch}/bson +%{python2_sitearch}/bson %if 0%{?with_python3} %files -n python3-bson @@ -166,6 +187,9 @@ rm -rf %{buildroot} %endif # with_python3 %check +%if 0%{?rhel} && 0%{?rhel} <= 6 +# do not run test under EL6 +%else # Exclude tests that require an active MongoDB connection exclude='(^test_auth_from_uri$' exclude+='|^test_auto_auth_login$' @@ -182,10 +206,12 @@ exclude+='|^test_constants$' exclude+='|^test_contextlib$' exclude+='|^test_copy_db$' exclude+='|^test_cursor$' +exclude+='|^test_crud$' exclude+='|^test_database$' exclude+='|^test_database_names$' exclude+='|^test_delegated_auth$' exclude+='|^test_disconnect$' +exclude+='|^test_discovery_and_monitoring$' exclude+='|^test_document_class$' exclude+='|^test_drop_database$' exclude+='|^test_equality$' @@ -225,6 +251,8 @@ exclude+='|^test_safe_insert$' exclude+='|^test_safe_update$' exclude+='|^test_schedule_refresh$' exclude+='|^test_server_disconnect$' +exclude+='|^test_server_selection$' +exclude+='|^test_server_selection_rtt$' exclude+='|^test_son_manipulator$' exclude+='|^test_threading$' exclude+='|^test_threads$' @@ -238,8 +266,13 @@ exclude+=')' pushd test nosetests --exclude="$exclude" popd +%endif %changelog +* Thu Oct 01 2015 Haïkel Guémar - 3.0.3-1 +- Upstream 3.0.3 +- Fix CVE-2013-7440 (RHBZ#1231231 #1231232) + * Thu Jun 18 2015 Fedora Release Engineering - 2.5.2-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild diff --git a/sources b/sources index dd10331..97d38de 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -d1ada91f0ec474534eab88429fb6ce5e pymongo-2.5.2.tar.gz +0425d99c2a453144b9c95cb37dbc46e9 pymongo-3.0.3.tar.gz