#1 Add bootstrap macro
Merged 5 years ago by bowlofeggs. Opened 6 years ago by hhorak.
rpms/ hhorak/python-pymongo add-bootstrap  into  master

file modified
+50 -2
@@ -4,6 +4,9 @@ 

  %filter_setup

  }

  

+ %global bootstrap 0

+ %bcond_without python2

+ 

  Name:           python-pymongo

  Version:        3.7.1

  Release:        2%{?dist}
@@ -22,14 +25,18 @@ 

  %ifnarch armv7hl ppc64 s390 s390x

  # These are needed for tests, and the tests don't work on armv7hl.

  # MongoDB server is not available on big endian arches (ppc64, s390(x)).

+ %if 0%{!?bootstrap:1}

  BuildRequires:  mongodb-server

+ BuildRequires:  python3-sphinx

+ %endif

  BuildRequires:  net-tools

  BuildRequires:  procps-ng

  %endif

- BuildRequires:  python2-tools

+ BuildRequires:  python3-tools

+ %if %{with python2}

  BuildRequires:  python2-devel

  BuildRequires:  python2-setuptools

- BuildRequires:  python2-sphinx

+ %endif

  BuildRequires:  python3-devel

  BuildRequires:  python3-setuptools

  
@@ -47,6 +54,7 @@ 

  Documentation for python-pymongo.

  

  

+ %if %{with python2}

  %package -n python2-bson

  Summary:        Python bson library

  %{?python_provide:%python_provide python2-bson}
@@ -56,6 +64,7 @@ 

  BSON is a binary-encoded serialization of JSON-like documents. BSON is designed

  to be lightweight, traversable, and efficient. BSON, like JSON, supports the

  embedding of objects and arrays within other objects and arrays.

+ %endif

  

  

  %package -n python3-bson
@@ -70,6 +79,7 @@ 

  contains the python3 version of this module.

  

  

+ %if %{with python2}

  %package -n python2-pymongo

  Summary:        Python driver for MongoDB

  
@@ -82,6 +92,7 @@ 

  %description -n python2-pymongo

  The Python driver for MongoDB.  This package contains the python2 version of

  this module.

+ %endif

  

  

  %package -n python3-pymongo
@@ -95,6 +106,7 @@ 

  this module.

  

  

+ %if %{with python2}

  %package -n python2-pymongo-gridfs

  Summary:        Python GridFS driver for MongoDB

  Requires:       python2-pymongo%{?_isa} = %{version}-%{release}
@@ -105,6 +117,7 @@ 

  

  %description -n python2-pymongo-gridfs

  GridFS is a storage specification for large objects in MongoDB.

+ %endif

  

  

  %package -n python3-pymongo-gridfs
@@ -127,40 +140,57 @@ 

  # standard library.

  rm pymongo/ssl_match_hostname.py

  

+ %if %{with python2}

  rm -rf %{py3dir}

  cp -a . %{py3dir}

+ %endif

  

  

  %build

+ %if %{with python2}

  %py2_build

+ %endif

  

+ %if %{with python2}

  pushd %{py3dir}

+ %endif

  %py3_build

+ %if %{with python2}

  popd

+ %endif

  

+ %if 0%{!?bootstrap:1}

  pushd doc

  make %{?_smp_mflags} html

  popd

+ %endif

  

  

  %install

+ %if %{with python2}

  %py2_install

  # Fix permissions

  chmod 755 %{buildroot}%{python2_sitearch}/bson/*.so

  chmod 755 %{buildroot}%{python2_sitearch}/pymongo/*.so

+ %endif

  

+ %if %{with python2}

  pushd %{py3dir}

+ %endif

  %py3_install

  # Fix permissions

  chmod 755 %{buildroot}%{python3_sitearch}/bson/*.so

  chmod 755 %{buildroot}%{python3_sitearch}/pymongo/*.so

+ %if %{with python2}

  popd

+ %endif

  

  

  %check

  # For some reason, the tests never think they can connect to mongod on armv7hl even though netstat

  # says it's listening. mongod is not available on big endian arches (ppc64, s390(x)).

  %ifnarch armv7hl ppc64 s390 s390x

+ %if 0%{!?bootstrap:1}

  

  if [ "$(netstat -ln | grep :27017)" != "" ]

  then
@@ -175,25 +205,36 @@ 

      sleep 1

  done

  

+ %if %{with python2}

  python2 setup.py test || (pkill mongod && exit 1)

+ %endif

  

+ %if %{with python2}

  pushd %{py3dir}

+ %endif

  python3 setup.py test || (pkill mongod && exit 1)

+ %if %{with python2}

  popd

+ %endif

  

  pkill mongod

  %endif

+ %endif

  

  

  %files doc

  %license LICENSE

+ %if 0%{!?bootstrap:1}

  %doc doc/_build/html/*

+ %endif

  

  

+ %if %{with python2}

  %files -n python2-bson

  %license LICENSE

  %doc README.rst

  %{python2_sitearch}/bson

+ %endif

  

  

  %files -n python3-bson
@@ -202,11 +243,13 @@ 

  %{python3_sitearch}/bson

  

  

+ %if %{with python2}

  %files -n python2-pymongo

  %license LICENSE

  %doc README.rst

  %{python2_sitearch}/pymongo

  %{python2_sitearch}/pymongo-%{version}-*.egg-info

+ %endif

  

  

  %files -n python3-pymongo
@@ -216,10 +259,12 @@ 

  %{python3_sitearch}/pymongo-%{version}-*.egg-info

  

  

+ %if %{with python2}

  %files -n python2-pymongo-gridfs

  %license LICENSE

  %doc README.rst

  %{python2_sitearch}/gridfs

+ %endif

  

  

  %files -n python3-pymongo-gridfs
@@ -229,6 +274,9 @@ 

  

  

  %changelog

+ * Mon Dec 10 2018 Honza Horak <hhorak@redhat.com> - 3.7.1-3

+ - Add bootstrap macro and python2 condition

+ 

  * Tue Jul 31 2018 Florian Weimer <fweimer@redhat.com> - 3.7.1-2

  - Rebuild with fixed binutils

  

There is a circular dependency between pymongo and mongodb-server, that must be broken for bootstrapping. Adding a macro allows to perform the bootstrap by setting the macro only.

Thanks for the fix.

In f26 branch there is a similar macro which is used to break build-dep cycle during module build [1]
_module_build macro is more confusing, on the other hand cycle is broken by default for modules. So I am thinking if bootstrap is right macro name. @hhorak What do you think?
Or add %if and if _module_build is defined set bootstrap to 1?

[1] https://src.fedoraproject.org/rpms/python-pymongo/c/1bec8e56902647dcf20c8ed4bb2793ad18b589a7?branch=f26

@hhorak do you still want to work on this?

Hm, this went out of my sight, but yes, I'd love to finish this. About using %{_module_build} macro, I was thinking about using the following definition:

%global bootstrap 0%{?_module_build}

But that would mean to not run tests in the module build, which is probably not what we want. I expect that in modular builds, one would reference the python-pymongo twice, first time pointing to a hash/branch that has the buildroot macro set to 1 and second time to 0. So, the updated commit does not use %{?_module_build}.

rebased onto aba0a39

5 years ago

rebased onto c0b8e83

5 years ago

I'll welcome any feedback, if there is none I'll merge it.

Hope it's ok to merge now. However, I don't have commit access. Anybody from committers can merge this, please?

Pull-Request has been merged by bowlofeggs

5 years ago