[PATCH rdma-core v1 11/14] redhat: Add pyverbs to RedHat specification

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Noa Osherovich <noaos@xxxxxxxxxxxx>

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

Signed-off-by: Noa Osherovich <noaos@xxxxxxxxxxxx>
Signed-off-by: Alaa Hleihel <alaa@xxxxxxxxxxxx>
Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx>
---
 README.md             |  2 +-
 buildlib/cbuild       | 11 +++++++++--
 redhat/rdma-core.spec | 25 +++++++++++++++++++++++++
 3 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 0594272f..d72b408e 100644
--- a/README.md
+++ b/README.md
@@ -58,7 +58,7 @@ $ apt-get install build-essential cmake gcc libudev-dev libnl-3-dev libnl-route-
 ### Fedora
 
 ```sh
-$ dnf install cmake gcc libnl3-devel libudev-devel pkgconfig valgrind-devel ninja-build
+$ dnf install cmake gcc libnl3-devel libudev-devel pkgconfig valgrind-devel ninja-build python3-devel python3-Cython
 ```
 
 NOTE: Fedora Core uses the name 'ninja-build' for the 'ninja' command.
diff --git a/buildlib/cbuild b/buildlib/cbuild
index 492eee7f..adbe4482 100755
--- a/buildlib/cbuild
+++ b/buildlib/cbuild
@@ -78,6 +78,7 @@ class Environment(object):
     aliases = set();
     use_make = False;
     proxy = True;
+    build_pyverbs = False;
 
     def image_name(self):
         return "build-%s/%s"%(project,self.name);
@@ -110,6 +111,7 @@ class centos6(YumEnvironment):
     use_make = True;
     pandoc = False;
     is_rpm = False;
+    python_cmd = "python";
 
 class centos7(YumEnvironment):
     docker_parent = "centos:7";
@@ -118,9 +120,10 @@ class centos7(YumEnvironment):
     use_make = True;
     pandoc = False;
     specfile = "redhat/rdma-core.spec";
+    python_cmd = "python";
 
 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;
@@ -136,12 +139,13 @@ class centos7_epel(centos7):
 
 class fc29(Environment):
     docker_parent = "fedora:29";
-    pkgs = (centos7.pkgs - {"make", "python-argparse" }) | {"ninja-build","pandoc","perl-generators"};
+    pkgs = (centos7.pkgs - {"make", "python-argparse" }) | {"ninja-build","pandoc","perl-generators","python3-Cython","python3-devel"};
     name = "fc29";
     specfile = "redhat/rdma-core.spec";
     ninja_cmd = "ninja-build";
     is_rpm = True;
     aliases = {"fedora"};
+    build_pyverbs = True;
 
     def get_docker_file(self):
         res = DockerFile(self.docker_parent);
@@ -564,6 +568,9 @@ os.symlink({tarfn!r},os.path.join(b"SOURCES",tarfn));
                 bopts.extend(["--with", arg]);
             for arg in args.without_flags:
                 bopts.extend(["--without", arg]);
+            if "pyverbs" not in args.with_flags + args.without_flags:
+                if env.build_pyverbs:
+                    bopts.extend(["--with", "pyverbs"]);
 
             print >> F,'os.execlp("rpmbuild","rpmbuild",%s)'%(
                 ",".join(repr(I) for I in bopts));
diff --git a/redhat/rdma-core.spec b/redhat/rdma-core.spec
index 14af2a04..a8763e4d 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,12 @@ 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} \
+%else
+	 -DNO_PYVERBS=1
 %endif
          %{EXTRA_CMAKE_FLAGS}
 %make_jobs
@@ -469,3 +489,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




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux