18c250
%bcond_without python3
18c250
%bcond_with python36_module
18c250
18c250
# Only build on architectures supported by mongodb in RHEL8
18c250
%global mongodb_arches x86_64 ppc64le aarch64 s390x
18c250
18c250
# Fix private-shared-object-provides error
18c250
%{?filter_setup:
35dcc6
%filter_provides_in %{python2_sitearch}.*\.so$
18c250
%filter_setup
18c250
}
18c250
18c250
# Conditionalize tests
18c250
%bcond_with tests
18c250
18c250
%if 0%{?rhel} > 7
18c250
# Disable python2 build by default
18c250
%bcond_with python2
18c250
%else
18c250
%bcond_without python2
18c250
%endif
18c250
18c250
Name:           python-pymongo
9b3fc8
Version:        3.7.0
9b3fc8
Release:        1%{?dist}
18c250
18c250
# All code is ASL 2.0 except bson/time64*.{c,h} which is MIT
18c250
License:        ASL 2.0 and MIT
18c250
Summary:        Python driver for MongoDB
18c250
URL:            http://api.mongodb.org/python
18c250
Source0:        https://github.com/mongodb/mongo-python-driver/archive/%{version}/pymongo-%{version}.tar.gz
18c250
18c250
# Only build on architectures supported by mongodb in RHEL8
18c250
ExclusiveArch:  %{mongodb_arches}
18c250
18c250
# This patch removes the bundled ssl.match_hostname library as it was vulnerable to CVE-2013-7440
18c250
# and CVE-2013-2099, and wasn't needed anyway since Fedora >= 22 has the needed module in the Python
18c250
# standard library. It also adjusts imports so that they exclusively use the code from Python.
18c250
Patch01:        0001-Use-ssl.match_hostname-from-the-Python-stdlib.patch
18c250
18c250
%if %{with tests}
18c250
%ifnarch armv7hl ppc64 s390 s390x
18c250
# These are needed for tests, and the tests don't work on armv7hl.
18c250
# MongoDB server is not available on big endian arches (ppc64, s390(x)).
18c250
BuildRequires:  mongodb-server
18c250
BuildRequires:  net-tools
18c250
BuildRequires:  procps-ng
18c250
%endif
18c250
%endif # with tests
18c250
18c250
%if %{with python2}
18c250
BuildRequires:  python2-tools
18c250
BuildRequires:  python2-devel
18c250
BuildRequires:  python2-setuptools
18c250
%endif # with python2
18c250
18c250
%if %{with python3}
18c250
%if %{with python36_module}
18c250
BuildRequires:  python36-devel
18c250
BuildRequires:  python36-rpm-macros
18c250
%else
18c250
BuildRequires:  python3-devel
18c250
%endif
18c250
BuildRequires:  python3-setuptools
18c250
BuildRequires:  python3-sphinx
18c250
%endif
18c250
18c250
%description
18c250
The Python driver for MongoDB.
18c250
18c250
18c250
%if %{with python3}
18c250
%package doc
18c250
BuildArch: noarch
18c250
Summary:   Documentation for python-pymongo
18c250
18c250
18c250
%description doc
18c250
Documentation for python-pymongo.
18c250
%endif
18c250
18c250
%if %{with python2}
18c250
%package -n python2-bson
18c250
Summary:        Python bson library
18c250
%{?python_provide:%python_provide python2-bson}
18c250
18c250
18c250
%description -n python2-bson
18c250
BSON is a binary-encoded serialization of JSON-like documents. BSON is designed
18c250
to be lightweight, traversable, and efficient. BSON, like JSON, supports the
18c250
embedding of objects and arrays within other objects and arrays.
18c250
%endif # with python2
18c250
18c250
18c250
%if %{with python3}
18c250
%package -n python3-bson
18c250
Summary:        Python bson library
18c250
%{?python_provide:%python_provide python3-bson}
18c250
18c250
18c250
%description -n python3-bson
18c250
BSON is a binary-encoded serialization of JSON-like documents. BSON is designed
18c250
to be lightweight, traversable, and efficient. BSON, like JSON, supports the
18c250
embedding of objects and arrays within other objects and arrays.  This package
18c250
contains the python3 version of this module.
18c250
%endif
18c250
18c250
18c250
%if %{with python2}
18c250
%package -n python2-pymongo
18c250
Summary:        Python driver for MongoDB
18c250
18c250
Requires:       python2-bson%{?_isa} = %{version}-%{release}
18c250
Obsoletes:      pymongo <= 2.1.1-4
18c250
%{?python_provide:%python_provide python2-pymongo}
18c250
18c250
18c250
%description -n python2-pymongo
18c250
The Python driver for MongoDB.  This package contains the python2 version of
18c250
this module.
18c250
%endif # with python2
18c250
18c250
18c250
%if %{with python3}
18c250
%package -n python3-pymongo
18c250
Summary:        Python driver for MongoDB
18c250
Requires:       python3-bson%{?_isa} = %{version}-%{release}
18c250
%{?python_provide:%python_provide python3-pymongo}
18c250
18c250
18c250
%description -n python3-pymongo
18c250
The Python driver for MongoDB.  This package contains the python3 version of
18c250
this module.
18c250
%endif
18c250
18c250
%if %{with python2}
18c250
%package -n python2-pymongo-gridfs
18c250
Summary:        Python GridFS driver for MongoDB
18c250
Requires:       python2-pymongo%{?_isa} = %{version}-%{release}
18c250
Obsoletes:      pymongo-gridfs <= 2.1.1-4
18c250
%{?python_provide:%python_provide python2-pymongo-gridfs}
18c250
18c250
18c250
%description -n python2-pymongo-gridfs
18c250
GridFS is a storage specification for large objects in MongoDB.
18c250
%endif # with python2
18c250
18c250
18c250
%if %{with python3}
18c250
%package -n python3-pymongo-gridfs
18c250
Summary:        Python GridFS driver for MongoDB
18c250
Requires:       python3-pymongo%{?_isa} = %{version}-%{release}
18c250
%{?python_provide:%python_provide python3-pymongo-gridfs}
18c250
18c250
18c250
%description -n python3-pymongo-gridfs
18c250
GridFS is a storage specification for large objects in MongoDB.  This package
18c250
contains the python3 version of this module.
18c250
%endif
18c250
18c250
18c250
%prep
18c250
%setup -q -n mongo-python-driver-%{version}
18c250
%patch01 -p1 -b .ssl
18c250
18c250
# Remove the bundled ssl.match_hostname library as it was vulnerable to CVE-2013-7440
18c250
# and CVE-2013-2099, and isn't needed anyway since Fedora >= 22 has the needed module in the Python
18c250
# standard library.
18c250
rm pymongo/ssl_match_hostname.py
18c250
18c250
%build
18c250
%if %{with python2}
18c250
%py2_build
18c250
%endif # with python2
18c250
18c250
%if %{with python3}
18c250
%py3_build
18c250
18c250
pushd doc
18c250
SPHINXBUILD=sphinx-build-3 make %{?_smp_mflags} html
18c250
popd
18c250
%endif
18c250
18c250
18c250
%install
18c250
%if %{with python2}
18c250
%py2_install
18c250
# Fix permissions
18c250
chmod 755 %{buildroot}%{python2_sitearch}/bson/*.so
18c250
chmod 755 %{buildroot}%{python2_sitearch}/pymongo/*.so
18c250
%endif # with python2
18c250
18c250
%if %{with python3}
18c250
%py3_install
18c250
# Fix permissions
18c250
chmod 755 %{buildroot}%{python3_sitearch}/bson/*.so
18c250
chmod 755 %{buildroot}%{python3_sitearch}/pymongo/*.so
18c250
%endif
18c250
18c250
18c250
%if %{with tests}
18c250
%check
18c250
# For some reason, the tests never think they can connect to mongod on armv7hl even though netstat
18c250
# says it's listening. mongod is not available on big endian arches (ppc64, s390(x)).
18c250
%ifnarch armv7hl ppc64 s390 s390x
18c250
18c250
if [ "$(netstat -ln | grep :27017)" != "" ]
18c250
then
18c250
    pkill mongod
18c250
fi
18c250
18c250
mkdir ./mongod
18c250
mongod --fork --dbpath ./mongod --logpath ./mongod/mongod.log
18c250
# Give MongoDB some time to settle
18c250
while [ "$(netstat -ln | grep :27017)" == "" ]
18c250
do
18c250
    sleep 1
18c250
done
18c250
18c250
%if %{with python2}
18c250
%{__python2} setup.py test || (pkill mongod && exit 1)
18c250
%endif # with python2
18c250
18c250
%if %{with python3}
18c250
%{__python3} setup.py test || (pkill mongod && exit 1)
18c250
%endif
18c250
18c250
pkill mongod
18c250
%endif
18c250
%endif # with tests
18c250
18c250
18c250
%if %{with python3}
18c250
%files doc
18c250
%license LICENSE
18c250
%doc doc/_build/html/*
18c250
%endif
18c250
18c250
%if %{with python2}
18c250
%files -n python2-bson
18c250
%license LICENSE
18c250
%doc README.rst
18c250
%{python2_sitearch}/bson
18c250
%endif # with python2
18c250
18c250
18c250
%if %{with python3}
18c250
%files -n python3-bson
18c250
%license LICENSE
18c250
%doc README.rst
18c250
%{python3_sitearch}/bson
18c250
%endif
18c250
18c250
%if %{with python2}
18c250
%files -n python2-pymongo
18c250
%license LICENSE
18c250
%doc README.rst
18c250
%{python2_sitearch}/pymongo
18c250
%{python2_sitearch}/pymongo-%{version}-*.egg-info
18c250
%endif # with python2
18c250
18c250
18c250
%if %{with python3}
18c250
%files -n python3-pymongo
18c250
%license LICENSE
18c250
%doc README.rst
18c250
%{python3_sitearch}/pymongo
18c250
%{python3_sitearch}/pymongo-%{version}-*.egg-info
18c250
%endif
18c250
18c250
%if %{with python2}
18c250
%files -n python2-pymongo-gridfs
18c250
%license LICENSE
18c250
%doc README.rst
18c250
%{python2_sitearch}/gridfs
18c250
%endif # with python2
18c250
18c250
18c250
%if %{with python3}
18c250
%files -n python3-pymongo-gridfs
18c250
%license LICENSE
18c250
%doc README.rst
18c250
%{python3_sitearch}/gridfs
18c250
%endif
18c250
18c250
18c250
%changelog
9b3fc8
* Fri Oct 09 2020 Lukas Javorsky <ljavorsk@redhat.com> - 3.7.0-1
9b3fc8
- Rebase to 3.7.0
9b3fc8
- Includes new SCRAM-SHA-256 authentication
9b3fc8
  Resolves: rhbz#1879852
9b3fc8
35dcc6
* Fri Jun 07 2019 Tomas Orsava <torsava@redhat.com> - 3.6.1-11
35dcc6
- Fix unversioned python macro that's causing a FTBFS
35dcc6
- Related: rhbz#1678920
35dcc6
18c250
* Thu Apr 25 2019 Tomas Orsava <torsava@redhat.com> - 3.6.1-10
18c250
- Bumping due to problems with modular RPM upgrade path
18c250
- Resolves: rhbz#1695587
18c250
18c250
* Thu Mar 28 2019 Charalampos Stratakis <cstratak@redhat.com> - 3.6.1-9
18c250
- Disable the test suite as mongodb is not available anymore
18c250
18c250
* Tue Oct 09 2018 Lumír Balhar <lbalhar@redhat.com> - 3.6.1-8
18c250
- Remove unversioned provides
18c250
- Resolves: rhbz#1628242
18c250
18c250
* Tue Jul 31 2018 Lumír Balhar <lbalhar@redhat.com> - 3.6.1-7
18c250
- Make possible to disable python3 subpackage
18c250
18c250
* Wed Jul 18 2018 Tomas Orsava <torsava@redhat.com> - 3.6.1-6
18c250
- BuildRequire the python36-devel package when building for the python36 module
18c250
- BuildRequire also python36-rpm-macros as part of the python36 module build
18c250
18c250
* Tue Jun 26 2018 Tomas Orsava <torsava@redhat.com> - 3.6.1-5
18c250
- Fix checking of running mongod - test only open ports (not I-Node number)
18c250
18c250
* Mon Jun 25 2018 Tomas Orsava <torsava@redhat.com> - 3.6.1-4
18c250
- Only build on architectures supported by mongodb in RHEL8
18c250
- Re-enable tests
18c250
18c250
* Tue Jun 19 2018 Charalampos Stratakis <cstratak@redhat.com> - 3.6.1-3
18c250
- Conditionalize the python2 subpackage
18c250
- Conditionalize tests and disable them for now
18c250
18c250
* Thu Jun 14 2018 Tomas Orsava <torsava@redhat.com> - 3.6.1-2
18c250
- Switch to using Python 3 version of sphinx
18c250
18c250
* Sat Mar 10 2018 Randy Barlow <bowlofeggs@fedoraproject.org> - 3.6.1-1
18c250
- Update to 3.6.1 (#1550757).
18c250
- http://api.mongodb.com/python/3.6.1/changelog.html
18c250
18c250
* Mon Feb 19 2018 Marek Skalický <mskalick@redhat.com> - 3.6.0-1
18c250
- Rebase to latest release
18c250
18c250
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.5.1-2
18c250
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
18c250
18c250
* Fri Sep 22 2017 Marek Skalický <mskalick@redhat.com> - 3.5.1-1
18c250
- Update to latest version
18c250
18c250
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.4.0-7
18c250
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
18c250
18c250
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.4.0-6
18c250
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
18c250
18c250
* Fri Jul 07 2017 Igor Gnatenko <ignatenko@redhat.com> - 3.4.0-5
18c250
- Rebuild due to bug in RPM (RHBZ #1468476)
18c250
18c250
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.4.0-4
18c250
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
18c250
18c250
* Fri Jan 06 2017 Randy Barlow <bowlofeggs@fedoraproject.org> - 3.4.0-3
18c250
- Run the test suite in the check section (#1409251).
18c250
18c250
* Tue Dec 20 2016 Miro Hrončok <mhroncok@redhat.com> - 3.4.0-2
18c250
- Rebuild for Python 3.6
18c250
18c250
* Sun Dec 18 2016 Randy Barlow <bowlofeggs@fedoraproject.org> - 3.4.0-1
18c250
- Update to 3.4.0 (#1400227).
18c250
- Use new install macros.
18c250
- Drop unneeded BuildRequires on python-nose.
18c250
- pymongo now requires bson by arch as it should.
18c250
18c250
* Fri Dec 09 2016 Charalampos Stratakis <cstratak@redhat.com> - 3.3.0-6
18c250
- Rebuild for Python 3.6
18c250
18c250
* Tue Nov 29 2016 Dan Horák <dan[at]danny.cz> - 3.3.0-5
18c250
- Update test BRs
18c250
18c250
* Fri Nov 25 2016 Randy Barlow <bowlofeggs@fedoraproject.org> - 3.3.0-4
18c250
- Run the tests with setup.py test instead of with nosetests.
18c250
18c250
* Fri Nov 25 2016 Randy Barlow <bowlofeggs@fedoraproject.org> - 3.3.0-3
18c250
- Run the tests against a live mongod.
18c250
18c250
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.3.0-2
18c250
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
18c250
18c250
* Fri Jul 15 2016 Randy Barlow <bowlofeggs@fedoraproject.org> - 3.3.0-1
18c250
- Update to 3.3.0 (#1356334).
18c250
- Remove the exclude arch on big endian systems, since 3.3.0 now supports them.
18c250
- Use the newer Python build macros.
18c250
- Add a skip test on another test that requires a running mongod.
18c250
- Convert the -doc subpackage into a noarch, as it should be.
18c250
- python2-pymongo-gridfs now requires python2-pymongo(isa) instead of python-pymongo(isa).
18c250
- Build the docs in parallel.
18c250
18c250
* Tue Mar 15 2016 Randy Barlow <rbarlow@redhat.com> - 3.2.2-1
18c250
- Update to 3.2.2 (#1318073).
18c250
18c250
* Wed Feb 03 2016 Randy Barlow <rbarlow@redhat.com> - 3.2.1-1
18c250
- Remove use of needless defattr macros (#1303426).
18c250
- Update to 3.2.1 (#1304137).
18c250
- Remove lots of if statements as this spec file will only be used on Rawhide.
18c250
- Remove dependency on python-backports-ssl_match_hostname as it is not needed in Fedora.
18c250
- Rework the patch for CVE-2013-7440 and CVE-2013-2099 so that it exclusively uses code from Python.
18c250
18c250
* Tue Jan 19 2016 Randy Barlow <rbarlow@redhat.com> - 3.2-1
18c250
- Update to 3.2.
18c250
- Rename the python- subpackages with a python2- prefix.
18c250
- Add a -doc subpackage with built html docs.
18c250
- Skip a few new tests that use MongoDB.
18c250
- Reorganize the spec file a bit.
18c250
- Use the license macro.
18c250
- Pull source from GitHub.
18c250
18c250
* Mon Jan 18 2016 Randy Barlow <rbarlow@redhat.com> - 3.0.3-3
18c250
- Do not use 2to3 for Python 3 (#1294130).
18c250
18c250
* Wed Nov 04 2015 Matej Stuchlik <mstuchli@redhat.com> - 3.0.3-2
18c250
- Rebuilt for Python 3.5
18c250
18c250
* Thu Oct 01 2015 Haïkel Guémar <hguemar@fedoraproject.org> - 3.0.3-1
18c250
- Upstream 3.0.3
18c250
- Fix CVE-2013-7440 (RHBZ#1231231 #1231232)
18c250
18c250
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.5.2-7
18c250
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
18c250
18c250
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.5.2-6
18c250
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
18c250
18c250
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.5.2-5
18c250
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
18c250
18c250
* Wed May 14 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 2.5.2-4
18c250
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4
18c250
18c250
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.5.2-3
18c250
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
18c250
18c250
* Thu Jun 13 2013 Andrew McNabb <amcnabb@mcnabbs.org> - 2.5.2-2
18c250
- Bump the obsoletes version for pymongo-gridfs
18c250
18c250
* Wed Jun 12 2013 Andrew McNabb <amcnabb@mcnabbs.org> - 2.5.2-1
18c250
- Update to pymongo 2.5.2
18c250
18c250
* Tue Jun 11 2013 Andrew McNabb <amcnabb@mcnabbs.org> - 2.5-5
18c250
- Bump the obsoletes version
18c250
18c250
* Wed Apr 24 2013 Andrew McNabb <amcnabb@mcnabbs.org> - 2.5-4
18c250
- Fix the test running procedure
18c250
18c250
* Wed Apr 24 2013 Andrew McNabb <amcnabb@mcnabbs.org> - 2.5-3
18c250
- Exclude tests in pymongo 2.5 that depend on MongoDB
18c250
18c250
* Mon Apr 22 2013 Andrew McNabb <amcnabb@mcnabbs.org> - 2.5-1
18c250
- Update to PyMongo 2.5 (bug #954152)
18c250
18c250
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.3-7
18c250
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
18c250
18c250
* Sat Jan  5 2013 Andrew McNabb <amcnabb@mcnabbs.org> - 2.3-6
18c250
- Fix dependency of python3-pymongo-gridfs (bug #892214)
18c250
18c250
* Tue Nov 27 2012 Andrew McNabb <amcnabb@mcnabbs.org> - 2.3-5
18c250
- Fix the name of the python-pymongo-gridfs subpackage
18c250
18c250
* Tue Nov 27 2012 Andrew McNabb <amcnabb@mcnabbs.org> - 2.3-4
18c250
- Fix obsoletes for python-pymongo-gridfs subpackage
18c250
18c250
* Tue Nov 27 2012 Andrew McNabb <amcnabb@mcnabbs.org> - 2.3-3
18c250
- Fix requires to include the arch, and add docs to all subpackages
18c250
18c250
* Tue Nov 27 2012 Andrew McNabb <amcnabb@mcnabbs.org> - 2.3-2
18c250
- Remove preexisting egg-info
18c250
18c250
* Mon Nov 26 2012 Andrew McNabb <amcnabb@mcnabbs.org> - 2.3-1
18c250
- Rename, update to 2.3, and add support for Python 3
18c250
18c250
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1.1-2
18c250
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
18c250
18c250
* Tue Apr 10 2012 Silas Sewell <silas@sewell.org> - 2.1.1-1
18c250
- Update to 2.1.1
18c250
18c250
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.11-2
18c250
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
18c250
18c250
* Sun Jul 24 2011 Silas Sewell <silas@sewell.org> - 1.11-1
18c250
- Update to 1.11
18c250
18c250
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.9-6
18c250
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
18c250
18c250
* Thu Nov 18 2010 Dan Horák <dan[at]danny.cz> - 1.9-5
18c250
- add ExcludeArch to match mongodb package
18c250
18c250
* Tue Oct 26 2010 Silas Sewell <silas@sewell.ch> - 1.9-4
18c250
- Add comment about multi-license
18c250
18c250
* Thu Oct 21 2010 Silas Sewell <silas@sewell.ch> - 1.9-3
18c250
- Fixed tests so they actually run
18c250
- Change python-devel to python2-devel
18c250
18c250
* Wed Oct 20 2010 Silas Sewell <silas@sewell.ch> - 1.9-2
18c250
- Add check section
18c250
- Use correct .so filter
18c250
- Added python3 stuff (although disabled)
18c250
18c250
* Tue Sep 28 2010 Silas Sewell <silas@sewell.ch> - 1.9-1
18c250
- Update to 1.9
18c250
18c250
* Tue Sep 28 2010 Silas Sewell <silas@sewell.ch> - 1.8.1-1
18c250
- Update to 1.8.1
18c250
18c250
* Sat Dec 05 2009 Silas Sewell <silas@sewell.ch> - 1.1.2-1
18c250
- Initial build