#284 DO NOT MERGE: Minimal EPEL8 version
Closed 2 years ago by churchyard. Opened 2 years ago by orion.
rpms/ orion/pyproject-rpm-macros epel8  into  rawhide

file modified
-41
@@ -121,47 +121,6 @@ 

  %toxenv %{default_toxenv}

  

  

- %pyproject_buildrequires(rRxtNwe:) %{expand:\\\

- %_set_pytest_addopts

- # The _auto_set_build_flags feature does not do this in %%generate_buildrequires section,

- # but we want to get an environment consistent with %%build:

- %{?_auto_set_build_flags:%set_build_flags}

- %{-R:

- %{-r:%{error:The -R and -r options are mutually exclusive}}

- %{-w:%{error:The -R and -w options are mutually exclusive}}

- }

- %{-N:

- %{-r:%{error:The -N and -r options are mutually exclusive}}

- %{-x:%{error:The -N and -x options are mutually exclusive}}

- %{-e:%{error:The -N and -e options are mutually exclusive}}

- %{-t:%{error:The -N and -t options are mutually exclusive}}

- %{-w:%{error:The -N and -w options are mutually exclusive}}

- }

- %{-e:%{expand:%global toxenv %(%{__python3} -s %{_rpmconfigdir}/redhat/pyproject_construct_toxenv.py %{?**})}}

- echo 'pyproject-rpm-macros'  # we already have this installed, but this way, it's repoqueryable

- echo 'python%{python3_pkgversion}-devel'

- echo 'python%{python3_pkgversion}dist(pip) >= 19'

- echo 'python%{python3_pkgversion}dist(packaging)'

- %{!-N:if [ -f pyproject.toml ]; then

-   echo 'python%{python3_pkgversion}dist(toml)'

- elif [ -f setup.py ]; then

-   # Note: If the default requirements change, also change them in the script!

-   echo 'python%{python3_pkgversion}dist(setuptools) >= 40.8'

-   echo 'python%{python3_pkgversion}dist(wheel)'

- else

-   echo 'ERROR: Neither pyproject.toml nor setup.py found, consider using %%%%pyproject_buildrequires -N <requirements-file> if this is not a Python package.' >&2

-   exit 1

- fi}

- # setuptools assumes no pre-existing dist-info

- rm -rfv *.dist-info/ >&2

- if [ -f %{__python3} ]; then

-   mkdir -p "%{_pyproject_builddir}"

-   CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}" TMPDIR="%{_pyproject_builddir}" \\\

-   RPM_TOXENV="%{toxenv}" HOSTNAME="rpmbuild" %{__python3} -Bs %{_rpmconfigdir}/redhat/pyproject_buildrequires.py %{?!_python_no_extras_requires:--generate-extras} --python3_pkgversion %{python3_pkgversion} --wheeldir %{_pyproject_wheeldir} %{?**}

- fi

- }

- 

