From eb5b220f0bf33b8a0456c560114cee9eb25e205883e9d7ab55190ad7551f6305 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Sun, 3 Jul 2022 21:02:04 +0000 Subject: [PATCH 1/2] Accepting request 986485 from home:adkorte:branches:devel:languages:python - 0002-reader-make-PY_SSIZE_T_CLEAN.patch added to fix boo#1200686 reader: make PY_SSIZE_T_CLEAN OBS-URL: https://build.opensuse.org/request/show/986485 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-systemd?expand=0&rev=20 --- 0002-reader-make-PY_SSIZE_T_CLEAN.patch | 46 +++++++++++++++++++++++++ python-systemd.changes | 6 ++++ python-systemd.spec | 6 ++-- 3 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 0002-reader-make-PY_SSIZE_T_CLEAN.patch diff --git a/0002-reader-make-PY_SSIZE_T_CLEAN.patch b/0002-reader-make-PY_SSIZE_T_CLEAN.patch new file mode 100644 index 0000000..5136979 --- /dev/null +++ b/0002-reader-make-PY_SSIZE_T_CLEAN.patch @@ -0,0 +1,46 @@ +From ab9f2797127b374665c37c06b02121f5dcf7d61c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Thu, 12 Nov 2020 16:55:56 +0100 +Subject: [PATCH 2/2] reader: make PY_SSIZE_T_CLEAN + +--- + systemd/_reader.c | 15 +++++++++++++-- + 1 file changed, 13 insertions(+), 2 deletions(-) + +diff --git a/systemd/_reader.c b/systemd/_reader.c +index 8de7f6a963..3b6a4d0bbc 100644 +--- a/systemd/_reader.c ++++ b/systemd/_reader.c +@@ -18,7 +18,12 @@ + along with python-systemd; If not, see . + ***/ + ++#define PY_SSIZE_T_CLEAN ++#pragma GCC diagnostic push ++#pragma GCC diagnostic ignored "-Wredundant-decls" + #include ++#pragma GCC diagnostic pop ++ + #include + #include + #include +@@ -710,11 +715,17 @@ PyDoc_STRVAR(Reader_add_match__doc__, + "Match is a string of the form \"FIELD=value\"."); + static PyObject* Reader_add_match(Reader *self, PyObject *args, PyObject *keywds) { + char *match; +- int match_len, r; ++ Py_ssize_t match_len; ++ int r; + if (!PyArg_ParseTuple(args, "s#:add_match", &match, &match_len)) + return NULL; + +- r = sd_journal_add_match(self->j, match, match_len); ++ if (match_len > INT_MAX) { ++ set_error(-ENOBUFS, NULL, NULL); ++ return NULL; ++ } ++ ++ r = sd_journal_add_match(self->j, match, (int) match_len); + if (set_error(r, NULL, "Invalid match") < 0) + return NULL; + diff --git a/python-systemd.changes b/python-systemd.changes index 5c42b1a..cf913ba 100644 --- a/python-systemd.changes +++ b/python-systemd.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Sun Jul 3 18:00:37 UTC 2022 - Arjen de Korte + +- 0002-reader-make-PY_SSIZE_T_CLEAN.patch added to fix boo#1200686 + reader: make PY_SSIZE_T_CLEAN + ------------------------------------------------------------------- Sun Feb 2 14:05:14 UTC 2020 - Dominique Leuenberger diff --git a/python-systemd.spec b/python-systemd.spec index 2cff4ae..8af921c 100644 --- a/python-systemd.spec +++ b/python-systemd.spec @@ -30,6 +30,8 @@ Source: https://github.com/systemd/%{name}/archive/v%{version}.tar.gz#/% Patch1: iso-c-90.patch # PATCH-FIX-OPENSUSE exclude-tests-on-obs.patch removes a test when running tests at OBS. Should be removed as soon as OBS is fixed Patch100: exclude-tests-on-obs.patch +# PATCH-FIX-UPSTREAM reader: make PY_SSIZE_T_CLEAN +Patch101: 0002-reader-make-PY_SSIZE_T_CLEAN.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module setuptools} BuildRequires: fdupes @@ -53,9 +55,7 @@ Python module for native access to the systemd facilities. Functionality is sepe * systemd.login wraps parts of libsystemd used to query logged in users and available seats and machines. %prep -%setup -q -%patch1 -p1 -%patch100 -p1 +%autosetup -p1 %build %python_build From 06a65d5bde0a5855e8732bfa32450532200b7babc775a969dbfc5d7971711b64 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Sun, 3 Jul 2022 21:45:54 +0000 Subject: [PATCH 2/2] - Remove exclude-tests-on-obs.patch, this is not the way how to do it, besides %python_exec setup.py check doesn't the test suite. - Make tests running properly again OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-systemd?expand=0&rev=21 --- 0002-reader-make-PY_SSIZE_T_CLEAN.patch | 6 ++---- exclude-tests-on-obs.patch | 22 --------------------- python-systemd.changes | 8 ++++++++ python-systemd.spec | 26 ++++++++++++------------- 4 files changed, 22 insertions(+), 40 deletions(-) delete mode 100644 exclude-tests-on-obs.patch diff --git a/0002-reader-make-PY_SSIZE_T_CLEAN.patch b/0002-reader-make-PY_SSIZE_T_CLEAN.patch index 5136979..cbd26d6 100644 --- a/0002-reader-make-PY_SSIZE_T_CLEAN.patch +++ b/0002-reader-make-PY_SSIZE_T_CLEAN.patch @@ -4,11 +4,9 @@ Date: Thu, 12 Nov 2020 16:55:56 +0100 Subject: [PATCH 2/2] reader: make PY_SSIZE_T_CLEAN --- - systemd/_reader.c | 15 +++++++++++++-- + systemd/_reader.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) -diff --git a/systemd/_reader.c b/systemd/_reader.c -index 8de7f6a963..3b6a4d0bbc 100644 --- a/systemd/_reader.c +++ b/systemd/_reader.c @@ -18,7 +18,12 @@ @@ -24,7 +22,7 @@ index 8de7f6a963..3b6a4d0bbc 100644 #include #include #include -@@ -710,11 +715,17 @@ PyDoc_STRVAR(Reader_add_match__doc__, +@@ -707,11 +712,17 @@ PyDoc_STRVAR(Reader_add_match__doc__, "Match is a string of the form \"FIELD=value\"."); static PyObject* Reader_add_match(Reader *self, PyObject *args, PyObject *keywds) { char *match; diff --git a/exclude-tests-on-obs.patch b/exclude-tests-on-obs.patch deleted file mode 100644 index 87c6b58..0000000 --- a/exclude-tests-on-obs.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff -ur python-systemd-234-orig/systemd/test/test_journal.py python-systemd-234/systemd/test/test_journal.py ---- python-systemd-234-orig/systemd/test/test_journal.py 2017-03-26 03:33:59.000000000 +0200 -+++ python-systemd-234/systemd/test/test_journal.py 2017-06-26 11:15:19.961627278 +0200 -@@ -215,12 +215,12 @@ - j.this_boot(TEST_MID) - j.this_boot(TEST_MID.hex) - --def test_reader_this_machine(tmpdir): -- j = journal.Reader(path=tmpdir.strpath) -- with j: -- j.this_machine() -- j.this_machine(TEST_MID) -- j.this_machine(TEST_MID.hex) -+#def test_reader_this_machine(tmpdir): -+# j = journal.Reader(path=tmpdir.strpath) -+# with j: -+# j.this_machine() -+# j.this_machine(TEST_MID) -+# j.this_machine(TEST_MID.hex) - - def test_reader_query_unique(tmpdir): - j = journal.Reader(path=tmpdir.strpath) diff --git a/python-systemd.changes b/python-systemd.changes index cf913ba..d0d5d5e 100644 --- a/python-systemd.changes +++ b/python-systemd.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Sun Jul 3 21:14:35 UTC 2022 - Matej Cepl + +- Remove exclude-tests-on-obs.patch, this is not the way how to + do it, besides %python_exec setup.py check doesn't the test + suite. +- Make tests running properly again + ------------------------------------------------------------------- Sun Jul 3 18:00:37 UTC 2022 - Arjen de Korte diff --git a/python-systemd.spec b/python-systemd.spec index 8af921c..877b699 100644 --- a/python-systemd.spec +++ b/python-systemd.spec @@ -1,7 +1,7 @@ # # spec file for package python-systemd # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,6 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} -%bcond_without test Name: python-systemd Version: 234 Release: 0 @@ -28,10 +27,10 @@ URL: https://github.com/systemd/python-systemd Source: https://github.com/systemd/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz # PATCH-FIX-OPENSUSE iso-c-90.patch makes the building iso-c-90 compatible to allow building on SLE12 SP3 Patch1: iso-c-90.patch -# PATCH-FIX-OPENSUSE exclude-tests-on-obs.patch removes a test when running tests at OBS. Should be removed as soon as OBS is fixed -Patch100: exclude-tests-on-obs.patch -# PATCH-FIX-UPSTREAM reader: make PY_SSIZE_T_CLEAN -Patch101: 0002-reader-make-PY_SSIZE_T_CLEAN.patch +# PATCH-FIX-UPSTREAM 0002-reader-make-PY_SSIZE_T_CLEAN.patch gh#systemd/python-systemd#107 mcepl@suse.com +# Originally from gh#systemd/python-systemd/commit/c71bbac357f0 +# make PY_SSIZE_T_CLEAN +Patch2: 0002-reader-make-PY_SSIZE_T_CLEAN.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module setuptools} BuildRequires: fdupes @@ -42,9 +41,7 @@ BuildRequires: pkgconfig(libsystemd) Requires: systemd Suggests: %{name}-doc # /SECTION -%if %{with test} BuildRequires: %{python_module pytest} -%endif %python_subpackages %description @@ -62,15 +59,16 @@ Python module for native access to the systemd facilities. Functionality is sepe %install %python_install -%fdupes %{buildroot} +%python_expand %fdupes %{buildroot}%{$python_sitearch} -%if %{with test} %check -%python_exec setup.py check -%endif +export PYTEST_ADDOPTS="-k 'not test_reader_this_machine'" +%python_expand make PYTHON=python%{$python_version} check %files %{python_files} -%doc LICENSE.txt README.md -%{python_sitearch}/* +%license LICENSE.txt +%doc README.md +%{python_sitearch}/systemd +%{python_sitearch}/systemd_python-%{version}*-info %changelog