Builds of python-* failing on Leap

HI! Why are some Python packages failing to build on Leap? Is special project config needed? I tried to copy the config from devel:languages:python in the web UI but this does not work. Example: https://build.opensuse.org/package/show/home:stroeder:iam/python-pyasn1 [ 37s] find: '//home/abuild/rpmbuild/BUILDROOT/python-pyasn1-0.4.8-lp153.98.1.x86_64/usr/share/polkit-1/actions/': No such file or directory [ 37s] find: '//home/abuild/rpmbuild/BUILDROOT/python-pyasn1-0.4.8-lp153.98.1.x86_64/usr/share/mime/': No such file or directory [ 37s] find: '//home/abuild/rpmbuild/BUILDROOT/python-pyasn1-0.4.8-lp153.98.1.x86_64/usr/share/metainfo/': No such file or directory [ 37s] find: '//home/abuild/rpmbuild/BUILDROOT/python-pyasn1-0.4.8-lp153.98.1.x86_64/usr/share/appdata/': No such file or directory Ciao, Michael.

Hi, Am 14.06.21 um 20:49 schrieb Michael Ströder:
HI!
Why are some Python packages failing to build on Leap? Is special project config needed? I tried to copy the config from devel:languages:python in the web UI but this does not work.
Example:
https://build.opensuse.org/package/show/home:stroeder:iam/python-pyasn1
[ 37s] find: '//home/abuild/rpmbuild/BUILDROOT/python-pyasn1-0.4.8-lp153.98.1.x86_64/usr/share/polkit-1/actions/': No such file or directory [ 37s] find: '//home/abuild/rpmbuild/BUILDROOT/python-pyasn1-0.4.8-lp153.98.1.x86_64/usr/share/mime/': No such file or directory [ 37s] find: '//home/abuild/rpmbuild/BUILDROOT/python-pyasn1-0.4.8-lp153.98.1.x86_64/usr/share/metainfo/': No such file or directory [ 37s] find: '//home/abuild/rpmbuild/BUILDROOT/python-pyasn1-0.4.8-lp153.98.1.x86_64/usr/share/appdata/': No such file or directory
That's not the failure message. The error is a few lines below that: [ 37s] + %pyunittest discover -v [ 37s] /var/tmp/rpm-tmp.1RJB1Y: line 28: fg: no job control [ 37s] error: Bad exit status from /var/tmp/rpm-tmp.1RJB1Y (%check) Plain Leap 15.3 lacks the pyunittest macro from an up to date python-rpm-macros: [ 12s] [4/175] cumulate python-rpm-macros-20200207.5feb6c1-3.11.1 devel:languages:python uses d:l:p:backports for its build targets, which is not part of the released Leap 15.3 distribution. If you must update a package in SLE or Leap which must go into the distribution, replace the %pyunittest macro with %{python_expand # export PYTHONPATH=%{builddir}%{$python_sitelib} $python -m unittest discover -v } The above retains compatibility with Tumbleweed. If you don't need that, in most cases you can also just do python3 -m unittest discover -v - Ben

