From 6cbe62a0cee10ecb05bcaddcfe0cd185a033d198 Mon Sep 17 00:00:00 2001 From: Trevor Gamblin Date: Thu, 11 Apr 2024 20:42:02 -0400 Subject: python3: upgrade 3.12.2 -> 3.12.3 Remove the following patch: 0001-gh-115133-Fix-tests-for-XMLPullParser-with-Expat-2.6.patch Which a different fix was submitted for in: c4fa79b924 [3.12] gh-115133: Fix tests for XMLPullParser with Expat 2.6.0 (GH-115164) (GH-115288) See: https://github.com/python/cpython/pull/115288 (related to CVE-2023-52425) Changelog: https://docs.python.org/3/whatsnew/changelog.html#python-3-12-3-final (From OE-Core rev: 4122d8f6ecf6957de7a34fc51beffcd8e808911f) Signed-off-by: Trevor Gamblin Signed-off-by: Richard Purdie --- meta/recipes-devtools/python/python3_3.12.3.bb | 470 +++++++++++++++++++++++++ 1 file changed, 470 insertions(+) create mode 100644 meta/recipes-devtools/python/python3_3.12.3.bb (limited to 'meta/recipes-devtools/python/python3_3.12.3.bb') diff --git a/meta/recipes-devtools/python/python3_3.12.3.bb b/meta/recipes-devtools/python/python3_3.12.3.bb new file mode 100644 index 0000000000..b49a58a101 --- /dev/null +++ b/meta/recipes-devtools/python/python3_3.12.3.bb @@ -0,0 +1,470 @@ +SUMMARY = "The Python Programming Language" +HOMEPAGE = "http://www.python.org" +DESCRIPTION = "Python is a programming language that lets you work more quickly and integrate your systems more effectively." +LICENSE = "PSF-2.0" +SECTION = "devel/python" + +LIC_FILES_CHKSUM = "file://LICENSE;md5=fcf6b249c2641540219a727f35d8d2c2" + +SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \ + file://run-ptest \ + file://create_manifest3.py \ + file://get_module_deps3.py \ + file://python3-manifest.json \ + file://check_build_completeness.py \ + file://reformat_sysconfig.py \ + file://cgi_py.patch \ + file://0001-Makefile.pre-use-qemu-wrapper-when-gathering-profile.patch \ + file://0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch \ + file://crosspythonpath.patch \ + file://0001-test_locale.py-correct-the-test-output-format.patch \ + file://0020-configure.ac-setup.py-do-not-add-a-curses-include-pa.patch \ + file://0001-Skip-failing-tests-due-to-load-variability-on-YP-AB.patch \ + file://0001-test_ctypes.test_find-skip-without-tools-sdk.patch \ + file://makerace.patch \ + file://0001-sysconfig.py-use-platlibdir-also-for-purelib.patch \ + file://0001-Lib-pty.py-handle-stdin-I-O-errors-same-way-as-maste.patch \ + file://deterministic_imports.patch \ + file://0001-Avoid-shebang-overflow-on-python-config.py.patch \ + file://0001-Update-test_sysconfig-for-posix_user-purelib.patch \ + file://0001-skip-no_stdout_fileno-test-due-to-load-variability.patch \ + file://0001-test_storlines-skip-due-to-load-variability.patch \ + file://0001-gh-114492-Initialize-struct-termios-before-calling-t.patch \ + " + +SRC_URI:append:class-native = " \ + file://0001-Lib-sysconfig.py-use-prefix-value-from-build-configu.patch \ + " + +SRC_URI[sha256sum] = "56bfef1fdfc1221ce6720e43a661e3eb41785dd914ce99698d8c7896af4bdaa1" + +# exclude pre-releases for both python 2.x and 3.x +UPSTREAM_CHECK_REGEX = "[Pp]ython-(?P\d+(\.\d+)+).tar" + +CVE_PRODUCT = "python cpython" + +CVE_STATUS[CVE-2007-4559] = "disputed: Upstream consider this expected behaviour" +CVE_STATUS[CVE-2019-18348] = "not-applicable-config: This is not exploitable when glibc has CVE-2016-10739 fixed" +CVE_STATUS[CVE-2020-15523] = "not-applicable-platform: Issue only applies on Windows" +CVE_STATUS[CVE-2022-26488] = "not-applicable-platform: Issue only applies on Windows" +# The module will be removed in the future and flaws documented. +CVE_STATUS[CVE-2015-20107] = "upstream-wontfix: The mailcap module is insecure by design, so this can't be fixed in a meaningful way" +CVE_STATUS[CVE-2023-36632] = "disputed: Not an issue, in fact expected behaviour" + +PYTHON_MAJMIN = "3.12" + +S = "${WORKDIR}/Python-${PV}" + +BBCLASSEXTEND = "native nativesdk" + +inherit autotools pkgconfig qemu ptest multilib_header update-alternatives + +MULTILIB_SUFFIX = "${@d.getVar('base_libdir',1).split('/')[-1]}" + +ALTERNATIVE:${PN}-dev = "python3-config" +ALTERNATIVE_LINK_NAME[python3-config] = "${bindir}/python${PYTHON_MAJMIN}-config" +ALTERNATIVE_TARGET[python3-config] = "${bindir}/python${PYTHON_MAJMIN}-config-${MULTILIB_SUFFIX}" + + +DEPENDS = "bzip2-replacement-native expat libffi bzip2 openssl sqlite3 zlib virtual/libintl xz virtual/crypt util-linux-libuuid libtirpc libnsl2 autoconf-archive-native ncurses" +DEPENDS:append:class-target = " python3-native" +DEPENDS:append:class-nativesdk = " python3-native" + +EXTRA_OECONF = " --without-ensurepip --enable-shared --with-platlibdir=${baselib} --with-system-expat" +EXTRA_OECONF:append:class-native = " --bindir=${bindir}/${PN}" +EXTRA_OECONF:append:class-target = " --with-build-python=nativepython3" +EXTRA_OECONF:append:class-nativesdk = " --with-build-python=nativepython3" + +export CROSSPYTHONPATH="${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/" + +EXTRANATIVEPATH += "python3-native" + +# LTO will be enabled via packageconfig depending upong distro features +LTO:class-target = "" + +CACHED_CONFIGUREVARS = " \ + ac_cv_file__dev_ptmx=yes \ + ac_cv_file__dev_ptc=no \ + ac_cv_working_tzset=yes \ +" +# set thread stack size to 2MB on musl for interpreter and stdlib C extensions +# so it does not run into stack limits due to musl's small thread stack +# This is only needed to build interpreter and not the subsequent modules +# Thats why CFLAGS_NODIST is modified instead of CFLAGS +CACHED_CONFIGUREVARS:append:libc-musl = "\ + CFLAGS_NODIST='${CFLAGS} -DTHREAD_STACK_SIZE=0x200000' \ +" + +# PGO currently causes builds to not be reproducible so disable by default, see YOCTO #13407 +PACKAGECONFIG ??= "editline gdbm ${@bb.utils.filter('DISTRO_FEATURES', 'lto', d)}" +PACKAGECONFIG[readline] = "--with-readline=readline,,readline,,,editline" +PACKAGECONFIG[editline] = "--with-readline=editline,,libedit,,,readline" +# Use profile guided optimisation by running PyBench inside qemu-user +PACKAGECONFIG[pgo] = "--enable-optimizations,,qemu-native" +PACKAGECONFIG[tk] = ",,tk" +PACKAGECONFIG[tcl] = ",,tcl" +PACKAGECONFIG[gdbm] = ",,gdbm" +PACKAGECONFIG[lto] = "--with-lto,--without-lto" + +do_configure:prepend () { + mkdir -p ${B}/Modules + cat > ${B}/Modules/Setup.local << EOF +*disabled* +${@bb.utils.contains('PACKAGECONFIG', 'gdbm', '', '_gdbm _dbm', d)} +${@bb.utils.contains_any('PACKAGECONFIG', 'readline editline', '', 'readline', d)} +${@bb.utils.contains('PACKAGECONFIG', 'tk', '', '_tkinter', d)} +EOF +} + +CPPFLAGS:append = " -I${STAGING_INCDIR}/ncursesw -I${STAGING_INCDIR}/uuid" + +# COMPILEALL_OPTS= ensures that .pyc are not compiled in parallel +# This was found to lock up builds, break reproducibility, and produce strange file ownership +# races. +# +# The upstream commit introducing the change was: +# https://github.com/python/cpython/commit/1a2dd82f56bd813aacc570e172cefe55a8a41504 +# +# The build lock up issue is reported here: +# https://bugs.python.org/issue45945 +# +# The repro failures are documented here: +# https://autobuilder.yocto.io/pub/repro-fail/oe-reproducible-20211130-yr_o1a8d/packages/diff-html/ + +EXTRA_OEMAKE = '\ + STAGING_LIBDIR=${STAGING_LIBDIR} \ + STAGING_INCDIR=${STAGING_INCDIR} \ + LIB=${baselib} \ + COMPILEALL_OPTS= \ +' + +# Generate a Profile Guided Optimisation wrapper script that uses qemu-user for +# all cross builds. +write_pgo_wrapper:class-native = ":" +write_pgo_wrapper() { + if ${@bb.utils.contains('PACKAGECONFIG', 'pgo', 'true', 'false', d)}; then + cat >pgo-wrapper <