diff mbox series

[rdma-core,07/10] redhat: Add pyverbs to RedHat specification

Message ID 20181113033139.4847-8-leon@kernel.org (mailing list archive)
State Superseded
Headers show
Series Python binding for rdma-core | expand

Commit Message

Leon Romanovsky Nov. 13, 2018, 3:31 a.m. UTC
From: Noa Osherovich <noaos@mellanox.com>

Update spec file and cbuild dependencies to allow pyverbs to be
included in RedHat-based distributions.

Signed-off-by: Noa Osherovich <noaos@mellanox.com>
Signed-off-by: Alaa Hleihel <alaa@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 buildlib/cbuild       |  4 ++--
 redhat/rdma-core.spec | 23 +++++++++++++++++++++++
 2 files changed, 25 insertions(+), 2 deletions(-)

--
2.19.1

Comments

Jarod Wilson Nov. 14, 2018, 6:07 p.m. UTC | #1
Hm... So CentOS 7 and it's progenitor are both still python2-based,
and I'm not seeing where a python3-Cython package would be coming
from, so I'm not so sure you want to default to python3 for el7. I'd
default to python2 there, and it's possible that package won't be
built in el7's native/shipping rdma-core packages, due to missing
build dependencies in the distro itself. You should be fine defaulting
to python3 for anything newer, but again, need to make sure new
dependencies actually exist in the target distribution.
On Mon, Nov 12, 2018 at 7:32 PM Leon Romanovsky <leon@kernel.org> wrote:
>
> From: Noa Osherovich <noaos@mellanox.com>
>
> Update spec file and cbuild dependencies to allow pyverbs to be
> included in RedHat-based distributions.
>
> Signed-off-by: Noa Osherovich <noaos@mellanox.com>
> Signed-off-by: Alaa Hleihel <alaa@mellanox.com>
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> ---
>  buildlib/cbuild       |  4 ++--
>  redhat/rdma-core.spec | 23 +++++++++++++++++++++++
>  2 files changed, 25 insertions(+), 2 deletions(-)
>
> diff --git a/buildlib/cbuild b/buildlib/cbuild
> index 1cc54f31..098bea23 100755
> --- a/buildlib/cbuild
> +++ b/buildlib/cbuild
> @@ -119,7 +119,7 @@ class centos7(YumEnvironment):
>      specfile = "redhat/rdma-core.spec";
>
>  class centos7_epel(centos7):
> -    pkgs = (centos7.pkgs - {"cmake","make"}) | {"ninja-build","cmake3","pandoc"};
> +    pkgs = (centos7.pkgs - {"cmake","make"}) | {"ninja-build","cmake3","pandoc", 'python3-Cython', 'python3-devel'};
>      name = "centos7_epel";
>      use_make = False;
>      pandoc = True;
> @@ -135,7 +135,7 @@ class centos7_epel(centos7):
>
>  class fc28(Environment):
>      docker_parent = "fedora:28";
> -    pkgs = (centos7.pkgs - {"make"}) | {"ninja-build","pandoc","perl-generators"};
> +    pkgs = (centos7.pkgs - {"make"}) | {"ninja-build","pandoc","perl-generators","python3-Cython","python3-devel"};
>      name = "fc28";
>      specfile = "redhat/rdma-core.spec";
>      ninja_cmd = "ninja-build";
> diff --git a/redhat/rdma-core.spec b/redhat/rdma-core.spec
> index 644c3ffd..422ac010 100644
> --- a/redhat/rdma-core.spec
> +++ b/redhat/rdma-core.spec
> @@ -23,7 +23,13 @@ BuildRequires: pkgconfig(libnl-route-3.0)
>  BuildRequires: valgrind-devel
>  BuildRequires: systemd
>  BuildRequires: systemd-devel
> +%define with_pyverbs %{?_with_pyverbs: 1} %{?!_with_pyverbs: 0}
> +%if %{with_pyverbs}
> +BuildRequires: python3-devel
> +BuildRequires: python3-Cython
> +%else
>  BuildRequires: python
> +%endif
>  %if 0%{?fedora} >= 21
>  BuildRequires: perl-generators
>  %endif
> @@ -211,6 +217,14 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
>  In conjunction with the kernel ib_srp driver, srp_daemon allows you to
>  discover and use SCSI devices via the SCSI RDMA Protocol over InfiniBand.
>
> +%package -n python3-pyverbs
> +Summary: Python3 API over IB verbs
> +%{?python_provide:%python_provide python3-pyverbs}
> +
> +%description -n python3-pyverbs
> +Pyverbs is a Cython-based Python API over libibverbs, providing an
> +easy, object-oriented access to IB verbs.
> +
>  %prep
>  %setup
>
> @@ -244,6 +258,10 @@ discover and use SCSI devices via the SCSI RDMA Protocol over InfiniBand.
>           -DCMAKE_INSTALL_UDEV_RULESDIR:PATH=%{_udevrulesdir} \
>  %if %{with_static}
>           -DENABLE_STATIC=1 \
> +%endif
> +%if %{with_pyverbs}
> +         -DPYTHON_EXECUTABLE:PATH=%{__python3} \
> +         -DCMAKE_INSTALL_PYTHON_ARCH_LIB:PATH=%{python3_sitearch} \
>  %endif
>           %{EXTRA_CMAKE_FLAGS}
>  %make_jobs
> @@ -469,3 +487,8 @@ rm -rf %{buildroot}/%{_sbindir}/srp_daemon.sh
>  %{_mandir}/man5/srp_daemon.service.5*
>  %{_mandir}/man5/srp_daemon_port@.service.5*
>  %doc %{_docdir}/%{name}-%{version}/ibsrpdm.md
> +
> +%if %{with_pyverbs}
> +%files -n python3-pyverbs
> +%{python3_sitearch}/pyverbs
> +%endif
> --
> 2.19.1
>
Leon Romanovsky Nov. 14, 2018, 6:20 p.m. UTC | #2
On Wed, Nov 14, 2018 at 10:07:44AM -0800, Jarod Wilson wrote:
> Hm... So CentOS 7 and it's progenitor are both still python2-based,
> and I'm not seeing where a python3-Cython package would be coming
> from, so I'm not so sure you want to default to python3 for el7. I'd
> default to python2 there, and it's possible that package won't be
> built in el7's native/shipping rdma-core packages, due to missing
> build dependencies in the distro itself. You should be fine defaulting
> to python3 for anything newer, but again, need to make sure new
> dependencies actually exist in the target distribution.

