From 753eface5e4f263e3e21df361551efcf22250aed4330589abb6f49e2d550a68e Mon Sep 17 00:00:00 2001 From: Martin Pluskal Date: Fri, 28 Apr 2023 09:05:31 +0000 Subject: [PATCH 1/4] Accepting request 1083477 from home:dirkmueller:Factory - add py311.patch to fix build against python 3.11 OBS-URL: https://build.opensuse.org/request/show/1083477 OBS-URL: https://build.opensuse.org/package/show/Application:Geo/zbar?expand=0&rev=53 --- py311.patch | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++ zbar.changes | 5 +++++ zbar.spec | 4 +++- 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 py311.patch diff --git a/py311.patch b/py311.patch new file mode 100644 index 0000000..ce652a3 --- /dev/null +++ b/py311.patch @@ -0,0 +1,60 @@ +From 9bb0cc43f7f9e9c676e07b2e511f03bfa1c491cb Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= + +Date: Wed, 21 Sep 2022 10:32:11 +0700 +Subject: [PATCH] python: enum: fix build for Python 3.11 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Python 3.9 introduced Py_SET_SIZE function to set size instead of +relying on Py_SIZE() as a macro [3.9]. + +Python 3.10 started to encourage to use Py_SET_SIZE instead of +assigning into return value of Py_SIZE [3.10]. + +Python 3.11 flips the switch, turn Py_SIZE into a function [3.11], +thus Py_SIZE(obj) will be a rvalue. We need to use Py_SET_SIZE +to set size now. + +[3.9]: https://docs.python.org/3.9/c-api/structures.html#c.Py_SET_SIZE +[3.10]: https://docs.python.org/3.10/c-api/structures.html#c.Py_SIZE +[3.11]: https://docs.python.org/3.11/c-api/structures.html#c.Py_SIZE + +Signed-off-by: Đoàn Trần Công Danh +Signed-off-by: Mauro Carvalho Chehab +--- + python/enum.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +Index: zbar-0.23.90/python/enum.c +=================================================================== +--- zbar-0.23.90.orig/python/enum.c ++++ zbar-0.23.90/python/enum.c +@@ -49,10 +49,13 @@ enumitem_new (PyTypeObject *type, + Py_DECREF(self); + return(NULL); + } +- + /* we assume the "fast path" for a single-digit ints (see longobject.c) */ + /* this also holds if we get a small_int preallocated long */ ++#if PY_VERSION_HEX >= 0x030900A4 ++ Py_SET_SIZE(&self->val, Py_SIZE(longval)); ++#else + Py_SIZE(&self->val) = Py_SIZE(longval); ++#endif + self->val.ob_digit[0] = longval->ob_digit[0]; + Py_DECREF(longval); + #else +@@ -143,7 +146,11 @@ zbarEnumItem_New (PyObject *byname, + + /* we assume the "fast path" for a single-digit ints (see longobject.c) */ + /* this also holds if we get a small_int preallocated long */ ++#if PY_VERSION_HEX >= 0x030900A4 ++ Py_SET_SIZE(&self->val, Py_SIZE(longval)); ++#else + Py_SIZE(&self->val) = Py_SIZE(longval); ++#endif + self->val.ob_digit[0] = longval->ob_digit[0]; + Py_DECREF(longval); + diff --git a/zbar.changes b/zbar.changes index 7db594a..a1f24a9 100644 --- a/zbar.changes +++ b/zbar.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Apr 28 08:21:42 UTC 2023 - Dirk Müller + +- add py311.patch to fix build against python 3.11 + ------------------------------------------------------------------- Mon Dec 19 15:04:25 UTC 2022 - pgajdos@suse.com diff --git a/zbar.spec b/zbar.spec index abd9dd1..0a9656c 100644 --- a/zbar.spec +++ b/zbar.spec @@ -1,7 +1,7 @@ # # spec file for package zbar # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # Copyright (c) 2010 Carlos Goncalves . # # All modifications and additions to the file contributed by third parties @@ -28,6 +28,8 @@ Group: Productivity/Other URL: https://github.com/mchehab/zbar Source0: https://linuxtv.org/downloads/%{name}/%{name}-%{version}.tar.bz2 Source98: baselibs.conf +# PATCH-FIX-UPSTREAM: fix build against python 3.11 - https://github.com/mchehab/zbar/commit/9bb0cc43f7f9e9c676e07b2e511f03bfa1c491cb +Patch1: py311.patch BuildRequires: libjpeg-devel BuildRequires: pkgconfig >= 0.9.0 BuildRequires: xmlto From 6e238f09ae1725b4f9662fd70643a0def96548fad06867a35fcda29c806897b6 Mon Sep 17 00:00:00 2001 From: OBS User buildservice-autocommit Date: Sat, 29 Apr 2023 15:27:48 +0000 Subject: [PATCH 2/4] Accepting request 1083495 from Application:Geo baserev update by copy to link target OBS-URL: https://build.opensuse.org/request/show/1083495 OBS-URL: https://build.opensuse.org/package/show/Application:Geo/zbar?expand=0&rev=54 --- py311.patch | 60 ---------------------------------------------------- zbar.changes | 5 ----- zbar.spec | 4 +--- 3 files changed, 1 insertion(+), 68 deletions(-) delete mode 100644 py311.patch diff --git a/py311.patch b/py311.patch deleted file mode 100644 index ce652a3..0000000 --- a/py311.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 9bb0cc43f7f9e9c676e07b2e511f03bfa1c491cb Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= - -Date: Wed, 21 Sep 2022 10:32:11 +0700 -Subject: [PATCH] python: enum: fix build for Python 3.11 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Python 3.9 introduced Py_SET_SIZE function to set size instead of -relying on Py_SIZE() as a macro [3.9]. - -Python 3.10 started to encourage to use Py_SET_SIZE instead of -assigning into return value of Py_SIZE [3.10]. - -Python 3.11 flips the switch, turn Py_SIZE into a function [3.11], -thus Py_SIZE(obj) will be a rvalue. We need to use Py_SET_SIZE -to set size now. - -[3.9]: https://docs.python.org/3.9/c-api/structures.html#c.Py_SET_SIZE -[3.10]: https://docs.python.org/3.10/c-api/structures.html#c.Py_SIZE -[3.11]: https://docs.python.org/3.11/c-api/structures.html#c.Py_SIZE - -Signed-off-by: Đoàn Trần Công Danh -Signed-off-by: Mauro Carvalho Chehab ---- - python/enum.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -Index: zbar-0.23.90/python/enum.c -=================================================================== ---- zbar-0.23.90.orig/python/enum.c -+++ zbar-0.23.90/python/enum.c -@@ -49,10 +49,13 @@ enumitem_new (PyTypeObject *type, - Py_DECREF(self); - return(NULL); - } -- - /* we assume the "fast path" for a single-digit ints (see longobject.c) */ - /* this also holds if we get a small_int preallocated long */ -+#if PY_VERSION_HEX >= 0x030900A4 -+ Py_SET_SIZE(&self->val, Py_SIZE(longval)); -+#else - Py_SIZE(&self->val) = Py_SIZE(longval); -+#endif - self->val.ob_digit[0] = longval->ob_digit[0]; - Py_DECREF(longval); - #else -@@ -143,7 +146,11 @@ zbarEnumItem_New (PyObject *byname, - - /* we assume the "fast path" for a single-digit ints (see longobject.c) */ - /* this also holds if we get a small_int preallocated long */ -+#if PY_VERSION_HEX >= 0x030900A4 -+ Py_SET_SIZE(&self->val, Py_SIZE(longval)); -+#else - Py_SIZE(&self->val) = Py_SIZE(longval); -+#endif - self->val.ob_digit[0] = longval->ob_digit[0]; - Py_DECREF(longval); - diff --git a/zbar.changes b/zbar.changes index a1f24a9..7db594a 100644 --- a/zbar.changes +++ b/zbar.changes @@ -1,8 +1,3 @@ -------------------------------------------------------------------- -Fri Apr 28 08:21:42 UTC 2023 - Dirk Müller - -- add py311.patch to fix build against python 3.11 - ------------------------------------------------------------------- Mon Dec 19 15:04:25 UTC 2022 - pgajdos@suse.com diff --git a/zbar.spec b/zbar.spec index 0a9656c..abd9dd1 100644 --- a/zbar.spec +++ b/zbar.spec @@ -1,7 +1,7 @@ # # spec file for package zbar # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2022 SUSE LLC # Copyright (c) 2010 Carlos Goncalves . # # All modifications and additions to the file contributed by third parties @@ -28,8 +28,6 @@ Group: Productivity/Other URL: https://github.com/mchehab/zbar Source0: https://linuxtv.org/downloads/%{name}/%{name}-%{version}.tar.bz2 Source98: baselibs.conf -# PATCH-FIX-UPSTREAM: fix build against python 3.11 - https://github.com/mchehab/zbar/commit/9bb0cc43f7f9e9c676e07b2e511f03bfa1c491cb -Patch1: py311.patch BuildRequires: libjpeg-devel BuildRequires: pkgconfig >= 0.9.0 BuildRequires: xmlto From fb2cb5923e3f7faad6e65a9165159c174cd38ebc5dd3dcda4168f5128462a93c Mon Sep 17 00:00:00 2001 From: OBS User buildservice-autocommit Date: Sat, 29 Apr 2023 15:27:48 +0000 Subject: [PATCH 3/4] Updating link to change in openSUSE:Factory/zbar revision 17 OBS-URL: https://build.opensuse.org/package/show/Application:Geo/zbar?expand=0&rev=fd85cd49153ce4dfcfb1aae1a23da66a --- py311.patch | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++ zbar.changes | 5 +++++ zbar.spec | 4 +++- 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 py311.patch diff --git a/py311.patch b/py311.patch new file mode 100644 index 0000000..ce652a3 --- /dev/null +++ b/py311.patch @@ -0,0 +1,60 @@ +From 9bb0cc43f7f9e9c676e07b2e511f03bfa1c491cb Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= + +Date: Wed, 21 Sep 2022 10:32:11 +0700 +Subject: [PATCH] python: enum: fix build for Python 3.11 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Python 3.9 introduced Py_SET_SIZE function to set size instead of +relying on Py_SIZE() as a macro [3.9]. + +Python 3.10 started to encourage to use Py_SET_SIZE instead of +assigning into return value of Py_SIZE [3.10]. + +Python 3.11 flips the switch, turn Py_SIZE into a function [3.11], +thus Py_SIZE(obj) will be a rvalue. We need to use Py_SET_SIZE +to set size now. + +[3.9]: https://docs.python.org/3.9/c-api/structures.html#c.Py_SET_SIZE +[3.10]: https://docs.python.org/3.10/c-api/structures.html#c.Py_SIZE +[3.11]: https://docs.python.org/3.11/c-api/structures.html#c.Py_SIZE + +Signed-off-by: Đoàn Trần Công Danh +Signed-off-by: Mauro Carvalho Chehab +--- + python/enum.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +Index: zbar-0.23.90/python/enum.c +=================================================================== +--- zbar-0.23.90.orig/python/enum.c ++++ zbar-0.23.90/python/enum.c +@@ -49,10 +49,13 @@ enumitem_new (PyTypeObject *type, + Py_DECREF(self); + return(NULL); + } +- + /* we assume the "fast path" for a single-digit ints (see longobject.c) */ + /* this also holds if we get a small_int preallocated long */ ++#if PY_VERSION_HEX >= 0x030900A4 ++ Py_SET_SIZE(&self->val, Py_SIZE(longval)); ++#else + Py_SIZE(&self->val) = Py_SIZE(longval); ++#endif + self->val.ob_digit[0] = longval->ob_digit[0]; + Py_DECREF(longval); + #else +@@ -143,7 +146,11 @@ zbarEnumItem_New (PyObject *byname, + + /* we assume the "fast path" for a single-digit ints (see longobject.c) */ + /* this also holds if we get a small_int preallocated long */ ++#if PY_VERSION_HEX >= 0x030900A4 ++ Py_SET_SIZE(&self->val, Py_SIZE(longval)); ++#else + Py_SIZE(&self->val) = Py_SIZE(longval); ++#endif + self->val.ob_digit[0] = longval->ob_digit[0]; + Py_DECREF(longval); + diff --git a/zbar.changes b/zbar.changes index 7db594a..a1f24a9 100644 --- a/zbar.changes +++ b/zbar.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Apr 28 08:21:42 UTC 2023 - Dirk Müller + +- add py311.patch to fix build against python 3.11 + ------------------------------------------------------------------- Mon Dec 19 15:04:25 UTC 2022 - pgajdos@suse.com diff --git a/zbar.spec b/zbar.spec index abd9dd1..0a9656c 100644 --- a/zbar.spec +++ b/zbar.spec @@ -1,7 +1,7 @@ # # spec file for package zbar # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # Copyright (c) 2010 Carlos Goncalves . # # All modifications and additions to the file contributed by third parties @@ -28,6 +28,8 @@ Group: Productivity/Other URL: https://github.com/mchehab/zbar Source0: https://linuxtv.org/downloads/%{name}/%{name}-%{version}.tar.bz2 Source98: baselibs.conf +# PATCH-FIX-UPSTREAM: fix build against python 3.11 - https://github.com/mchehab/zbar/commit/9bb0cc43f7f9e9c676e07b2e511f03bfa1c491cb +Patch1: py311.patch BuildRequires: libjpeg-devel BuildRequires: pkgconfig >= 0.9.0 BuildRequires: xmlto From de4a119d292434f3537f20f7503c9e8fbbb15f917da8d975a7ee49ca6b4b9b18 Mon Sep 17 00:00:00 2001 From: Martin Pluskal Date: Tue, 20 Jun 2023 11:25:01 +0000 Subject: [PATCH 4/4] - Modernise spec file - Split lang subpackage OBS-URL: https://build.opensuse.org/package/show/Application:Geo/zbar?expand=0&rev=55 --- zbar.changes | 6 ++++++ zbar.spec | 25 +++++++------------------ 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/zbar.changes b/zbar.changes index a1f24a9..a0f630f 100644 --- a/zbar.changes +++ b/zbar.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Jun 20 11:21:51 UTC 2023 - Martin Pluskal + +- Modernise spec file +- Split lang subpackage + ------------------------------------------------------------------- Fri Apr 28 08:21:42 UTC 2023 - Dirk Müller diff --git a/zbar.spec b/zbar.spec index 0a9656c..d663f88 100644 --- a/zbar.spec +++ b/zbar.spec @@ -24,7 +24,6 @@ Version: 0.23.90 Release: 0 Summary: Bar code reader License: LGPL-2.0-or-later -Group: Productivity/Other URL: https://github.com/mchehab/zbar Source0: https://linuxtv.org/downloads/%{name}/%{name}-%{version}.tar.bz2 Source98: baselibs.conf @@ -46,9 +45,7 @@ BuildRequires: pkgconfig(sm) BuildRequires: pkgconfig(x11) BuildRequires: pkgconfig(xext) BuildRequires: pkgconfig(xv) -%if 0%{?suse_version} < 1500 -BuildRequires: gcc7 -%endif +%lang_package %description ZBar reads bar codes from various sources, such as video streams, @@ -61,7 +58,6 @@ or integrated by other programs through a library. %package -n %{libname} Summary: Bar code reading library -Group: System/Libraries %description -n %{libname} ZBar reads bar codes from various sources, such as video streams, @@ -73,7 +69,6 @@ This package provides the ZBar library. %package -n lib%{name}-devel Summary: Development environment for the ZBar library -Group: Development/Libraries/C and C++ Requires: %{libname} = %{version} %description -n lib%{name}-devel @@ -83,14 +78,12 @@ applications using the zbar library. %package -n lib%{name}qt0 Summary: ZBar Qt bindings -Group: System/Libraries %description -n lib%{name}qt0 This package provides ZBar Qt bindings. %package -n lib%{name}qt-devel Summary: Development environment for the ZBar Qt bindings library -Group: Development/Libraries/C and C++ Requires: lib%{name}-devel = %{version} Requires: lib%{name}qt0 = %{version} @@ -101,7 +94,6 @@ applications using the zbar-qt library. %package -n python3-zbar Summary: Python3 module for ZBar -Group: Development/Languages/Python %description -n python3-zbar This package contains the module to use ZBar from python3. @@ -110,9 +102,6 @@ This package contains the module to use ZBar from python3. %autosetup -p1 %build -test -x "$(type -p gcc)" && export CC=$_ -test -x "$(type -p gcc-7)" && export CC=$_ -test -x "$(type -p gcc-8)" && export CC=$_ %configure \ --docdir=%{_docdir}/%{name} \ --disable-static \ @@ -127,16 +116,14 @@ find %{buildroot} -name "*.la" -or -name "*.a" | xargs rm -f rm -rf %{buildroot}%{_datadir}/doc/zbar-%{version}/ rm -f %{buildroot}%{_docdir}/zbar/{COPYING,LICENSE.md,INSTALL.md} -%{find_lang} %{name} +%find_lang %{name} # Lets wait for review first rm -rf %{buildroot}%{_sysconfdir}/dbus-1/system.d/org.linuxtv.Zbar.conf -%post -n %{libname} -p /sbin/ldconfig -%postun -n %{libname} -p /sbin/ldconfig -%post -n libzbarqt0 -p /sbin/ldconfig -%postun -n libzbarqt0 -p /sbin/ldconfig +%ldconfig_scriptlets -n %{libname} +%ldconfig_scriptlets -n libzbarqt0 -%files -f %{name}.lang +%files %license COPYING LICENSE.md %{_defaultdocdir}/%{name}/ %{_bindir}/zbarimg @@ -144,6 +131,8 @@ rm -rf %{buildroot}%{_sysconfdir}/dbus-1/system.d/org.linuxtv.Zbar.conf %{_bindir}/zbarcam-qt %{_mandir}/man1/* +%files lang -f %{name}.lang + %files -n %{libname} %{_libdir}/libzbar.so.%{sover}*