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.
This commit is contained in:
Miro Hrončok 2022-03-22 16:48:20 +01:00
parent 50b5e637bf
commit ae639fc020
2 changed files with 13 additions and 5 deletions

View File

@ -10,10 +10,15 @@
# https://docs.pytest.org/en/latest/reference.html#confval-norecursedirs # https://docs.pytest.org/en/latest/reference.html#confval-norecursedirs
%_pyproject_builddir %{_builddir}%{?buildsubdir:/%{buildsubdir}}/.pyproject-builddir %_pyproject_builddir %{_builddir}%{?buildsubdir:/%{buildsubdir}}/.pyproject-builddir
%pyproject_files %{_builddir}/pyproject-files # We prefix all created files with this value to make them unique
%_pyproject_modules %{_builddir}/pyproject-modules # Ideally, we would put them into %%{buildsubdir}, but that value changes during the spec
%_pyproject_ghost_distinfo %{_builddir}/pyproject-ghost-distinfo # The used value is similar to the one used to define the default %%buildroot
%_pyproject_record %{_builddir}/pyproject-record %_pyproject_files_prefix %{name}-%{version}-%{release}.%{_arch}
%pyproject_files %{_builddir}/%{_pyproject_files_prefix}-pyproject-files
%_pyproject_modules %{_builddir}/%{_pyproject_files_prefix}-pyproject-modules
%_pyproject_ghost_distinfo %{_builddir}/%{_pyproject_files_prefix}-pyproject-ghost-distinfo
%_pyproject_record %{_builddir}/%{_pyproject_files_prefix}-pyproject-record
# Avoid leaking %%{_pyproject_builddir} to pytest collection # Avoid leaking %%{_pyproject_builddir} to pytest collection
# https://bugzilla.redhat.com/show_bug.cgi?id=1935212 # https://bugzilla.redhat.com/show_bug.cgi?id=1935212

View File

@ -10,7 +10,7 @@ License: MIT
# Increment Y and reset Z when new macros or features are added # Increment Y and reset Z when new macros or features are added
# Increment Z when this is a bugfix or a cosmetic change # Increment Z when this is a bugfix or a cosmetic change
# Dropping support for EOL Fedoras is *not* considered a breaking change # Dropping support for EOL Fedoras is *not* considered a breaking change
Version: 1.0.0 Version: 1.0.1
Release: 1%{?dist} Release: 1%{?dist}
# Macro files # Macro files
@ -121,6 +121,9 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856
%license LICENSE %license LICENSE
%changelog %changelog
* Tue Mar 22 2022 Miro Hrončok <mhroncok@redhat.com> - 1.0.1-1
- Prefix paths of intermediate files (such as %%{pyproject_files}) with NVRA
* Tue Mar 01 2022 Miro Hrončok <mhroncok@redhat.com> - 1.0.0-1 * Tue Mar 01 2022 Miro Hrončok <mhroncok@redhat.com> - 1.0.0-1
- Release final version 1.0.0 - Release final version 1.0.0