Am I need to add similar to fedora checks ("%if 0%{?fedora} >= 25") to
ensure that?

Thanks

> On Mon, Nov 12, 2018 at 7:32 PM Leon Romanovsky <leon@kernel.org> wrote:
> >
> > From: Noa Osherovich <noaos@mellanox.com>
> >
> > Update spec file and cbuild dependencies to allow pyverbs to be
> > included in RedHat-based distributions.
> >
> > Signed-off-by: Noa Osherovich <noaos@mellanox.com>
> > Signed-off-by: Alaa Hleihel <alaa@mellanox.com>
> > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> > ---
> >  buildlib/cbuild       |  4 ++--
> >  redhat/rdma-core.spec | 23 +++++++++++++++++++++++
> >  2 files changed, 25 insertions(+), 2 deletions(-)
> >
> > diff --git a/buildlib/cbuild b/buildlib/cbuild
> > index 1cc54f31..098bea23 100755
> > --- a/buildlib/cbuild
> > +++ b/buildlib/cbuild
> > @@ -119,7 +119,7 @@ class centos7(YumEnvironment):
> >      specfile = "redhat/rdma-core.spec";
> >
> >  class centos7_epel(centos7):
> > -    pkgs = (centos7.pkgs - {"cmake","make"}) | {"ninja-build","cmake3","pandoc"};
> > +    pkgs = (centos7.pkgs - {"cmake","make"}) | {"ninja-build","cmake3","pandoc", 'python3-Cython', 'python3-devel'};
> >      name = "centos7_epel";
> >      use_make = False;
> >      pandoc = True;
> > @@ -135,7 +135,7 @@ class centos7_epel(centos7):
> >
> >  class fc28(Environment):
> >      docker_parent = "fedora:28";
> > -    pkgs = (centos7.pkgs - {"make"}) | {"ninja-build","pandoc","perl-generators"};
> > +    pkgs = (centos7.pkgs - {"make"}) | {"ninja-build","pandoc","perl-generators","python3-Cython","python3-devel"};
> >      name = "fc28";
> >      specfile = "redhat/rdma-core.spec";
> >      ninja_cmd = "ninja-build";
> > diff --git a/redhat/rdma-core.spec b/redhat/rdma-core.spec
> > index 644c3ffd..422ac010 100644
> > --- a/redhat/rdma-core.spec
> > +++ b/redhat/rdma-core.spec
> > @@ -23,7 +23,13 @@ BuildRequires: pkgconfig(libnl-route-3.0)
> >  BuildRequires: valgrind-devel
> >  BuildRequires: systemd
> >  BuildRequires: systemd-devel
> > +%define with_pyverbs %{?_with_pyverbs: 1} %{?!_with_pyverbs: 0}
> > +%if %{with_pyverbs}
> > +BuildRequires: python3-devel
> > +BuildRequires: python3-Cython
> > +%else
> >  BuildRequires: python
> > +%endif
> >  %if 0%{?fedora} >= 21
> >  BuildRequires: perl-generators
> >  %endif
> > @@ -211,6 +217,14 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
> >  In conjunction with the kernel ib_srp driver, srp_daemon allows you to
> >  discover and use SCSI devices via the SCSI RDMA Protocol over InfiniBand.
> >
> > +%package -n python3-pyverbs
> > +Summary: Python3 API over IB verbs
> > +%{?python_provide:%python_provide python3-pyverbs}
> > +
> > +%description -n python3-pyverbs
> > +Pyverbs is a Cython-based Python API over libibverbs, providing an
> > +easy, object-oriented access to IB verbs.
> > +
> >  %prep
> >  %setup
> >
> > @@ -244,6 +258,10 @@ discover and use SCSI devices via the SCSI RDMA Protocol over InfiniBand.
> >           -DCMAKE_INSTALL_UDEV_RULESDIR:PATH=%{_udevrulesdir} \
> >  %if %{with_static}
> >           -DENABLE_STATIC=1 \
> > +%endif
> > +%if %{with_pyverbs}
> > +         -DPYTHON_EXECUTABLE:PATH=%{__python3} \
> > +         -DCMAKE_INSTALL_PYTHON_ARCH_LIB:PATH=%{python3_sitearch} \
> >  %endif
> >           %{EXTRA_CMAKE_FLAGS}
> >  %make_jobs
> > @@ -469,3 +487,8 @@ rm -rf %{buildroot}/%{_sbindir}/srp_daemon.sh
> >  %{_mandir}/man5/srp_daemon.service.5*
> >  %{_mandir}/man5/srp_daemon_port@.service.5*
> >  %doc %{_docdir}/%{name}-%{version}/ibsrpdm.md
> > +
> > +%if %{with_pyverbs}
> > +%files -n python3-pyverbs
> > +%{python3_sitearch}/pyverbs
> > +%endif
> > --
> > 2.19.1
> >
diff mbox series

