Commit Graph

19 Commits

Author SHA1 Message Date
Miro Hrončok be050ad171 Prefix paths of intermediate files (such as %{pyproject_files}) with NVRA
Apparently, when you repeatedly run `rpmbuild -ba`, files in %_builddir are not cleaned.
This way, we at least make sure the files are unique between different NVRAs,
so 2 unrelated builds don't share the files between each other.

Keeping files contained in the build subdirectory is the more common way of doing this,
but we cannot technically do that, because we don't know what's it gonna be (before %prep).

Should be backwards compatible, as we only modify underscore-prefixed macros and %{pyproject_files},
where the exact value should not matter to the packagers.

Resolves: rhbz#2060109
2022-03-23 15:13:05 +01:00
Miro Hrončok 71dcd3ad74 %pyproject_buildrequires: Generate BuildRequires for this package
This package is already installed -- otherwise the macro would not even exist.

However, since python3-devel has started to Require pyproject-rpm-macros,
it is no longer possible to use `repoquery --whatrequires pyproject-rpm-macros`
to get a reliable list of packages that use the macros.

This was, all packages that use %pyproject_buildrequires will BuildRequire the macros explicitly.

(In the future, we could even include a stub version of %pyproject_buildrequires
in pyproject-srpm-macros (always installed in the buildroot),
that only echoes this package,
so packagers would not need to manually BuildRequire anything at all.)

Related: rhbz#1950291
2022-01-26 11:44:53 +01:00
Karolina Surma 2be56ab379 Include compressed manpages correctly in the RPM package
Compressed manpages have different extension than those listed in the RECORD file,
so they were not recognized when %%pyproject_save_files '+auto' flag
was provided.
To enable the path recognition, if the manpage extension matches the one
listed in brp-compres, the extension is removed, and an asterisk is now added
to the manpages filenames.
Source: https://docs.fedoraproject.org/en-US/packaging-guidelines/#_manpages

Related: rhbz#1950291
2022-01-26 11:44:41 +01:00
Miro Hrončok 93cf48f615 %pyproject_buildrequires: Make -r (include runtime) the default, use -R to opt-out
See the proposal:
https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org/thread/2R6NKELTHAWE6PI3CCZBVW5PMGO5VPDG/

 - -N now implies -R
 - the macro still guards against -Nr and now also against -Rr

Related: rhbz#1950291
2022-01-26 11:41:43 +01:00
Miro Hrončok 5513c410bf Define provisional %pyproject_build_lib
Related: rhbz#1950291
2022-01-26 11:35:49 +01:00
Karolina Surma d427052f40 Introduce %%pyproject_check_import
%%pyproject_save_files newly saves also a list of importable modules.
The list is used by %%pyproject_check_import to invoke the import test
on each module name.
%%pyproject_check_import accepts two options:
-t: filter only top-level modules
-e: exclude module names matching the given glob from the import check

Related: rhbz#1950291
2022-01-26 11:31:17 +01:00
Miro Hrončok 309172f9a8 Rename %_pyproject_ghost_distinfo and %_pyproject_record to indicate they are private
Related: rhbz#1950291
2021-08-10 10:52:23 +02:00
Miro Hrončok b3b3c84091 All supported Fedoras can have dependencies on extras
Related: rhbz#1950291
2021-08-10 10:52:23 +02:00
Tomas Hrnciar d74e61b485 %pyproject_buildrequires: Fallback to setuptools.build_meta:__legacy__ only if setup.py exists
Fixes: rhbz#1976459

Related: rhbz#1950291
2021-08-10 10:52:05 +02:00
Tomas Hrnciar aac0af8401 Generate BuildRequires from file
%pyproject_buildrequires macro now accepts multiple file names to load
additional dependencies from them.

New option -N was added to disable automatical generation of requirements
in case package does not use build system. Option -N cannot be used in
combination with options -r, -e, -t, -x.

Co-authored-by: Miro Hrončok <miro@hroncok.cz>

Related: rhbz#1950291
2021-07-09 17:30:46 +02:00
Miro Hrončok 9c60342738 Avoid leaking %{_pyproject_builddir} to pytest collection
Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1935212

Requires a %pytest change: https://src.fedoraproject.org/rpms/python-rpm-macros/pull-request/102

Related: rhbz#1950291
2021-06-30 13:08:48 +02:00
Miro Hrončok 71f414ef2c Set %_pyproject_wheeldir and %_pyproject_builddir relative to the source tree, not $PWD
This allows users to do:

    %build
    cd somewhere
    %pyproject_wheel
    cd -
    cd somewhere_else
    %pyproject_wheel
    cd -

    %install
    %pyproject_install

Without a need to copy paste the wheels to a common location.

This is in fact a breaking change, I'll make sure to adapt the affected packages in Fedora.

Related: rhbz#1950291
2021-06-10 13:49:49 +02:00
Miro Hrončok 1cacdb2b62 Don't leak $TMPDIR outside of pyproject macros
During %install, the BRB scripts might be affected by it

Related: rhbz#1950291
2021-05-28 15:23:31 +02:00
Major Hayden 9eb47b5d06 Write warning to >&2 instead of /dev/stderr
Writing to /dev/stderr with > or >> does not work properly in a mock chroot.

https://bugzilla.redhat.com/show_bug.cgi?id=1965470

Related: rhbz#1950291
2021-05-28 15:22:58 +02:00
DistroBaker 795a9b3332 Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/pyproject-rpm-macros.git#26bb3cb4d123a7f57df5ec56b17ccbf3d415c505
2021-02-04 13:32:12 +00:00
DistroBaker 5919cec39c Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/pyproject-rpm-macros.git#6a8d86ed709871dc99fda2a02fb9e21d362c637e
2020-12-04 19:01:54 +01:00
Troy Dawson bdcdcffab9 RHEL 9.0.0 Alpha bootstrap
The content of this branch was automatically imported from Fedora ELN
with the following as its source:
https://src.fedoraproject.org/rpms/pyproject-rpm-macros#38ef5fb85baa8d9529853c325ddd5e3fb2ec08a7
2020-11-16 15:10:26 -08:00
DistroBaker a2bd1e357d Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/pyproject-rpm-macros.git#6a8d86ed709871dc99fda2a02fb9e21d362c637e
2020-11-04 23:27:14 +01:00
Troy Dawson 89b6866906 RHEL 9.0.0 Alpha bootstrap
The content of this branch was automatically imported from Fedora ELN
with the following as its source:
https://src.fedoraproject.org/rpms/pyproject-rpm-macros#6a44fe2d7a819cdcb55159d19c6878419871b41f
2020-10-14 16:43:13 -07:00