#427 Prevent incorrect usage of %pyproject_buildrequires -R with -x/-e/-t/-w
Merged 6 months ago by churchyard. Opened 6 months ago by churchyard.
rpms/ churchyard/pyproject-rpm-macros rxte  into  rawhide

file modified
+3
@@ -156,6 +156,9 @@ 

  %{?_package_note_flags:%_generate_package_note_file}

  %{-R:

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

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

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

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

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

  }

  %{-N:

@@ -175,6 +175,8 @@ 

  - Add the -l/-L flag to %%pyproject_save_files

  - The -l flag can be used to assert at least 1 License-File was detected

  - The -L flag explicitly disables this check (which remains the default)

+ - Prevent incorrect usage of %%pyproject_buildrequires -R with -x/-e/-t

+ - Fixes: rhbz#2244282

  

  * Wed Sep 13 2023 Python Maint <python-maint@redhat.com> - 1.10.0-1

  - Add %%_pyproject_check_import_allow_no_modules for automated environments

Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci
https://fedora.softwarefactory-project.io/zuul/buildset/0c9db5a7b9cd467a80101fcbce8ec7b4

3 new commits added

  • Prevent incorrect usage of %pyproject_buildrequires -R with -x/-e/-t/-w/-C
  • CI: Use DNF 4 in mock to workaround dnf5#1084
  • Add the -l/-L flag to %pyproject_save_files
6 months ago

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

I grabbed a specfile with %pyproject_buildrequires -R -x <extra> and tried to build it.

pyproject-srpm-macros-1.10.0-1.fc40.noarch
- extra requirements were generated, -R was obviously ignored

pyproject-srpm-macros-1.11.0-1.fc40.noarch
- build failed due to using mutually exclusive combination

What's the impact, are there packages that use the incorrect combinations in Fedora?

The list is ordered to match the one with -N, that's fine.
Package is buildable, works as expected.
Commit looks good. Referenced BZ is the correct one.

The change is potentially disruptive (on purpose). It would be nice to identify and notify/fix possible affected packages before breaking them.
I also wonder whether this is worth testing in our CI.

So we only have this (assuming my regex is correct):

$ rg '%\{?pyproject_buildrequires\s+(.+\s+)?-\S*R' rpm-specs/
rpm-specs/scipy.spec
186:%pyproject_buildrequires -R

rpm-specs/python-poetry-plugin-export.spec
47:%pyproject_buildrequires %{?with_bootstrap: -R}

rpm-specs/poetry.spec
66:%pyproject_buildrequires %{?with_bootstrap: -R}

rpm-specs/pdfarranger.spec
47:%pyproject_buildrequires -R

rpm-specs/numpy.spec
132:%pyproject_buildrequires -R -Csetup-args=-Dblas=flexiblas -Csetup-args=-Dlapack=lapack

rpm-specs/git-pull-request.spec
30:%pyproject_buildrequires -R

rpm-specs/diskimage-builder.spec
79:%pyproject_buildrequires -R

This change should break numpy. I'll see if the -C in numpy is useless or not.

Ok, the config_settings are passed to get_requires_for_build_wheel. We should not exclude -C here.

3 new commits added

  • Prevent incorrect usage of %pyproject_buildrequires -R with -x/-e/-t/-w
  • CI: Use DNF 4 in mock to workaround dnf5#1084
  • Add the -l/-L flag to %pyproject_save_files
6 months ago

I've removed -C. This shall break no Fedora Rawhide package now.

As far as CI goes, it might be possible to assert certain invocations of the macro are erroring, e.g. like this:

rpm --eval '%pyproject_buildrequires -R -x test' && exit 1 || true

But I wonder if it's worth it -- the code handles all combinations explicitly, so the tests would just copy those combinations.

I don't think it's worth the effort.

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

Thank you for checking the packages. It actually uncovered a possible issue, nice!
I agree with the approach towards testing.

I now also noticed the -w in the commit message and changelog is redundant. Will amend it asway later.

3 new commits added

  • Prevent incorrect usage of %pyproject_buildrequires -R with -x/-e/-t
  • CI: Use DNF 4 in mock to workaround dnf5#1084
  • Add the -l/-L flag to %pyproject_save_files
6 months ago

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

rebased onto 89f2408

6 months ago

Pull-Request has been merged by churchyard

6 months ago

Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci
https://fedora.softwarefactory-project.io/zuul/buildset/31a65366c9b74b05a6f92f37f14ad581