From a89aee499ac7229561ff760eecb029872f010c78 Mon Sep 17 00:00:00 2001 From: Don Penney Date: Mon, 22 Oct 2018 16:48:38 -0400 Subject: [PATCH] Add hooks for python wheel generation This update adds hooks to the spec files for the following packages to generate wheels for the python modules: - ceph-manager - libvirt-python - logmgmt - platform-util - python-3parclient - python-cephclient - python-lefthandclient - python-ryu - vm-topology Change-Id: Ia63291e686818d19d0df52ff26b5f0bb3812b8ce Story: 2003907 Task: 26787 Signed-off-by: Don Penney --- centos_wheels.inc | 9 +++ ceph/ceph-manager/centos/ceph-manager.spec | 14 ++++ .../centos/python-cephclient.spec | 13 ++++ logging/logmgmt/centos/logmgmt.spec | 14 ++++ networking/python-ryu/centos/python-ryu.spec | 14 ++++ .../centos/python-3parclient.spec | 14 ++++ .../centos/python-lefthandclient.spec | 14 ++++ tools/vm-topology/centos/vm-topology.spec | 14 +++- .../platform-util/centos/platform-util.spec | 14 ++++ virt/libvirt-python/centos/build_srpm.data | 2 +- .../0002-Build-python-wheel.patch | 72 +++++++++++++++++++ .../centos/meta_patches/PATCH_ORDER | 1 + ...tup-import-to-support-building-wheel.patch | 25 +++++++ 13 files changed, 218 insertions(+), 2 deletions(-) create mode 100644 centos_wheels.inc create mode 100644 virt/libvirt-python/centos/meta_patches/0002-Build-python-wheel.patch create mode 100644 virt/libvirt-python/centos/patches/0001-Fix-setup-import-to-support-building-wheel.patch diff --git a/centos_wheels.inc b/centos_wheels.inc new file mode 100644 index 000000000..b54f5d310 --- /dev/null +++ b/centos_wheels.inc @@ -0,0 +1,9 @@ +ceph-manager-wheels +libvirt-python-wheels +logmgmt-wheels +platform-util-wheels +python-3parclient-wheels +python-cephclient-wheels +python-lefthandclient-wheels +python-ryu-wheels +vm-topology-wheels diff --git a/ceph/ceph-manager/centos/ceph-manager.spec b/ceph/ceph-manager/centos/ceph-manager.spec index 2f54deb5f..068855826 100644 --- a/ceph/ceph-manager/centos/ceph-manager.spec +++ b/ceph/ceph-manager/centos/ceph-manager.spec @@ -9,6 +9,8 @@ URL: unknown Source0: %{name}-%{version}.tar.gz BuildRequires: python-setuptools +BuildRequires: python2-pip +BuildRequires: python2-wheel BuildRequires: systemd-units BuildRequires: systemd-devel Requires: sysinv @@ -31,6 +33,7 @@ Handle sysinv RPC calls for long running Ceph API operations: %build %{__python} setup.py build +%py2_build_wheel %install %{__python} setup.py install --root=$RPM_BUILD_ROOT \ @@ -38,6 +41,8 @@ Handle sysinv RPC calls for long running Ceph API operations: --prefix=/usr \ --install-data=/usr/share \ --single-version-externally-managed +mkdir -p $RPM_BUILD_ROOT/wheels +install -m 644 dist/*.whl $RPM_BUILD_ROOT/wheels/ install -d -m 755 %{buildroot}%{local_etc_initd} install -p -D -m 700 scripts/init.d/ceph-manager %{buildroot}%{local_etc_initd}/ceph-manager @@ -68,3 +73,12 @@ rm -rf $RPM_BUILD_ROOT %{pythonroot}/ceph_manager/* %dir %{pythonroot}/ceph_manager-%{version}.0-py2.7.egg-info %{pythonroot}/ceph_manager-%{version}.0-py2.7.egg-info/* + +%package wheels +Summary: %{name} wheels + +%description wheels +Contains python wheels for %{name} + +%files wheels +/wheels/* diff --git a/ceph/python-cephclient/centos/python-cephclient.spec b/ceph/python-cephclient/centos/python-cephclient.spec index 9c1cd22bf..d31c3f4bd 100644 --- a/ceph/python-cephclient/centos/python-cephclient.spec +++ b/ceph/python-cephclient/centos/python-cephclient.spec @@ -25,6 +25,8 @@ BuildArch: noarch BuildRequires: python BuildRequires: ceph +BuildRequires: python2-pip +BuildRequires: python2-wheel Requires: python @@ -44,9 +46,12 @@ rm -f requirements.txt %build %{__python2} setup.py build +%py2_build_wheel %install %{__python2} setup.py install --skip-build --root %{buildroot} +mkdir -p $RPM_BUILD_ROOT/wheels +install -m 644 dist/*.whl $RPM_BUILD_ROOT/wheels/ %files %doc README.rst @@ -54,3 +59,11 @@ rm -f requirements.txt %{python2_sitelib}/cephclient %{python2_sitelib}/*.egg-info +%package wheels +Summary: %{name} wheels + +%description wheels +Contains python wheels for %{name} + +%files wheels +/wheels/* diff --git a/logging/logmgmt/centos/logmgmt.spec b/logging/logmgmt/centos/logmgmt.spec index 8f544c788..c52fcd10d 100644 --- a/logging/logmgmt/centos/logmgmt.spec +++ b/logging/logmgmt/centos/logmgmt.spec @@ -10,6 +10,8 @@ Source0: %{name}-%{version}.tar.gz Source1: LICENSE BuildRequires: python-setuptools +BuildRequires: python2-pip +BuildRequires: python2-wheel BuildRequires: systemd-devel Requires: systemd Requires: python-daemon @@ -32,6 +34,7 @@ rm -rf *.egg-info %build %{__python} setup.py build +%py2_build_wheel %install %{__python} setup.py install --root=$RPM_BUILD_ROOT \ @@ -39,6 +42,8 @@ rm -rf *.egg-info --prefix=/usr \ --install-data=/usr/share \ --single-version-externally-managed +mkdir -p $RPM_BUILD_ROOT/wheels +install -m 644 dist/*.whl $RPM_BUILD_ROOT/wheels/ install -d -m 755 %{buildroot}%{local_bindir} install -p -D -m 700 scripts/bin/logmgmt %{buildroot}%{local_bindir}/logmgmt @@ -71,3 +76,12 @@ rm -rf $RPM_BUILD_ROOT %{pythonroot}/%{name}/* %dir %{pythonroot}/%{name}-%{version}.0-py2.7.egg-info %{pythonroot}/%{name}-%{version}.0-py2.7.egg-info/* + +%package wheels +Summary: %{name} wheels + +%description wheels +Contains python wheels for %{name} + +%files wheels +/wheels/* diff --git a/networking/python-ryu/centos/python-ryu.spec b/networking/python-ryu/centos/python-ryu.spec index 18c5a77aa..917642a6b 100755 --- a/networking/python-ryu/centos/python-ryu.spec +++ b/networking/python-ryu/centos/python-ryu.spec @@ -41,6 +41,8 @@ Requires: python-webob Requires: python-%{pypi_name}-common = %{version}-%{release} BuildRequires: python2-devel +BuildRequires: python2-pip +BuildRequires: python2-wheel BuildRequires: python-debtcollector BuildRequires: python-eventlet BuildRequires: python-greenlet @@ -153,6 +155,7 @@ rm -rf %{pypi_name}/tests/integrated/common %build export PBR_VERSION=%{version} %py2_build +%py2_build_wheel %if 0%{?with_python3} %py3_build %endif @@ -174,6 +177,8 @@ for bin in %{pypi_name}{,-manager}; do ln -s ./$bin-%{python2_version} %{buildroot}%{_bindir}/$bin-2 ln -s ./$bin-%{python2_version} %{buildroot}%{_bindir}/$bin done; +mkdir -p $RPM_BUILD_ROOT/wheels +install -m 644 dist/*.whl $RPM_BUILD_ROOT/wheels/ install -d -m 755 %{buildroot}%{_sysconfdir}/%{pypi_name} @@ -224,6 +229,15 @@ PYTHON=%{__python2} ./run_tests.sh -N -P %license LICENSE %{python2_sitelib}/%{pypi_name}/tests +%package wheels +Summary: %{name} wheels + +%description wheels +Contains python wheels for %{name} + +%files wheels +/wheels/* + %changelog * Tue Jul 04 2017 Matt Peters - 4.15-0 - Upstream 4.15 and Titanium versioning diff --git a/storage-drivers/python-3parclient/centos/python-3parclient.spec b/storage-drivers/python-3parclient/centos/python-3parclient.spec index e0b287b25..395019f78 100644 --- a/storage-drivers/python-3parclient/centos/python-3parclient.spec +++ b/storage-drivers/python-3parclient/centos/python-3parclient.spec @@ -15,6 +15,8 @@ Url: http://packages.python.org/python-3parclient BuildRequires: python2-devel BuildRequires: python-setuptools +BuildRequires: python2-pip +BuildRequires: python2-wheel %description HPE 3PAR HTTP REST Client @@ -24,12 +26,24 @@ HPE 3PAR HTTP REST Client %build %{__python2} setup.py build +%py2_build_wheel %install %{__python2} setup.py install -O1 --skip-build --root %{buildroot} --record=INSTALLED_FILES +mkdir -p $RPM_BUILD_ROOT/wheels +install -m 644 dist/*.whl $RPM_BUILD_ROOT/wheels/ %clean rm -rf %{buildroot} %files -f INSTALLED_FILES %defattr(-,root,root) + +%package wheels +Summary: %{name} wheels + +%description wheels +Contains python wheels for %{name} + +%files wheels +/wheels/* diff --git a/storage-drivers/python-lefthandclient/centos/python-lefthandclient.spec b/storage-drivers/python-lefthandclient/centos/python-lefthandclient.spec index 21312d560..e615841d8 100644 --- a/storage-drivers/python-lefthandclient/centos/python-lefthandclient.spec +++ b/storage-drivers/python-lefthandclient/centos/python-lefthandclient.spec @@ -17,6 +17,8 @@ Url: http://packages.python.org/python-lefthandclient BuildRequires: python2-devel BuildRequires: python-setuptools +BuildRequires: python2-pip +BuildRequires: python2-wheel %description HPE LeftHand/StoreVirtual HTTP REST Client @@ -26,12 +28,24 @@ HPE LeftHand/StoreVirtual HTTP REST Client %build %{__python2} setup.py build +%py2_build_wheel %install %{__python2} setup.py install -O1 --skip-build --root %{buildroot} --record=INSTALLED_FILES +mkdir -p $RPM_BUILD_ROOT/wheels +install -m 644 dist/*.whl $RPM_BUILD_ROOT/wheels/ %clean rm -rf %{buildroot} %files -f INSTALLED_FILES %defattr(-,root,root) + +%package wheels +Summary: %{name} wheels + +%description wheels +Contains python wheels for %{name} + +%files wheels +/wheels/* diff --git a/tools/vm-topology/centos/vm-topology.spec b/tools/vm-topology/centos/vm-topology.spec index 236825652..d844a4db7 100644 --- a/tools/vm-topology/centos/vm-topology.spec +++ b/tools/vm-topology/centos/vm-topology.spec @@ -15,6 +15,8 @@ BuildArch: noarch BuildRequires: python BuildRequires: python-setuptools +BuildRequires: python2-pip +BuildRequires: python2-wheel BuildRequires: python-keyring BuildRequires: libvirt @@ -35,10 +37,12 @@ rm -f requirements.txt %build %{__python2} setup.py build +%py2_build_wheel %install %{__python2} setup.py install --skip-build --root %{buildroot} - +mkdir -p $RPM_BUILD_ROOT/wheels +install -m 644 dist/*.whl $RPM_BUILD_ROOT/wheels/ %files %defattr(-,root,root,-) @@ -47,3 +51,11 @@ rm -f requirements.txt %{python2_sitelib}/vm_topology %{python2_sitelib}/*.egg-info +%package wheels +Summary: %{name} wheels + +%description wheels +Contains python wheels for %{name} + +%files wheels +/wheels/* diff --git a/utilities/platform-util/centos/platform-util.spec b/utilities/platform-util/centos/platform-util.spec index 946b33da5..8b04c97c6 100644 --- a/utilities/platform-util/centos/platform-util.spec +++ b/utilities/platform-util/centos/platform-util.spec @@ -10,6 +10,8 @@ BuildArch: noarch Source: %name-%version.tar.gz BuildRequires: python-setuptools +BuildRequires: python2-pip +BuildRequires: python2-wheel %description Platform utilities @@ -36,6 +38,7 @@ Platform utilities that packaged on controllers or one node system %build %{__python} setup.py build +%py2_build_wheel %install %{__python} setup.py install --root=$RPM_BUILD_ROOT \ @@ -43,6 +46,8 @@ Platform utilities that packaged on controllers or one node system --prefix=/usr \ --install-data=/usr/share \ --single-version-externally-managed +mkdir -p $RPM_BUILD_ROOT/wheels +install -m 644 dist/*.whl $RPM_BUILD_ROOT/wheels/ %global _buildsubdir %{_builddir}/%{name}-%{version} install -d %{buildroot}%{local_bindir} @@ -96,3 +101,12 @@ systemctl enable opt-platform.service %files -n platform-util-controller %defattr(-,root,root,-) /etc/systemd/system/memcached.service + +%package wheels +Summary: %{name} wheels + +%description wheels +Contains python wheels for %{name} + +%files wheels +/wheels/* diff --git a/virt/libvirt-python/centos/build_srpm.data b/virt/libvirt-python/centos/build_srpm.data index 8aeb55368..70b4b5dcb 100644 --- a/virt/libvirt-python/centos/build_srpm.data +++ b/virt/libvirt-python/centos/build_srpm.data @@ -1 +1 @@ -TIS_PATCH_VER=1 +TIS_PATCH_VER=2 diff --git a/virt/libvirt-python/centos/meta_patches/0002-Build-python-wheel.patch b/virt/libvirt-python/centos/meta_patches/0002-Build-python-wheel.patch new file mode 100644 index 000000000..49ca8c028 --- /dev/null +++ b/virt/libvirt-python/centos/meta_patches/0002-Build-python-wheel.patch @@ -0,0 +1,72 @@ +From 6f9c900059e3065081fccb19bd8c135036df5fe9 Mon Sep 17 00:00:00 2001 +From: Don Penney +Date: Wed, 17 Oct 2018 15:25:33 -0400 +Subject: [PATCH] Build python wheel + +--- + SPECS/libvirt-python.spec | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/SPECS/libvirt-python.spec b/SPECS/libvirt-python.spec +index 475bb0a..7a01e94 100644 +--- a/SPECS/libvirt-python.spec ++++ b/SPECS/libvirt-python.spec +@@ -36,6 +36,7 @@ Name: libvirt-python + Version: 4.7.0 + Release: 1%{?_tis_dist}.%{tis_patch_ver} + Source0: http://libvirt.org/sources/python/%{name}-%{version}.tar.gz ++Patch0: 0001-Fix-setup-import-to-support-building-wheel.patch + Url: http://libvirt.org + License: LGPLv2+ + BuildRequires: libvirt-devel == %{version} +@@ -44,6 +45,8 @@ BuildRequires: libvirt-devel == %{version} + BuildRequires: python2-devel + BuildRequires: python2-nose + BuildRequires: python2-lxml ++BuildRequires: python2-pip ++BuildRequires: python2-wheel + %else + BuildRequires: python-devel + BuildRequires: python-nose +@@ -106,6 +109,7 @@ of recent versions of Linux (and other OSes). + + %prep + %setup -q ++%patch0 -p1 + + # Unset execute bit for example scripts; it can introduce spurious + # RPM dependencies, like /usr/bin/python which can pull in python2 +@@ -120,6 +124,7 @@ exit 1 + + %if %{with_python2} + CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py build ++%py2_build_wheel + %endif + %if %{with_python3} + CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build +@@ -128,6 +133,8 @@ CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build + %install + %if %{with_python2} + %{__python2} setup.py install --skip-build --root=%{buildroot} ++mkdir -p $RPM_BUILD_ROOT/wheels ++install -m 644 dist/*.whl $RPM_BUILD_ROOT/wheels/ + %endif + %if %{with_python3} + %{__python3} setup.py install --skip-build --root=%{buildroot} +@@ -166,4 +173,13 @@ CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build + %{python3_sitearch}/*egg-info + %endif + ++%package wheels ++Summary: %{name} wheels ++ ++%description wheels ++Contains python wheels for %{name} ++ ++%files wheels ++/wheels/* ++ + %changelog +-- +1.8.3.1 + diff --git a/virt/libvirt-python/centos/meta_patches/PATCH_ORDER b/virt/libvirt-python/centos/meta_patches/PATCH_ORDER index 91f9a80ea..90843c6f5 100644 --- a/virt/libvirt-python/centos/meta_patches/PATCH_ORDER +++ b/virt/libvirt-python/centos/meta_patches/PATCH_ORDER @@ -1 +1,2 @@ 0001-Update-package-versioning-for-TIS-format.patch +0002-Build-python-wheel.patch diff --git a/virt/libvirt-python/centos/patches/0001-Fix-setup-import-to-support-building-wheel.patch b/virt/libvirt-python/centos/patches/0001-Fix-setup-import-to-support-building-wheel.patch new file mode 100644 index 000000000..f931d0ebd --- /dev/null +++ b/virt/libvirt-python/centos/patches/0001-Fix-setup-import-to-support-building-wheel.patch @@ -0,0 +1,25 @@ +From 6c1041d2683f472dc645a44351b5938676e89738 Mon Sep 17 00:00:00 2001 +From: Don Penney +Date: Wed, 17 Oct 2018 15:26:37 -0400 +Subject: [PATCH] Fix setup import to support building wheel + +--- + setup.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index 964a40e..263266d 100755 +--- a/setup.py ++++ b/setup.py +@@ -1,6 +1,7 @@ + #!/usr/bin/env python + +-from distutils.core import setup, Extension, Command ++from setuptools import setup ++from distutils.core import Extension, Command + from distutils.command.build import build + from distutils.command.clean import clean + from distutils.command.sdist import sdist +-- +1.8.3.1 +