From 10e61f9331cc7671068445fb19e69d669b7570f0 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Sun, 2 Jun 2024 12:01:43 -0400 Subject: sys-apps/dtc: enable py3.12 Use patch frol Deban to fix tests See: https://github.com/dgibson/dtc/issues/123 Closes: https://bugs.gentoo.org/929808 Signed-off-by: Craig Andrews --- sys-apps/dtc/dtc-1.7.0.ebuild | 3 +- sys-apps/dtc/dtc-9999.ebuild | 2 +- sys-apps/dtc/files/fix-tests-for-Python3.12.patch | 43 +++++++++++++++++++++++ 3 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 sys-apps/dtc/files/fix-tests-for-Python3.12.patch (limited to 'sys-apps') diff --git a/sys-apps/dtc/dtc-1.7.0.ebuild b/sys-apps/dtc/dtc-1.7.0.ebuild index f674774c831b..bcb50ad71a85 100644 --- a/sys-apps/dtc/dtc-1.7.0.ebuild +++ b/sys-apps/dtc/dtc-1.7.0.ebuild @@ -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() { diff --git a/sys-apps/dtc/dtc-9999.ebuild b/sys-apps/dtc/dtc-9999.ebuild index dd2aadfad28a..ad87023887a3 100644 --- a/sys-apps/dtc/dtc-9999.ebuild +++ b/sys-apps/dtc/dtc-9999.ebuild @@ -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 diff --git a/sys-apps/dtc/files/fix-tests-for-Python3.12.patch b/sys-apps/dtc/files/fix-tests-for-Python3.12.patch new file mode 100644 index 000000000000..7a08648f3835 --- /dev/null +++ b/sys-apps/dtc/files/fix-tests-for-Python3.12.patch @@ -0,0 +1,43 @@ +Description: Python3.12 causes breakage for get_mem_rsv in pylibfdt. + + Author: Héctor Orón Martínez + +--- + +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'): -- cgit v1.2.3-65-gdbad