diff --git a/mesonpy-reproducible.patch b/mesonpy-reproducible.patch new file mode 100644 index 0000000..286c0fd --- /dev/null +++ b/mesonpy-reproducible.patch @@ -0,0 +1,24 @@ +Authors: code@bnavigator.de, bwiedemann@suse.com +Ref: https://github.com/openSUSE/python-rpm-macros/issues/182 +Ref: https://github.com/mesonbuild/meson-python/issues/671 + +Reproducible builds require a deterministic build path. +Use the python-rpm-macros shuffled build directory. + + +Index: meson_python-0.16.0/mesonpy/__init__.py +=================================================================== +--- meson_python-0.16.0.orig/mesonpy/__init__.py ++++ meson_python-0.16.0/mesonpy/__init__.py +@@ -943,7 +943,10 @@ def _project(config_settings: Optional[D + + with contextlib.ExitStack() as ctx: + if build_dir is None: +- build_dir = ctx.enter_context(tempfile.TemporaryDirectory(prefix='.mesonpy-', dir=source_dir)) ++ if(os.environ.get('SOURCE_DATE_EPOCH')): ++ build_dir = pathlib.Path(source_dir) / 'build' ++ else: ++ build_dir = ctx.enter_context(tempfile.TemporaryDirectory(prefix='.mesonpy-', dir=source_dir)) + yield Project(source_dir, build_dir, meson_args, editable_verbose) + + diff --git a/python-meson-python.changes b/python-meson-python.changes index 0a7a901..58dba6f 100644 --- a/python-meson-python.changes +++ b/python-meson-python.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Sun Sep 29 11:22:59 UTC 2024 - Ben Greiner + +- Add mesonpy-reproducible.patch gh#openSUSE/python-rpm-macros#182 + initiated by Bernhard Wiedemann @bmwiedemann + ------------------------------------------------------------------- Mon Jul 22 04:20:32 UTC 2024 - Andreas Stieger diff --git a/python-meson-python.spec b/python-meson-python.spec index cd8de69..71169ac 100644 --- a/python-meson-python.spec +++ b/python-meson-python.spec @@ -27,7 +27,10 @@ URL: https://github.com/mesonbuild/meson-python Source0: https://files.pythonhosted.org/packages/source/m/meson_python/meson_python-%{version}.tar.gz # PATCH-FEATURE-OPENSUSE mesonpy-trim-deps.patch code@bnavigator.de Patch11: mesonpy-trim-deps.patch +# PATCH-FEATURE-OPENSUSE mesonpy-reproducible.patch gh#openSUSE/python-rpm-macros#182 +Patch12: mesonpy-reproducible.patch BuildRequires: %{python_module base >= 3.7} +BuildRequires: %{python_module packaging >= 0.19} BuildRequires: %{python_module pip} BuildRequires: %{python_module pyproject-metadata >= 0.7.1} BuildRequires: %{python_module tomli >= 1.0.0 if %python-base < 3.11} @@ -35,6 +38,7 @@ BuildRequires: fdupes BuildRequires: meson >= 1.2.3 BuildRequires: ninja BuildRequires: python-rpm-macros +Requires: python-packaging >= 0.19 Requires: python-pyproject-metadata >= 0.7.1 BuildArch: noarch %if 0%{python_version_nodots} >= 312 @@ -76,7 +80,10 @@ modules implemented in languages such as C, C++, Cython, Fortran, Pythran, or Ru %check # test suite path issues donttest="test_vendored_meson" -%pytest -k "not ($donttest)" +%{python_expand # clear test builds +find tests -name build -type d -prune -print -exec rm -r {} + +$python -m pytest -v -k "not ($donttest)" +} %files %{python_files} %license LICENSE