From a55114152d497738e094599f257f5b4d17dbf9f2 Mon Sep 17 00:00:00 2001 From: DistroBaker Date: Fri, 8 Jan 2021 15:11:58 +0000 Subject: [PATCH] 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/libsolv.git#ecfbab2928b08e615fb8f818273b8869d82ded29 --- libsolv.spec | 19 ++++++++++++++- python3.10.patch | 63 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 python3.10.patch diff --git a/libsolv.spec b/libsolv.spec index 3493a4f..d050ac2 100644 --- a/libsolv.spec +++ b/libsolv.spec @@ -22,13 +22,18 @@ Name: lib%{libname} Version: 0.7.15 -Release: 1%{?dist} +Release: 3%{?dist} Summary: Package dependency solver License: BSD URL: https://github.com/openSUSE/libsolv Source: %{url}/archive/%{version}/%{name}-%{version}.tar.gz +# Python 3.10 compatibility backport: +# https://github.com/openSUSE/libsolv/commit/170f8550 +# https://github.com/openSUSE/libsolv/commit/e258226c +Patch1: python3.10.patch + BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: ninja-build @@ -168,6 +173,11 @@ Python 3 version. %check %ctest +# Python smoke test (not tested in %%ctest): +export PYTHONPATH=%{buildroot}%{python3_sitearch} +export LD_LIBRARY_PATH=%{buildroot}%{_libdir} +%{python3} -c 'import solv' + %files %license LICENSE* %doc README @@ -244,6 +254,13 @@ Python 3 version. %endif %changelog +* Thu Jan 7 2021 Vít Ondruch - 0.7.15-3 +- Rebuilt for https://fedoraproject.org/wiki/Changes/Ruby_3.0 + +* Mon Nov 16 2020 Miro Hrončok - 0.7.15-2 +- Backport upstream fix for Python 3.10 compatibility +- Fixes: rhbz#1896411 + * Mon Oct 19 2020 Igor Raits - 0.7.15-1 - Update to 0.7.15 diff --git a/python3.10.patch b/python3.10.patch new file mode 100644 index 0000000..19848c3 --- /dev/null +++ b/python3.10.patch @@ -0,0 +1,63 @@ +From 170f8550b89c6c9e61b40e782cd75148825c2e89 Mon Sep 17 00:00:00 2001 +From: Michael Schroeder +Date: Mon, 16 Nov 2020 13:45:13 +0100 +Subject: [PATCH] Use PyBytes_AsStringAndSize() instead of + PyObject_AsReadBuffer() for python3 + +PyObject_AsReadBuffer was deprecated since python-3.0 and has +now been removed in python-3.10. + +Fixes issue #410 +--- + bindings/solv.i | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/bindings/solv.i b/bindings/solv.i +index 48d3f1fb..0a8389a2 100644 +--- a/bindings/solv.i ++++ b/bindings/solv.i +@@ -44,7 +44,11 @@ typedef struct { + #if defined(SWIGPYTHON) + const void *pybuf = 0; + Py_ssize_t pysize = 0; ++#if PY_VERSION_HEX >= 0x03000000 ++ res = PyBytes_AsStringAndSize($input, &pybuf, &pysize); ++#else + res = PyObject_AsReadBuffer($input, &pybuf, &pysize); ++#endif + if (res < 0) { + %argument_fail(res, "BinaryBlob", $symname, $argnum); + } else { + +From e258226c2430db4f37a34c71e72b2d909fa407fe Mon Sep 17 00:00:00 2001 +From: Michael Schroeder +Date: Mon, 16 Nov 2020 15:11:14 +0100 +Subject: [PATCH] Properly escape preprocessor directives + +Otherwise swig will process them instead of the compiler + +Should have been in commit 170f8550b89c6c9e61b40e782cd75148825c2e89 +--- + bindings/solv.i | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/bindings/solv.i b/bindings/solv.i +index 0a8389a2..1882b135 100644 +--- a/bindings/solv.i ++++ b/bindings/solv.i +@@ -44,11 +44,11 @@ typedef struct { + #if defined(SWIGPYTHON) + const void *pybuf = 0; + Py_ssize_t pysize = 0; +-#if PY_VERSION_HEX >= 0x03000000 +- res = PyBytes_AsStringAndSize($input, &pybuf, &pysize); +-#else ++%#if PY_VERSION_HEX >= 0x03000000 ++ res = PyBytes_AsStringAndSize($input, (char **)&pybuf, &pysize); ++%#else + res = PyObject_AsReadBuffer($input, &pybuf, &pysize); +-#endif ++%#endif + if (res < 0) { + %argument_fail(res, "BinaryBlob", $symname, $argnum); + } else {