openmainframeproject / feilong

Feilong is a open source z/VM cloud connector project under the Open Mainframe Project umbrella that will accelerate the z/VM adoption, extending its ecosystem and its user experience. It provides a set of APIs to operate z/VM including guest, image, network, volume etc.
https://www.openmainframeproject.org/projects/feilong
Apache License 2.0
36 stars 70 forks source link

Error when building zvmsdk for Ubuntu 24.04 #831

Open aazam-gh opened 4 months ago

aazam-gh commented 4 months ago

Hello, I am currently working on improving the Feilong Packaging process as part my OMP mentorship with Linux Foundation.

For building zvmsdk (as per documentation) in Ubuntu 24.04 using build-zvmsdk, we encounter an issue due to the depreciation of setup.py as it is no longer available in Python 3.12

Here is a snapshot of the errorlog, when running the buildzvmsdkdeb script.

make[1]: Leaving directory '/home/linux1/build-zvmsdk/feilong'
   create-stamp debian/debhelper-build-stamp
 fakeroot debian/rules binary
dh binary --with python3 --buildsystem=pybuild
   dh_testroot -O--buildsystem=pybuild
   dh_prep -O--buildsystem=pybuild
    rm -f -- debian/zvmsdk.substvars
    rm -fr -- debian/.debhelper/generated/zvmsdk/ debian/zvmsdk/ debian/tmp/
   dh_auto_install --destdir=debian/zvmsdk/ -O--buildsystem=pybuild
    install -m0755 -d /home/linux1/build-zvmsdk/feilong/debian/zvmsdk
    pybuild --install -i python{version} -p 3.12 --dest-dir /home/linux1/build-zvmsdk/feilong/debian/zvmsdk
I: pybuild base:311: /usr/bin/python3 setup.py install --root /home/linux1/build-zvmsdk/feilong/debian/zvmsdk 
running install
/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` directly.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
        ********************************************************************************

!!
  self.initialize_options()
error: error in /home/linux1/build-zvmsdk/feilong/.pybuild/cpython3_3.12_zvmsdk/.pydistutils.cfg: command 'install' has no such option 'install_layout'
E: pybuild pybuild:389: install: plugin distutils failed with: exit code=1: /usr/bin/python3 setup.py install --root /home/linux1/build-zvmsdk/feilong/debian/zvmsdk 
dh_auto_install: error: pybuild --install -i python{version} -p 3.12 --dest-dir /home/linux1/build-zvmsdk/feilong/debian/zvmsdk returned exit code 13
make: *** [debian/rules:6: binary] Error 13
dpkg-buildpackage: error: fakeroot debian/rules binary subprocess returned exit status 2

According to this blog setup.py can no longer be directly invoked and hence results in the build error. I have tried using pip to install but it seems as db-helper also calls setup.py. By the introduction of PEP 517 and PEP 518 we will have to change how we build the package for debian.

I would appreciate any assistance in resolving this, especially on how we can move away from using setup.py. From what I have looked into, poetry might be the way with a pyproject.toml. I currently have a PR in progress for this issue. Thank you :)

mfriesenegger commented 3 months ago

@jichenjc @larainema Can you help provide guidance on how to solve this issue?

larainema commented 3 months ago

@bjhuangr @wghaojue if you have some comments for this issue?

mfriesenegger commented 3 months ago

If https://github.com/mfcloud/build-zvmsdk/pull/7#issuecomment-2261542870 can be duplicated then this issue might not need to be addressed.

jichenjc commented 3 months ago

Thanks for reporting this

sorry for late response, we used to support Ubuntu but currently it's lack of test ,we will check what we can do here

mfriesenegger commented 3 months ago

@aazam-gh Based on the latest success in building packages in OBS for Ubuntu, I think this issue is no longer valid and should be closed.

aazam-gh commented 3 months ago

The issue has been resolved. Ubuntu 24.04 is successfully packaged for feilong. However a point to note is that setup.py is indeed depreciated