- 

  %tox(e:) %{expand:\\\

  TOX_TESTENV_PASSENV="${TOX_TESTENV_PASSENV:-*}" \\

  PYTHONDONTWRITEBYTECODE=1 \\

file modified
+15 -10
@@ -1,3 +1,5 @@ 

+ %global __python3 /usr/bin/python3.8

+ 

Is there a reason this is using python3.8 instead of the default Python?

  Name:           pyproject-rpm-macros

  Summary:        RPM macros for PEP 517 Python packages

  License:        MIT
@@ -11,7 +13,7 @@ 

  #   Increment Z when this is a bugfix or a cosmetic change

  # Dropping support for EOL Fedoras is *not* considered a breaking change

  Version:        1.2.0

- Release:        1%{?dist}

+ Release:        2%{?dist}

  

  # Macro files

  Source001:      macros.pyproject
@@ -45,14 +47,14 @@ 

  BuildArch:      noarch

  

  %if %{with tests}

- BuildRequires: python3dist(pytest)

- BuildRequires: python3dist(pyyaml)

- BuildRequires: python3dist(packaging)

- BuildRequires: python3dist(pip)

- BuildRequires: python3dist(setuptools)

- BuildRequires: python3dist(toml)

- BuildRequires: python3dist(tox-current-env) >= 0.0.6

- BuildRequires: python3dist(wheel)

+ BuildRequires: python3.8dist(pytest)

+ BuildRequires: python3.8dist(pyyaml)

+ BuildRequires: python3.8dist(packaging)

+ BuildRequires: python3.8dist(pip)

+ BuildRequires: python3.8dist(setuptools)

+ #BuildRequires: python3.8dist(toml)

I have branched python38-toml-epel and added python-sig and epel-packagers-sig as co-maintainers.

+ #BuildRequires: python3.8dist(tox-current-env) >= 0.0.6

+ BuildRequires: python3.8dist(wheel)

  %endif

  

  # We build on top of those:
@@ -103,7 +105,7 @@ 

  %if %{with tests}

  %check

  export HOSTNAME="rpmbuild"  # to speedup tox in network-less mock, see rhbz#1856356

- %{python3} -m pytest -vv --doctest-modules

+ %{python3} -m pytest -vv --doctest-modules || :

  

  # brp-compress is provided as an argument to get the right directory macro expansion

  %{python3} compare_mandata.py -f %{_rpmconfigdir}/brp-compress
@@ -124,6 +126,9 @@ 

  %license LICENSE

  

  %changelog

+ * Tue May 24 2022 Orion Poplawski <orion@nwra.com> - 1.2.0-2

+ - Minimal EPEL8 version

+ 

  * Wed Apr 27 2022 Miro Hrončok <mhroncok@redhat.com> - 1.2.0-1

  - %%pyproject_buildrequires: Add provisional -w flag for build backends without

    prepare_metadata_for_build_wheel hook

file modified
+16 -15
@@ -18,21 +18,22 @@ 

  # https://github.com/rpm-software-management/rpm/issues/1865

  # The original lists can be found here:

  # https://github.com/rpm-software-management/rpm/blob/master/scripts/brp-compress

- MANPAGE_EXTENSIONS = ['gz', 'Z', 'bz2', 'xz', 'lzma', 'zst', 'zstd']

- MANDIRS = [

-     '/man/man*',

-     '/man/*/man*',

-     '/info',

-     '/share/man/man*',

-     '/share/man/*/man*',

-     '/share/info',

-     '/kerberos/man',

-     '/X11R6/man/man*',

-     '/lib/perl5/man/man*',

-     '/share/doc/*/man/man*',

-     '/lib/*/man/man*',

-     '/share/fish/man/man*',

- ]

+ MANPAGE_EXTENSIONS = ['gz', 'Z', 'bz2', 'xz', 'lzma']

+ MANDIRS = []

+ #MANDIRS = [

+ #    '/man/man*',

+ #    '/man/*/man*',

+ #    '/info',

+ #    '/share/man/man*',

+ #    '/share/man/*/man*',

+ #    '/share/info',

+ #    '/kerberos/man',

+ #    '/X11R6/man/man*',

+ #    '/lib/perl5/man/man*',

+ #    '/share/doc/*/man/man*',

+ #    '/lib/*/man/man*',

+ #    '/share/fish/man/man*',

+ #]

  

  

  class BuildrootPath(PurePosixPath):

Testing some hacks to try to get a minimal version working on EPEL8:

  • This simply defines %generate_buildrequires to %{nil} to allow that to remain in specs. Not sure if this is good or if it should error out
  • I'm getting recursive copy failures with TMPDIR=%{_pyproject_builddir}. Not sure what the ramifications of leaving that out are
  • I've commented out running pyproject_buildrequires.py because %{buildsubdir} is not defined in %prep and we get a top level .pyproject-build directory
  • I don't understand with MANPATH needs to be empty but that is what the test output says
  • We're missing deps for tests

This simply defines %generate_buildrequires to %{nil} to allow that to remain in specs. Not sure if this is good or if it should error out

IMHO this is a bad idea. Better do not define that at all and allow packagers to explicitly use something like:

%{?pyproject_buildrequires:
%generate_buildrequires
%pyproject_buildrequires -...
}

By defining %generate_buildrequires to %nil a Fedora specfile will silently produce bad results on EPEL 8. When %generate_buildrequires comes after %prep it would simply echo all the buildrequires to stdout and do nothing. However, I've seen multiple packagers that would stick the %generate_buildrequires section before %description (next to the manual BuildRequires) . That would make the specfile unparseable I think.

I've commented out running pyproject_buildrequires.py because %{buildsubdir} is not defined in %prep and we get a top level .pyproject-build directory

(I moved this here, as it is related.) I think that running %pyproject_buildrequires without %generate_buildrequires at all makes no sense. Better to remove that macro entirely. If need to be, it must run at the beginning of %build.


I'm getting recursive copy failures with TMPDIR=%{_pyproject_builddir}. Not sure what the ramifications of leaving that out are

Ramifications: Missing debuginfo. Try building a package with an extension module.

This is https://github.com/pypa/pip/issues/7872 fixed in https://github.com/pypa/pip/pull/7873 -- if you would like to open a PR in CentOS Stream 8 with a backport, I would gladly review it.


I don't understand with MANPATH needs to be empty but that is what the test output says

The test naïvely parses a shell script with regular expression. The idea is that if it fails entirely, the parsing needs to be changed. It's a simple regression test to let us know that the script in RPM is different. See https://github.com/rpm-software-management/rpm/blob/rpm-4.18.0-alpha2/scripts/brp-compress#L16 vs https://github.com/rpm-software-management/rpm/blob/rpm-4.14.3-release/scripts/brp-compress#L14 and change https://src.fedoraproject.org/rpms/pyproject-rpm-macros/blob/rawhide/f/compare_mandata.py#_19 accordingly.


Why does this force the Python version to 3.8? This should be useable with e.g. 3.9 as well.

I've uploaded a branch for python3x-pip here: https://git.centos.org/fork/orion/rpms/python3x-pip/tree/pip7873 but I seem to be unable to generate a PR from that - pagure seems to error out with all of my options.

1 new commit added

  • Support python 3.8 or 3.9
2 years ago

I've dropped %generate_buildrequires and %pyproject_buildrequires.

I've tried to make it compatible with python 3.9 as well.

but I seem to be unable to generate a PR from that - pagure seems to error out with all of my options.

It's possible to construct the URL manually (https://git.centos.org/fork/orion/rpms/python3x-pip/diff/c8s-stream-3.8..pip7873), but my understanding is that the proper way to submit c8s patches was through Bugzilla.

We need a bugzilla for processing the request either way, but a Pagure PR is easier to review (despite me not being able to merge it at the end).

I am not entirely sure I understand the need to replace all occurrences of %__python3 with %__pyproject_python. What is the idea here?

rebased onto f3efd4e

2 years ago

I have the bad habit of building packages locally without the proper python3X-rpm-macros installed. I've dropped that change now.

Is there a reason this is using python3.8 instead of the default Python?

I suspect pip for 3.6 is too old to handle any of this.

I have branched python38-toml-epel and added python-sig and epel-packagers-sig as co-maintainers.

Just curious. Why is the component name python38-toml-epel and not python-toml-epel to allow building for more Pythons or python38-toml since that component does not exist in RHEL?

Just curious. Why is the component name python38-toml-epel and not python-toml-epel to allow building for more Pythons or python38-toml since that component does not exist in RHEL?

On epel-devel[1], we decided to name them like this. This python38-toml-epel naming makes it easier to convert Fedora specfiles (the actual binary rpm is still a subpackage), makes it clear that it's EPEL only, differentiates it from the python-toml source package which is already packaged for EPEL 8, and allows us to package it for python39 if needed. If you think they should be named otherwise, you're welcome to chime in :).

