diff --git a/macros.pyproject b/macros.pyproject index 6a54fb8..67afe89 100644 --- a/macros.pyproject +++ b/macros.pyproject @@ -15,17 +15,15 @@ %pyproject_record %{_builddir}/pyproject-record %pyproject_wheel() %{expand:\\\ -export TMPDIR="${PWD}/%{_pyproject_builddir}" -mkdir -p "${TMPDIR}" -CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}" \\\ +mkdir -p "${PWD}/%{_pyproject_builddir}" +CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}" TMPDIR="${PWD}/%{_pyproject_builddir}" \\\ %{__python3} -m pip wheel --wheel-dir %{_pyproject_wheeldir} --no-deps --use-pep517 --no-build-isolation --disable-pip-version-check --no-clean --progress-bar off --verbose . } %pyproject_install() %{expand:\\\ specifier=$(ls %{_pyproject_wheeldir}/*.whl | xargs basename --multiple | sed -E 's/([^-]+)-([^-]+)-.+\\\.whl/\\\1==\\\2/') -export TMPDIR="${PWD}/%{_pyproject_builddir}" -%{__python3} -m pip install --root %{buildroot} --no-deps --disable-pip-version-check --progress-bar off --verbose --ignore-installed --no-warn-script-location --no-index --no-cache-dir --find-links %{_pyproject_wheeldir} $specifier +TMPDIR="${PWD}/%{_pyproject_builddir}" %{__python3} -m pip install --root %{buildroot} --no-deps --disable-pip-version-check --progress-bar off --verbose --ignore-installed --no-warn-script-location --no-index --no-cache-dir --find-links %{_pyproject_wheeldir} $specifier if [ -d %{buildroot}%{_bindir} ]; then %py3_shebang_fix %{buildroot}%{_bindir}/* rm -rfv %{buildroot}%{_bindir}/__pycache__ diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index 8329f87..98578bc 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -12,7 +12,7 @@ License: MIT # In other cases, such as backports, increment the point # release. Version: 0 -Release: 39.2%{?dist} +Release: 40%{?dist} # Macro files Source001: macros.pyproject @@ -110,6 +110,9 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856 %license LICENSE %changelog +* Thu May 27 2021 Miro Hrončok - 0-40 +- Don't leak $TMPDIR outside of pyproject macros + * Thu Apr 22 2021 Miro Hrončok - 0-39.2 - Handle tox provision (tox.requires / tox.minversion) - Generate BuildRequires on extras in lower case diff --git a/tests/python-clikit.spec b/tests/python-clikit.spec index 4be859d..dbb0044 100644 --- a/tests/python-clikit.spec +++ b/tests/python-clikit.spec @@ -36,8 +36,15 @@ Summary: %{summary} %install +# Internal check that $TMPDIR is not changed +TPMDIR_original="$TMPDIR" + %pyproject_install +# Internal check that $TMPDIR is not changed +test "$TMPDIR" == "$TPMDIR_original" + + %check # Internal check that the RECORD and REQUESTED files are # always removed in %%pyproject_wheel