Control: tags -1 patch upstream fixed-upstream

Dear maintainer,

On Sun, Dec 22, 2024 at 05:44:11PM +0100, Lucas Nussbaum wrote:
> > [...]
> > /<<PKGBUILDDIR>>/./pylibfdt/libfdt_wrap.c: In function 
> > ‘_wrap_fdt_next_node’:
> > /<<PKGBUILDDIR>>/./pylibfdt/libfdt_wrap.c:5599:17: error: too few arguments 
> > to function ‘SWIG_Python_AppendOutput’
> > [...]

FWIW, upstream addresses this in
<https://git.kernel.org/pub/scm/utils/dtc/dtc.git/commit/?id=d1e2384185c5eeb8e238f7a8174ff43ea0da5d92>.
However, while the build continues with this part applied (as is with
upstream 1.7.2 or slightly modified to work with the latest packaged
version 1.7.0), it later fails during tests for both versions.

Upstream 1.7.2 can then be made compatible with SWIG v4.3 by also
applying
<https://git.kernel.org/pub/scm/utils/dtc/dtc.git/commit/?id=9a969f3b70b07bbf1c9df44a38d7f8d1d3a6e2a5>
which so far is not part of any upstream release. With that and with
disabling fix-tests-for-Python3.12.patch the compilation and all tests
succeed. Of course the packaging will then need further adjustment for
the renaming as applied in upstream 1.7.1, but it seems that can be
resolved simply by dropping the first line of debian/libfdt1.install
which still refers to the old naming scheme.

Or at least the package build of upstream 1.7.2 then suceeds with the
above changes applied. I didn't test any further, though. Please find
attached the corresponding debdiff for the Debian parts.