[1]: https://lists.fedoraproject.org/archives/list/epel-devel@lists.fedoraproject.org/message/S4KRUJZNDKRFHUQMNJWR6TIGGDBAPM7L/ and the following messages

My experience with python36/38 for EPEL7 led me to prefer the split. The 36 version of a package would be limited by python or other other deps. Having a separate python38 package allowed for newer versions to be used. I suspect we'll see the same in EL9 as more python versions get added.

That makes perfect sense, agreed. Also, we would need the "other" set of macros again and that is not manageable. I was more curious about why both "38" and "epel" in the name but now I got it, so it can remain a subpackage.

The "epel" also makes it explicit that these are epel only packages. I get bugs filed against my python3-X EPEL packages for Fedora issues.

We still need to package tox and tox-current-env for python38 and python39 and update the epel-rpm-macros %py3_check_import backport, as %pyproject_check_import uses a flag that the current implementation does not support. However, I'm not super convinced that the former is worth the effort. Isn't one of the main selling points of the %tox macro is that it works together with %pyproject_buildrequires -t to result in less work for packagers?

For the record, I'm not super convinced that this entire effort is worth the effort. One of the main selling points of pyproject-rpm-macros is %pyproject_buildrequires :)

For the record, I'm not super convinced that this entire effort is worth the effort. One of the main selling points of pyproject-rpm-macros is %pyproject_buildrequires :)

I agree with your latter point, but I think it's still useful for packages that don't have setup.pys and therefore don't work with %py3_build and friends. Also, maintainers who use pyproject-rpm-macros would only have to conditionalize %pyproject_buildrequires (or just not use it) and manually specify BRs, while the rest of the spec could stay the same between Fedora and EPEL. I think having even part of pyproject-rpm-macros supported on EPEL 8 could help increase adoption amongst packagers who build for EPEL 8 and want to mainain a single specfile. At least in my case, ansible still uses the old macros, but I'd likely convert it to the new ones for all releases if they became available on EPEL 8.

Also, we would need the "other" set of macros again and that is not manageable.

Can you expand on why that is not manageable? @ignatenkobrain was asking me about why the %py3_other_* macros weren't an option for alternative python stack packaging on epel8, but I wasn't aware of the history and have never done epel7 packaging.

Also, I was able to build this successfully with the tests enabled after patching compare_mandata.py and removing all of the %tox and %pyproject_buildrequires stuff (I removed that first and didn't check if it any of those tests worked). I still would like to do some more testing and cleanup before submitting, but feel free to look at the COPR or my fork in the meantime.

Pull-Request has been closed by churchyard

2 years ago