From ae639fc020983472ca7ac3bf1b4db68c5e400b98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 22 Mar 2022 16:48:20 +0100 Subject: [PATCH] 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. --- macros.pyproject | 13 +++++++++---- pyproject-rpm-macros.spec | 5 ++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/macros.pyproject b/macros.pyproject index 09bbe2d..a3cd744 100644 --- a/macros.pyproject +++ b/macros.pyproject @@ -10,10 +10,15 @@ # https://docs.pytest.org/en/latest/reference.html#confval-norecursedirs %_pyproject_builddir %{_builddir}%{?buildsubdir:/%{buildsubdir}}/.pyproject-builddir -%pyproject_files %{_builddir}/pyproject-files -%_pyproject_modules %{_builddir}/pyproject-modules -%_pyproject_ghost_distinfo %{_builddir}/pyproject-ghost-distinfo -%_pyproject_record %{_builddir}/pyproject-record +# We prefix all created files with this value to make them unique +# Ideally, we would put them into %%{buildsubdir}, but that value changes during the spec +# The used value is similar to the one used to define the default %%buildroot +%_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 # https://bugzilla.redhat.com/show_bug.cgi?id=1935212 diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index e0b7522..9b6b9cb 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -10,7 +10,7 @@ License: MIT # Increment Y and reset Z when new macros or features are added # Increment Z when this is a bugfix or a cosmetic change # Dropping support for EOL Fedoras is *not* considered a breaking change -Version: 1.0.0 +Version: 1.0.1 Release: 1%{?dist} # Macro files @@ -121,6 +121,9 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856 %license LICENSE %changelog +* Tue Mar 22 2022 Miro Hrončok - 1.0.1-1 +- Prefix paths of intermediate files (such as %%{pyproject_files}) with NVRA + * Tue Mar 01 2022 Miro Hrončok - 1.0.0-1 - Release final version 1.0.0