summaryrefslogtreecommitdiffstats
path: root/recipes-kernel
diff options
context:
space:
mode:
authorRoss Burton <ross@burtonini.com>2021-11-11 13:57:19 +0000
committerBruce Ashfield <bruce.ashfield@gmail.com>2021-11-11 08:59:11 -0500
commite13d364d7f4e49a7c051e1d0a5435370ea3b0b53 (patch)
treefb5028cc59c27ab5e6b5e9dcd6b47bcb5eebe10c /recipes-kernel
parentc5d89fea4a3a2da9ed0ddbe8811101644a1402b6 (diff)
downloadmeta-virtualization-e13d364d7f4e49a7c051e1d0a5435370ea3b0b53.tar.gz
python3-dtc: port to Python 3.10
Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Diffstat (limited to 'recipes-kernel')
-rw-r--r--recipes-kernel/dtc/files/ssize.patch35
-rw-r--r--recipes-kernel/dtc/python3-dtc_1.6.1.bb3
2 files changed, 37 insertions, 1 deletions
diff --git a/recipes-kernel/dtc/files/ssize.patch b/recipes-kernel/dtc/files/ssize.patch
new file mode 100644
index 00000000..3156896c
--- /dev/null
+++ b/recipes-kernel/dtc/files/ssize.patch
@@ -0,0 +1,35 @@
1Python 3.10 has made it mandatory that the 'string+length` formats use ssize_t
2instead of int, so define the magic symbol and upcast the ints from the libfdt
3API to ssize_t.
4
5Upstream-Status: Pending
6Signed-off-by: Ross Burton <ross.burton@arm.com>
7
8diff --git a/pylibfdt/libfdt.i b/pylibfdt/libfdt.i
9index 51ee801..075ef70 100644
10--- a/pylibfdt/libfdt.i
11+++ b/pylibfdt/libfdt.i
12@@ -1044,9 +1044,9 @@ typedef uint32_t fdt32_t;
13 $result = Py_None;
14 else
15 %#if PY_VERSION_HEX >= 0x03000000
16- $result = Py_BuildValue("y#", $1, *arg4);
17+ $result = Py_BuildValue("y#", $1, (Py_ssize_t)*arg4);
18 %#else
19- $result = Py_BuildValue("s#", $1, *arg4);
20+ $result = Py_BuildValue("s#", $1, (Py_ssize_t)*arg4);
21 %#endif
22 }
23
24diff --git a/pylibfdt/setup.py b/pylibfdt/setup.py
25index ef40f15..88ff7d1 100755
26--- a/pylibfdt/setup.py
27+++ b/pylibfdt/setup.py
28@@ -42,6 +42,7 @@ def get_version():
29 libfdt_module = Extension(
30 '_libfdt',
31 sources=[os.path.join(srcdir, 'libfdt.i')],
32+ define_macros=[('PY_SSIZE_T_CLEAN', None)],
33 include_dirs=[os.path.join(srcdir, '../libfdt')],
34 libraries=['fdt'],
35 library_dirs=[os.path.join(top_builddir, 'libfdt')],
diff --git a/recipes-kernel/dtc/python3-dtc_1.6.1.bb b/recipes-kernel/dtc/python3-dtc_1.6.1.bb
index 293c8d3e..d7d45a41 100644
--- a/recipes-kernel/dtc/python3-dtc_1.6.1.bb
+++ b/recipes-kernel/dtc/python3-dtc_1.6.1.bb
@@ -6,7 +6,8 @@ LICENSE = "GPLv2 | BSD-2-Clause"
6 6
7DEPENDS = "flex-native bison-native swig-native libyaml dtc" 7DEPENDS = "flex-native bison-native swig-native libyaml dtc"
8 8
9SRC_URI = "git://git.kernel.org/pub/scm/utils/dtc/dtc.git;branch=master" 9SRC_URI = "git://git.kernel.org/pub/scm/utils/dtc/dtc.git;branch=master \
10 file://ssize.patch"
10 11
11UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+(\.\d+)+)" 12UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+(\.\d+)+)"
12 13