mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-12 18:59:50 +03:00
main/dtc: upgrade to 1.7.2
fixes build with SWIG 4.3 and Python 3.12
This commit is contained in:
parent
205cab7c88
commit
38185ad0ba
4 changed files with 92 additions and 69 deletions
|
@ -1,7 +1,7 @@
|
|||
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
|
||||
pkgname=dtc
|
||||
pkgver=1.7.0
|
||||
pkgrel=2
|
||||
pkgver=1.7.2
|
||||
pkgrel=0
|
||||
pkgdesc="Device Tree Compiler"
|
||||
url="https://git.kernel.org/pub/scm/utils/dtc/dtc.git/"
|
||||
arch="all"
|
||||
|
@ -18,8 +18,7 @@ checkdepends="coreutils"
|
|||
subpackages="$pkgname-dev libfdt py3-libfdt-pyc py3-libfdt:py3_libfdt"
|
||||
source="https://kernel.org/pub/software/utils/dtc/dtc-$pkgver.tar.xz
|
||||
install-pylibfdt-to-destdir.patch
|
||||
pyscm.patch
|
||||
fix-tests-for-Python3.12.patch
|
||||
swig-4.3.patch
|
||||
"
|
||||
|
||||
prepare() {
|
||||
|
@ -54,8 +53,7 @@ py3_libfdt() {
|
|||
}
|
||||
|
||||
sha512sums="
|
||||
d3ba6902a9a2f2cdbaff55f12fca3cfe4a1ec5779074a38e3d8b88097c7abc981835957e8ce72971e10c131e05fde0b1b961768e888ff96d89e42c75edb53afb dtc-1.7.0.tar.xz
|
||||
30f3611175a5c29556282f3f2894701a5837eb869608d89d78c280af448bbc3a5b6c83f51c28f991847c0eb7c42aa57599bbc31433f1b3b2c8d162cb2169b91f dtc-1.7.2.tar.xz
|
||||
1c43dfae8d15861c4f0170f0df9ba63d197ab3be50e39fe5748e547074c52dc7b042ca5e9c64d3d4bb0a8e8cde8df7e71660cde93e9512923405c38debcaa01c install-pylibfdt-to-destdir.patch
|
||||
e74768f6bcbe0ba8060c7b0b449e533b2fbbf3ddc1c869b98cf3f78a858c63ba1d7d57b5163eb5be048c6f0be023360f709d621e2f88d4332a7ef8e8d125cc09 pyscm.patch
|
||||
2fc10469b4c1f5016cdccd1a1e24d1f0984267c88efe88d268d52d9a49c441d832f53bf004a5223810c82e0f10cf5b515d6a6ddb56e49ca5bb86b55724634f0b fix-tests-for-Python3.12.patch
|
||||
a615a9fb89691548e7c40e27dc6a06c371f76ee3945650c4bb21d36898aaf211a9cc90e2ba2a7710ae177f187f21d21eee6e77ad531eda49be1f89bef4371b75 swig-4.3.patch
|
||||
"
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
Description: Python3.12 causes breakage for get_mem_rsv in pylibfdt.
|
||||
|
||||
Author: Héctor Orón Martínez <zumbi@debian.org>
|
||||
|
||||
---
|
||||
|
||||
Bug: https://github.com/dgibson/dtc/issues/123
|
||||
Bug-Debian: https://bugs.debian.org/1061318
|
||||
Bug-Ubuntu: https://launchpad.net/bugs/2051399
|
||||
Last-Update: 2024-01-30
|
||||
|
||||
--- device-tree-compiler-1.7.0.orig/tests/pylibfdt_tests.py
|
||||
+++ device-tree-compiler-1.7.0/tests/pylibfdt_tests.py
|
||||
@@ -418,9 +418,14 @@ class PyLibfdtBasicTests(unittest.TestCa
|
||||
def testReserveMap(self):
|
||||
"""Test that we can access the memory reserve map"""
|
||||
self.assertEqual(2, self.fdt.num_mem_rsv())
|
||||
- self.assertEqual([ 0xdeadbeef00000000, 0x100000],
|
||||
- self.fdt.get_mem_rsv(0))
|
||||
- self.assertEqual([123456789, 0o10000], self.fdt.get_mem_rsv(1))
|
||||
+ if sys.version_info.major >= 3 and sys.version_info.minor >= 12:
|
||||
+ self.assertEqual([0, 0xdeadbeef00000000, 0x100000],
|
||||
+ self.fdt.get_mem_rsv(0))
|
||||
+ self.assertEqual([0, 123456789, 0o10000], self.fdt.get_mem_rsv(1))
|
||||
+ else:
|
||||
+ self.assertEqual([0xdeadbeef00000000, 0x100000],
|
||||
+ self.fdt.get_mem_rsv(0))
|
||||
+ self.assertEqual([123456789, 0o10000], self.fdt.get_mem_rsv(1))
|
||||
|
||||
def testEmpty(self):
|
||||
"""Test that we can create an empty tree"""
|
||||
@@ -615,7 +620,10 @@ class PyLibfdtSwTests(unittest.TestCase)
|
||||
|
||||
fdt = sw.as_fdt()
|
||||
self.assertEqual(2, fdt.num_mem_rsv())
|
||||
- self.assertEqual([TEST_ADDR_1, TEST_SIZE_1], fdt.get_mem_rsv(0))
|
||||
+ if sys.version_info.major >= 3 and sys.version_info.minor >= 12:
|
||||
+ self.assertEqual([0, TEST_ADDR_1, TEST_SIZE_1], fdt.get_mem_rsv(0))
|
||||
+ else:
|
||||
+ self.assertEqual([TEST_ADDR_1, TEST_SIZE_1], fdt.get_mem_rsv(0))
|
||||
|
||||
# Make sure we can add a few more things
|
||||
with sw.add_node('another'):
|
|
@ -1,19 +0,0 @@
|
|||
no setuptools_scm in main
|
||||
--
|
||||
diff --git a/setup.py b/setup.py
|
||||
index e82a832..da01efd 100755
|
||||
--- a/setup.py
|
||||
+++ b/setup.py
|
||||
@@ -49,11 +49,8 @@ class build_py(_build_py):
|
||||
|
||||
setup(
|
||||
name='libfdt',
|
||||
- use_scm_version={
|
||||
- "root": srcdir,
|
||||
- },
|
||||
cmdclass = {'build_py' : build_py},
|
||||
- setup_requires = ['setuptools_scm'],
|
||||
+ version="@VERSION@",
|
||||
author='Simon Glass',
|
||||
author_email='sjg@chromium.org',
|
||||
description='Python binding for libfdt',
|
87
main/dtc/swig-4.3.patch
Normal file
87
main/dtc/swig-4.3.patch
Normal file
|
@ -0,0 +1,87 @@
|
|||
Patch-Source: https://github.com/dgibson/dtc/pull/160
|
||||
|
||||
From d0b412518401cc4c9958926af006f83af17e69fc Mon Sep 17 00:00:00 2001
|
||||
From: Brandon Maier <brandon.maier@gmail.com>
|
||||
Date: Sun, 24 Nov 2024 15:48:04 -0600
|
||||
Subject: [PATCH] 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.maier@gmail.com>
|
||||
---
|
||||
pylibfdt/libfdt.i | 25 ++++++++++++++-----------
|
||||
1 file changed, 14 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/pylibfdt/libfdt.i b/pylibfdt/libfdt.i
|
||||
index 9f5b6a9c..bb9985c3 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):
|
Loading…
Add table
Add a link
Reference in a new issue