Ben, On 6/14/21 10:37 PM, Ben Greiner wrote:
Plain Leap 15.3 lacks the pyunittest macro from an up to date python-rpm-macros: [..] devel:languages:python uses d:l:p:backports for its build targets, which is not part of the released Leap 15.3 distribution.
Ah, I see. Many thanks for your explanation.
If you must update a package in SLE or Leap which must go into the distribution, replace the %pyunittest macro with
%{python_expand # export PYTHONPATH=%{builddir}%{$python_sitelib} $python -m unittest discover -v }
I'd prefer to use that for all packages I take care of. Because then those packages build just fine for Leap and SLE. Would such submissions be accepted for d:l:p?
The above retains compatibility with Tumbleweed.
That's exactly what I want. Another question related to %check during build: Are any special things needed for C wrapper modules? The C wrapper part of my ldap0 module seems not to be imported during %check: https://build.opensuse.org/package/live_build_log/home:stroeder:branches:hom... The shared library file _libldap0.cpython-3*m-x86_64-linux-gnu.so seems to get installed. Your help is much appreciated. Ciao, Michael.

On 6/16/21 7:06 PM, Michael Ströder wrote:
Another question related to %check during build: Are any special things needed for C wrapper modules?
The C wrapper part of my ldap0 module seems not to be imported during %check:
https://build.opensuse.org/package/live_build_log/home:stroeder:branches:hom...
The shared library file _libldap0.cpython-3*m-x86_64-linux-gnu.so seems to get installed.
%pytest_arch seems to work, despite some other details. But I'd like to avoid pytest. Is there an arch-specific macro for using unittest module? Ciao, Michael.

Am 17.06.21 um 03:05 schrieb Michael Ströder:
On 6/16/21 7:06 PM, Michael Ströder wrote:
Another question related to %check during build: Are any special things needed for C wrapper modules?
The C wrapper part of my ldap0 module seems not to be imported during %check:
https://build.opensuse.org/package/live_build_log/home:stroeder:branches:hom...
The shared library file _libldap0.cpython-3*m-x86_64-linux-gnu.so seems to get installed. %pytest_arch seems to work, despite some other details.
But I'd like to avoid pytest. Is there an arch-specific macro for using unittest module? Yes, %pyunittest_arch, or if you don't have a recent python-rpm-macros:
%{python_expand # export PYTHONPATH=%{buildroot}%{$python_sitearch} $python -B -m unittest discover -v } Two mistakes from my first reply: - %buildroot, not %builddir. - I forgot to mention the -B (or export PYTHONDONTWRITEBYTECODE=1). It should also be present in order to avoid unreproducible builds. The difference between pure libs and packages with C extensions is %{$python_sitelib} (= /usr/lib/python3.X/site-packages) vs %{$python_sitearch} (= /usr/lib64/python3.X/site-packages). For everything else, see [1, 2]. I am not a d:l:p maintainer, but I am sure the manual expansion is acceptable. Nobody is forced to use the macros. It is always good to check upstream's tox.ini or CI setups. Instead of discover, they may also directly invoke the test modules like `python -m unittest testdir.runtests` Another complication is the automatic population of sys.path with the current directory. You have to make sure, that `import mypkg` imports from the buildroot, not from the srcdir in order to find the compiled extensions. `pytest` usually does it as intended, `python -m unittest` does not [3, 4, 5].
Ciao, Michael.
Ben [1] Current README https://github.com/openSUSE/python-rpm-macros/blob/master/README.md [2] Old README of the Leap version: https://github.com/openSUSE/python-rpm-macros/blob/5feb6c1f09bb7771ef5826e51... [3] https://docs.pytest.org/en/6.2.x/pythonpath.html [4] https://docs.python.org/3/using/cmdline.html#cmdoption-m [5] https://lists.opensuse.org/archives/list/python@lists.opensuse.org/thread/QG...

Dne 17. 06. 21 v 10:06 Ben Greiner napsal(a):
But I'd like to avoid pytest. Is there an arch-specific macro for using unittest module? Yes, %pyunittest_arch, or if you don't have a recent python-rpm-macros:
%{python_expand # export PYTHONPATH=%{buildroot}%{$python_sitearch} $python -B -m unittest discover -v }
Two mistakes from my first reply: - %buildroot, not %builddir. - I forgot to mention the -B (or export PYTHONDONTWRITEBYTECODE=1). It should also be present in order to avoid unreproducible builds.
The difference between pure libs and packages with C extensions is %{$python_sitelib} (= /usr/lib/python3.X/site-packages) vs %{$python_sitearch} (= /usr/lib64/python3.X/site-packages). For everything else, see [1, 2].
I am not a d:l:p maintainer, but I am sure the manual expansion is acceptable. Nobody is forced to use the macros.
Could you please file a bug, that python-rpm-macros in SLE-15 is too old? Matěj -- https://matej.ceplovi.cz/blog/, Jabber: mcepl@ceplovi.cz GPG Finger: 3C76 A027 CA45 AD70 98B5 BC1D 7920 5802 880B C9D8 Somewhere at the edge of the Bell curve was the girl for me. -- Based on http://xkcd.com/314/

Could you please file a bug, that python-rpm-macros in SLE-15 is too old?
participants (3)
-
Ben Greiner
-
Matěj Cepl
-
Michael Ströder