hughesjr / rpms / python-pymongo

Forked from rpms/python-pymongo 5 years ago
Clone

Blame SPECS/python-pymongo.spec

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