Patch

diff --git a/buildlib/cbuild b/buildlib/cbuild
index 1cc54f31..098bea23 100755
--- a/buildlib/cbuild
+++ b/buildlib/cbuild
@@ -119,7 +119,7 @@  class centos7(YumEnvironment):
     specfile = "redhat/rdma-core.spec";

 class centos7_epel(centos7):
-    pkgs = (centos7.pkgs - {"cmake","make"}) | {"ninja-build","cmake3","pandoc"};
+    pkgs = (centos7.pkgs - {"cmake","make"}) | {"ninja-build","cmake3","pandoc", 'python3-Cython', 'python3-devel'};
     name = "centos7_epel";
     use_make = False;
     pandoc = True;
@@ -135,7 +135,7 @@  class centos7_epel(centos7):

 class fc28(Environment):
     docker_parent = "fedora:28";
-    pkgs = (centos7.pkgs - {"make"}) | {"ninja-build","pandoc","perl-generators"};
+    pkgs = (centos7.pkgs - {"make"}) | {"ninja-build","pandoc","perl-generators","python3-Cython","python3-devel"};
     name = "fc28";
     specfile = "redhat/rdma-core.spec";
     ninja_cmd = "ninja-build";
diff --git a/redhat/rdma-core.spec b/redhat/rdma-core.spec
index 644c3ffd..422ac010 100644
--- a/redhat/rdma-core.spec
+++ b/redhat/rdma-core.spec
@@ -23,7 +23,13 @@  BuildRequires: pkgconfig(libnl-route-3.0)
 BuildRequires: valgrind-devel
 BuildRequires: systemd
 BuildRequires: systemd-devel
+%define with_pyverbs %{?_with_pyverbs: 1} %{?!_with_pyverbs: 0}
+%if %{with_pyverbs}
+BuildRequires: python3-devel
+BuildRequires: python3-Cython
+%else
 BuildRequires: python
+%endif
 %if 0%{?fedora} >= 21
 BuildRequires: perl-generators
 %endif
@@ -211,6 +217,14 @@  Requires: %{name}%{?_isa} = %{version}-%{release}
 In conjunction with the kernel ib_srp driver, srp_daemon allows you to
 discover and use SCSI devices via the SCSI RDMA Protocol over InfiniBand.

+%package -n python3-pyverbs
+Summary: Python3 API over IB verbs
+%{?python_provide:%python_provide python3-pyverbs}
+
+%description -n python3-pyverbs
+Pyverbs is a Cython-based Python API over libibverbs, providing an
+easy, object-oriented access to IB verbs.
+
 %prep
 %setup

@@ -244,6 +258,10 @@  discover and use SCSI devices via the SCSI RDMA Protocol over InfiniBand.
          -DCMAKE_INSTALL_UDEV_RULESDIR:PATH=%{_udevrulesdir} \
 %if %{with_static}
          -DENABLE_STATIC=1 \
+%endif
+%if %{with_pyverbs}
+         -DPYTHON_EXECUTABLE:PATH=%{__python3} \
+         -DCMAKE_INSTALL_PYTHON_ARCH_LIB:PATH=%{python3_sitearch} \
 %endif
          %{EXTRA_CMAKE_FLAGS}
 %make_jobs
@@ -469,3 +487,8 @@  rm -rf %{buildroot}/%{_sbindir}/srp_daemon.sh
 %{_mandir}/man5/srp_daemon.service.5*
 %{_mandir}/man5/srp_daemon_port@.service.5*
 %doc %{_docdir}/%{name}-%{version}/ibsrpdm.md
+
+%if %{with_pyverbs}
+%files -n python3-pyverbs
+%{python3_sitearch}/pyverbs
+%endif