#13 Limit dependencies in RHEL builds
Opened 21 days ago by yselkowitz. Modified 3 hours ago
rpms/ yselkowitz/python-pyghmi rawhide  into  rawhide

file added
+12
@@ -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@@"

file modified
+32 -1
@@ -1,3 +1,7 @@ 

+ %bcond docs %{undefined rhel}

+ %bcond pbr %{undefined rhel}

+ %bcond tests %{undefined rhel}

+ 

  %global sname pyghmi

  %global common_summary Python General Hardware Management Initiative (IPMI and others)

  
@@ -11,13 +15,17 @@ 

  Summary: %{common_summary}

  Name: python-%{sname}

  Version: %{?version:%{version}}%{!?version:1.5.69}

- Release: 1%{?dist}

+ Release: 2%{?dist}

  Source0: https://tarballs.opendev.org/x/%{sname}/%{sname}-%{version}.tar.gz

  License: ASL 2.0

  Prefix: %{_prefix}

  BuildArch: noarch

  Url: https://opendev.org/x/pyghmi

  

+ ## RHEL-specific patches

+ Patch1000:  nopbr.patch

+ Patch1001:  setup.patch

+ 

  %description

  %{common_desc}

  
@@ -26,10 +34,14 @@ 

  %{?python_provide:%python_provide python3-%{sname}}

  

  BuildRequires: python3-devel

+ %if %{with pbr}

  BuildRequires: python3-pbr

+ %endif

  BuildRequires: python3-setuptools

+ %if %{with tests}

  BuildRequires: python3-oslotest

  BuildRequires: python3-stestr

+ %endif

  

  BuildRequires: python3-cryptography

  BuildRequires: python3-six
@@ -49,6 +61,7 @@ 

  %description -n python3-%{sname}-tests

  %{common_desc_tests}

  

+ %if %{with docs}

  %package -n python-%{sname}-doc

  Summary: The pyghmi library documentation

  
@@ -57,22 +70,35 @@ 

  

  %description -n python-%{sname}-doc

  Documentation for the pyghmi library

+ %endif

  

  %prep

  %setup -qn %{sname}-%{version}

+ %if %{without pbr}

+ %patch1000 -p1

+ %patch1001 -p1

+ sed -i s/@@REDHATVERSION@@/%{version}/ pyghmi/version.py

+ sed -e "s/#VERSION#/%{version}/" setup.py.tmpl > setup.py

+ %endif

  

  %build

  %py3_build

+ %if %{with docs}

  sphinx-build -b html doc/source doc/build/html

  

  # remove the sphinx-build leftovers

  rm -rf doc/build/html/.{doctrees,buildinfo}

+ %endif

  

  %install

  %py3_install

  

  %check

+ %if %{with tests}

  stestr run

+ %else

+ %py3_check_import %{sname} %{sname}.cmd %{sname}.ipmi %{sname}.ipmi.oem %{sname}.ipmi.oem.lenovo %{sname}.ipmi.private %{sname}.redfish %{sname}.redfish.oem %{sname}.redfish.oem.dell %{sname}.redfish.oem.lenovo %{sname}.util

+ %endif

  

  %files -n python3-%{sname}

  %license LICENSE
@@ -88,11 +114,16 @@ 

  %license LICENSE

  %{python3_sitelib}/%{sname}/tests

  

+ %if %{with docs}

  %files -n python-%{sname}-doc

  %license LICENSE

  %doc doc/build/html README.md

+ %endif

  

  %changelog

+ * Thu May 02 2024 Yaakov Selkowitz <yselkowi@redhat.com> - 1.5.69-2

+ - Limit dependencies in RHEL builds

+ 

  * Sun Apr 21 2024 Dmitry Tantsur <dtantsur@proton.me> - 1.5.69-1

  - Update to 1.5.69

  

file added
+22
@@ -0,0 +1,22 @@ 

+ 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,16 @@ 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.dell', 'pyghmi.redfish.oem.lenovo'],

+ +              'pyghmi.redfish.oem.dell', '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')

+  

When built for RHEL or ELN, the OpenStack-related dependencies are not available. This is based on the changes already in c9s.

Build succeeded.
https://fedora.softwarefactory-project.io/zuul/buildset/eb5a8ec2cc004242ad8c0f777a187e2f

Maybe this could be pushed upstream? pyghmi is not really an OpenStack project, and PBR could be replaced with a newer alternative poetry-dynamic-versioning

I don't mind anything here except for the setup.py part. Seems like a bug on the upstream side? Could you propose a patch there? I'm fine with merging this PR as it is for now, but I'd like to at least open the conversation first.

@pcahyna these patches are originally yours from c9s; is there any reason that the setup.py.tmpl changes cannot go upstream?

The upstream sources for setup.py.tmpl say:

# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT

https://opendev.org/x/pyghmi/src/commit/9b05952343ca56b3bab4aa9e828060742ce2fdda/setup.py.tmpl#L17

which indicates that it is not that easy to change it. I have not investigated in detail what the global requirements repo is and how to change the information there.

This comment is wrong: they've already changed setup.py from what is "managed by the global requirements" (which looks like https://github.com/openstack/requirements/blob/master/setup.py). Feel free to propose an update and remove this comment altogether.

On top of that, the setup.py fix is not limited to RHEL, right? It's just no-op on Fedora because of pbr? I wish upstream would settle down on one approach, but let's probably patch setup.py unconditionally (until upstream is fixed) so that we have fewer divergent code paths?

@divius if I'm understanding you correctly, you're suggesting that the pbr avoidance be applied to Fedora as well. The PR has been modified accordingly.

rebased onto 435e54b

6 days ago

Build succeeded.
https://fedora.softwarefactory-project.io/zuul/buildset/e9d74a3ac37d4b37be3434b72bf8269a

@yselkowitz I suspect that @divius meant that even on Fedora you can apply the other patch (setup.patch) unconditionally. Not nopbr.patch.

I suspect that @divius meant that even on Fedora you can apply the other patch (setup.patch) unconditionally. Not nopbr.patch.

Correct. I'd also like to ask you to propose it (= setup.patch) upstream, so that we don't carry it forever.

In that case, I have reverted to the first version of my patch. There is little point on applying only setup.patch, as setup.py.tmpl is only used in conjunction with the avoidance of the pbr dependency.

@pcahyna could you get that patch upstreamed?

rebased onto 0e86ced

3 hours ago

Build succeeded.
https://fedora.softwarefactory-project.io/zuul/buildset/873b38296d984f7588a02f1fa12d7887