HTH,
Flo
diff -Nru device-tree-compiler-1.7.0/debian/changelog 
device-tree-compiler-1.7.2/debian/changelog
--- device-tree-compiler-1.7.0/debian/changelog 2024-01-30 17:49:08.000000000 
+0100
+++ device-tree-compiler-1.7.2/debian/changelog 2024-12-23 16:28:43.000000000 
+0100
@@ -1,3 +1,10 @@
+device-tree-compiler (1.7.2-0.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * test build
+
+ -- Florian Ernst <flor...@debian.org>  Mon, 23 Dec 2024 16:28:43 +0100
+
 device-tree-compiler (1.7.0-2) unstable; urgency=medium
 
   * debian/patches/fix-tests-for-Python3.12.patch: new patch
diff -Nru device-tree-compiler-1.7.0/debian/libfdt1.install 
device-tree-compiler-1.7.2/debian/libfdt1.install
--- device-tree-compiler-1.7.0/debian/libfdt1.install   2024-01-30 
17:35:19.000000000 +0100
+++ device-tree-compiler-1.7.2/debian/libfdt1.install   2024-12-23 
16:28:43.000000000 +0100
@@ -1,2 +1 @@
-usr/lib/*/libfdt-*.so
 usr/lib/*/libfdt.so.*
diff -Nru 
device-tree-compiler-1.7.0/debian/patches/9a969f3b70b07bbf1c9df44a38d7f8d1d3a6e2a5.patch
 
device-tree-compiler-1.7.2/debian/patches/9a969f3b70b07bbf1c9df44a38d7f8d1d3a6e2a5.patch
--- 
device-tree-compiler-1.7.0/debian/patches/9a969f3b70b07bbf1c9df44a38d7f8d1d3a6e2a5.patch
    1970-01-01 01:00:00.000000000 +0100
+++ 
device-tree-compiler-1.7.2/debian/patches/9a969f3b70b07bbf1c9df44a38d7f8d1d3a6e2a5.patch
    2024-12-23 16:28:43.000000000 +0100
@@ -0,0 +1,88 @@
+From 9a969f3b70b07bbf1c9df44a38d7f8d1d3a6e2a5 Mon Sep 17 00:00:00 2001
+From: Brandon Maier <brandon.ma...@gmail.com>
+Date: Sun, 24 Nov 2024 15:48:04 -0600
+Subject: pylibfdt/libfdt.i: fix backwards compatibility of return values
+
+When our Python functions wrap `fdt_getprop()` they return a list
+containing `[*data, length]`.
+
+In SWIG v4.2 and earlier SWIG would discard `*data` if it is NULL/None.
+Causing the return value to just be `length`.
+
+But starting in SWIG v4.3 it no longer discards `*data`. So the return
+value is now `[None, length]`.
+
+Handle this compatibility issue in libfdt.i by checking if the return
+value looks like the older 4.2 return value, and casting it to the newer
+style.
+
+See https://github.com/swig/swig/pull/2907
+
+Signed-off-by: Brandon Maier <brandon.ma...@gmail.com>
+Signed-off-by: David Gibson <da...@gibson.dropbear.id.au>
+---
+ pylibfdt/libfdt.i | 25 ++++++++++++++-----------
+ 1 file changed, 14 insertions(+), 11 deletions(-)
+
+diff --git a/pylibfdt/libfdt.i b/pylibfdt/libfdt.i
+index 9f5b6a9..bb9985c 100644
+--- a/pylibfdt/libfdt.i
++++ b/pylibfdt/libfdt.i
+@@ -114,11 +114,14 @@ def check_err_null(val, quiet=()):
+         FdtException if val indicates an error was reported and the error
+         is not in @quiet.
+     """
+-    # Normally a list is returned which contains the data and its length.
+-    # If we get just an integer error code, it means the function failed.
++    # Compatibility for SWIG v4.2 and earlier. SWIG 4.2 would drop the first
++    # item from the list if it was None, returning only the second item.
+     if not isinstance(val, list):
+-        if -val not in quiet:
+-            raise FdtException(val)
++        val = [None, val]
++
++    if val[0] is None:
++        if -val[1] not in quiet:
++            raise FdtException(val[1])
+     return val
+ 
+ class FdtRo(object):
+@@ -395,8 +398,8 @@ class FdtRo(object):
+         """
+         pdata = check_err_null(
+                 fdt_get_property_by_offset(self._fdt, prop_offset), quiet)
+-        if isinstance(pdata, (int)):
+-            return pdata
++        if pdata[0] is None:
++            return pdata[1]
+         return Property(pdata[0], pdata[1])
+ 
+     def getprop(self, nodeoffset, prop_name, quiet=()):
+@@ -417,8 +420,8 @@ class FdtRo(object):
+         """
+         pdata = check_err_null(fdt_getprop(self._fdt, nodeoffset, prop_name),
+                                quiet)
+-        if isinstance(pdata, (int)):
+-            return pdata
++        if pdata[0] is None:
++            return pdata[1]
+         return Property(prop_name, bytearray(pdata[0]))
+ 
+     def hasprop(self, nodeoffset, prop_name, quiet=()):
+@@ -444,10 +447,10 @@ class FdtRo(object):
+         """
+         pdata = check_err_null(fdt_getprop(self._fdt, nodeoffset, prop_name),
+                                quiet + (NOTFOUND,))
+-        if isinstance(pdata, (int)):
+-            if pdata == -NOTFOUND:
++        if pdata[0] is None:
++            if pdata[1] == -NOTFOUND:
+                 return False
+-            return pdata
++            return pdata[1]
+         return True
+ 
+     def get_phandle(self, nodeoffset):
+-- 
+cgit 1.2.3-korg
+
diff -Nru device-tree-compiler-1.7.0/debian/patches/series 
device-tree-compiler-1.7.2/debian/patches/series
--- device-tree-compiler-1.7.0/debian/patches/series    2024-01-30 
17:29:37.000000000 +0100
+++ device-tree-compiler-1.7.2/debian/patches/series    2024-12-23 
16:28:43.000000000 +0100
@@ -1,3 +1,4 @@
 01_build_doc.patch
 02_Install_to_dist_packages.patch
-fix-tests-for-Python3.12.patch
+#fix-tests-for-Python3.12.patch
+9a969f3b70b07bbf1c9df44a38d7f8d1d3a6e2a5.patch

Attachment: signature.asc
Description: PGP signature

Reply via email to