From 1dd30fe369625c47725f07e4b2c9ecd7a54323d7 Mon Sep 17 00:00:00 2001 From: Pavel Cahyna Date: Wed, 11 Aug 2021 00:50:44 +0200 Subject: [PATCH] Initial import to RHEL 8. Avoid dependency on python-pbr, conditionalize docs build, to allow building in RHEL. Inspired by python-sushy. Update to 1.5.29. Resolves: rhbz1878679 --- .gitignore | 1 + nopbr.patch | 12 ++++++++++++ python-pyghmi.spec | 41 +++++++++++++++++++++++++++++++++++++---- setup.patch | 21 +++++++++++++++++++++ sources | 2 +- 5 files changed, 72 insertions(+), 5 deletions(-) create mode 100644 nopbr.patch create mode 100644 setup.patch diff --git a/.gitignore b/.gitignore index a31c6f8..d583361 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /pyghmi-1.2.16.tar.gz /pyghmi-1.5.14.tar.gz /pyghmi-1.5.19.tar.gz +/pyghmi-1.5.29.tar.gz diff --git a/nopbr.patch b/nopbr.patch new file mode 100644 index 0000000..ae951ce --- /dev/null +++ b/nopbr.patch @@ -0,0 +1,12 @@ +diff -up pyghmi-1.5.14/pyghmi/version.py~ pyghmi-1.5.14/pyghmi/version.py +--- pyghmi-1.5.14/pyghmi/version.py~ 2020-04-22 22:23:43.000000000 +0200 ++++ pyghmi-1.5.14/pyghmi/version.py 2021-08-06 10:59:41.595820434 +0200 +@@ -13,6 +13,6 @@ + # License for the specific language governing permissions and limitations + # under the License. + +-import pbr.version ++#import pbr.version + +-version_info = pbr.version.VersionInfo('pyghmi') ++version_info = "@@REDHATVERSION@@" diff --git a/python-pyghmi.spec b/python-pyghmi.spec index 8ed5cba..44d89e2 100644 --- a/python-pyghmi.spec +++ b/python-pyghmi.spec @@ -18,9 +18,15 @@ incorporate the pyghmi library into a Python application. %global with_python2 1 %endif +%if %{lua: if (string.find(rpm.expand("%{?dist}"), "ost") == nil) then print(0) else print(1) end} +%bcond_without docs +%else +%bcond_with docs +%endif + Summary: %{common_summary} Name: python-%{sname} -Version: %{?version:%{version}}%{!?version:1.5.19} +Version: %{?version:%{version}}%{!?version:1.5.29} Release: 1%{?dist} Source0: https://tarballs.opendev.org/x/%{sname}/%{sname}-%{version}.tar.gz License: ASL 2.0 @@ -28,6 +34,9 @@ Prefix: %{_prefix} BuildArch: noarch Url: https://git.openstack.org/cgit/openstack/pyghmi +Patch0: nopbr.patch +Patch1: setup.patch + %description %{common_desc} @@ -38,7 +47,7 @@ Summary: %{common_summary} BuildRequires: openstack-macros BuildRequires: python2-devel -BuildRequires: python2-pbr +#BuildRequires: python2-pbr BuildRequires: python2-setuptools Requires: python2-cryptography >= 2.1 @@ -64,7 +73,7 @@ Summary: %{common_summary} %{?python_provide:%python_provide python3-%{sname}} BuildRequires: python3-devel -BuildRequires: python3-pbr +#BuildRequires: python3-pbr BuildRequires: python3-setuptools Requires: python3-cryptography >= 2.1 @@ -83,11 +92,13 @@ Requires: python3-%{sname} = %{version}-%{release} %endif # with_python3 +%if %{with docs} + %package -n python-%{sname}-doc Summary: The pyghmi library documentation %if 0%{?with_python2} -BuildRequires: python2-sphinx +BuildRequires: python-sphinx BuildRequires: python2-openstackdocstheme %else BuildRequires: python3-sphinx @@ -97,23 +108,36 @@ BuildRequires: python3-openstackdocstheme %description -n python-%{sname}-doc Documentation for the pyghmi library +%endif + %prep %setup -qn %{sname}-%{version} +%patch0 -p1 +%patch1 -p1 + # NOTE(dtantsur): pyghmi is actual fine with older dateutil, 2.8.1 is missing # from both Fedora and CentOS currently. See # https://bugzilla.redhat.com/show_bug.cgi?id=1835084 sed -i 's/python-dateutil.*/python-dateutil>=2.6.1/' requirements.txt +sed -i s/@@REDHATVERSION@@/%{version}/ pyghmi/version.py +# If not PBR, use the setup.py.tmpl +sed -e "s/#VERSION#/%{version}/" setup.py.tmpl > setup.py + %build %if 0%{?with_python3} %py3_build +%if %{with docs} %{__python3} setup.py build_sphinx -b html +%endif %endif # with_python3 %if 0%{?with_python2} %py2_build +%if %{with docs} %{__python2} setup.py build_sphinx -b html %endif +%endif # remove the sphinx-build leftovers rm -rf doc/build/html/.{doctrees,buildinfo} @@ -173,11 +197,20 @@ popd %{python2_sitelib}/%{sname}/tests %endif +%if %{with docs} + %files -n python-%{sname}-doc %license LICENSE %doc doc/build/html README.md +%endif # with docs + %changelog +* Fri Aug 6 2021 Pavel Cahyna - 1.5.29-1 +- Updated to 1.5.29. +- Avoid dependency on python-pbr, conditionalize docs build, to allow building in RHEL. + Inspired by python-sushy. + * Fri Nov 06 2020 Joel Capitao - 1.5.19-1 - Updated to 1.5.19. diff --git a/setup.patch b/setup.patch new file mode 100644 index 0000000..317cce0 --- /dev/null +++ b/setup.patch @@ -0,0 +1,21 @@ +diff -up pyghmi-1.5.14/.orig.orig pyghmi-1.5.14/.orig +diff -up pyghmi-1.5.14/setup.py.tmpl.orig pyghmi-1.5.14/setup.py.tmpl +--- pyghmi-1.5.14/setup.py.tmpl.orig 2021-08-06 11:44:02.618240604 +0200 ++++ pyghmi-1.5.14/setup.py.tmpl 2021-08-06 11:44:35.586675599 +0200 +@@ -26,6 +26,15 @@ setuptools.setup( + packages=['pyghmi', 'pyghmi.util', 'pyghmi.ipmi', 'pyghmi.cmd', + 'pyghmi.redfish', 'pyghmi.ipmi.private', 'pyghmi.ipmi.oem', + 'pyghmi.ipmi.oem.lenovo', 'pyghmi.redfish.oem', +- 'pyghmi.redfish.oem.lenovo'], ++ 'pyghmi.redfish.oem.lenovo', 'pyghmi.tests'], ++ entry_points={ ++ 'console_scripts': [ ++ 'pyghmicons=pyghmi.cmd.pyghmicons:main', ++ 'pyghmiutil=pyghmi.cmd.pyghmiutil:main', ++ 'virshbmc=pyghmi.cmd.virshbmc:main', ++ 'fakebmc=pyghmi.cmd.fakebmc:main', ++ ], ++ }, ++ + license='Apache License, Version 2.0') + diff --git a/sources b/sources index c3e3778..568c921 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (pyghmi-1.5.19.tar.gz) = 2d94f3abcae9a45b08e40ab779e0f8f2434e3eea260772dc49007deb8382cc7dc75b10c91f952c26e220d7f937c2d3d8d663a0dc54337d3e2a59c6bfe6929f72 +SHA512 (pyghmi-1.5.29.tar.gz) = 3e3ecbf4efa179b872d8cc24774e81f6946fa122bb5f3b5de3598e17b448eb5010d6bf6f783b7c27422b71e4739e8b34127ff1c3b5dfec341382f49b2b691c29