sys-apps/dtc: Sync with Gentoo

It's from Gentoo commit 10e61f9331cc7671068445fb19e69d669b7570f0.
This commit is contained in:
Flatcar Buildbot 2024-07-01 07:18:00 +00:00 committed by Mathieu Tortuyaux
parent 1d2510b351
commit 306ca88128
No known key found for this signature in database
GPG Key ID: AC5CCFB52545D9B8
3 changed files with 46 additions and 2 deletions

View File

@ -3,7 +3,7 @@
EAPI=8
PYTHON_COMPAT=( python3_{10..11} )
PYTHON_COMPAT=( python3_{10..12} )
inherit meson python-single-r1
if [[ ${PV} == 9999 ]] ; then
@ -44,6 +44,7 @@ DOCS=(
PATCHES=(
"${FILESDIR}"/${P}-meson-tests.patch
"${FILESDIR}"/${P}-meson-macos.patch
"${FILESDIR}"/fix-tests-for-Python3.12.patch
)
pkg_setup() {

View File

@ -3,7 +3,7 @@
EAPI=8
PYTHON_COMPAT=( python3_{10..11} )
PYTHON_COMPAT=( python3_{10..12} )
inherit meson python-single-r1
if [[ ${PV} == 9999 ]] ; then

View File

@ -0,0 +1,43 @@
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'):