diff options
| author | Peter Marko <peter.marko@siemens.com> | 2025-06-08 23:43:47 +0200 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2025-06-13 08:42:35 -0700 |
| commit | 8cd040c21873bbba5008c725a8eb412b128b7f6a (patch) | |
| tree | 9512b7d7da865b982b3e29bfaf86a1201c1ee150 /meta/recipes-devtools/python/python3_3.10.18.bb | |
| parent | 57421fdde6b8202f64ff0bdf911e56398fc07853 (diff) | |
| download | poky-8cd040c21873bbba5008c725a8eb412b128b7f6a.tar.gz | |
python3: upgrade 3.10.16 -> 3.10.18
Drop upstreamed patch and refresh remaining patches.
* https://www.python.org/downloads/release/python-31017/
Security content in this release
* gh-131809: Upgrade vendored expat to 2.7.1
* gh-80222: Folding of quoted string in display_name violates RFC
* gh-121284: Invalid RFC 2047 address header after refolding with
email.policy.default
* gh-131261: Update libexpat to 2.7.0
* gh-105704: CVE-2025-0938 urlparse does not flag hostname containing
[ or ] as incorrect
* gh-119511: OOM vulnerability in the imaplib module
* https://www.python.org/downloads/release/python-31018/
Security content in this release
* gh-135034: [CVE 2024-12718] [CVE 2025-4138] [CVE 2025-4330]
[CVE 2025-4435] [CVE 2025-4517] Fixes multiple issues that allowed
tarfile extraction filters (filter="data" and filter="tar") to be
bypassed using crafted symlinks and hard links.
* gh-133767: Fix use-after-free in the “unicode-escape” decoder with a
non-“strict” error handler.
* gh-128840: Short-circuit the processing of long IPv6 addresses early
in ipaddress to prevent excessive memory consumption and a minor
denial-of-service.
gh-133767 got meawhile CVE-2025-4516 assigned.
(From OE-Core rev: 838a8b5ca148dfa6c6c2c76f1705d1e358a31648)
Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta/recipes-devtools/python/python3_3.10.18.bb')
| -rw-r--r-- | meta/recipes-devtools/python/python3_3.10.18.bb | 435 |
1 files changed, 435 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python3_3.10.18.bb b/meta/recipes-devtools/python/python3_3.10.18.bb new file mode 100644 index 0000000000..0b57a0ebee --- /dev/null +++ b/meta/recipes-devtools/python/python3_3.10.18.bb | |||
| @@ -0,0 +1,435 @@ | |||
| 1 | SUMMARY = "The Python Programming Language" | ||
| 2 | HOMEPAGE = "http://www.python.org" | ||
| 3 | DESCRIPTION = "Python is a programming language that lets you work more quickly and integrate your systems more effectively." | ||
| 4 | LICENSE = "PSF-2.0" | ||
| 5 | SECTION = "devel/python" | ||
| 6 | |||
| 7 | LIC_FILES_CHKSUM = "file://LICENSE;md5=fcf6b249c2641540219a727f35d8d2c2" | ||
| 8 | |||
| 9 | SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \ | ||
| 10 | file://run-ptest \ | ||
| 11 | file://create_manifest3.py \ | ||
| 12 | file://get_module_deps3.py \ | ||
| 13 | file://python3-manifest.json \ | ||
| 14 | file://check_build_completeness.py \ | ||
| 15 | file://reformat_sysconfig.py \ | ||
| 16 | file://cgi_py.patch \ | ||
| 17 | file://0001-Do-not-add-usr-lib-termcap-to-linker-flags-to-avoid-.patch \ | ||
| 18 | ${@bb.utils.contains('PACKAGECONFIG', 'tk', '', 'file://avoid_warning_about_tkinter.patch', d)} \ | ||
| 19 | file://0001-Do-not-use-the-shell-version-of-python-config-that-w.patch \ | ||
| 20 | file://python-config.patch \ | ||
| 21 | file://0001-Makefile.pre-use-qemu-wrapper-when-gathering-profile.patch \ | ||
| 22 | file://0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch \ | ||
| 23 | file://0001-bpo-36852-proper-detection-of-mips-architecture-for-.patch \ | ||
| 24 | file://crosspythonpath.patch \ | ||
| 25 | file://0001-Use-FLAG_REF-always-for-interned-strings.patch \ | ||
| 26 | file://0001-test_locale.py-correct-the-test-output-format.patch \ | ||
| 27 | file://0017-setup.py-do-not-report-missing-dependencies-for-disa.patch \ | ||
| 28 | file://0001-Makefile-do-not-compile-.pyc-in-parallel.patch \ | ||
| 29 | file://0020-configure.ac-setup.py-do-not-add-a-curses-include-pa.patch \ | ||
| 30 | file://0001-Skip-failing-tests-due-to-load-variability-on-YP-AB.patch \ | ||
| 31 | file://0001-test_ctypes.test_find-skip-without-tools-sdk.patch \ | ||
| 32 | file://makerace.patch \ | ||
| 33 | file://0001-sysconfig.py-use-platlibdir-also-for-purelib.patch \ | ||
| 34 | file://0001-Lib-pty.py-handle-stdin-I-O-errors-same-way-as-maste.patch \ | ||
| 35 | file://0001-setup.py-Do-not-detect-multiarch-paths-when-cross-co.patch \ | ||
| 36 | file://deterministic_imports.patch \ | ||
| 37 | file://0001-Avoid-shebang-overflow-on-python-config.py.patch \ | ||
| 38 | file://0001-test_storlines-skip-due-to-load-variability.patch \ | ||
| 39 | file://0001-gh-107811-tarfile-treat-overflow-in-UID-GID-as-failu.patch \ | ||
| 40 | " | ||
| 41 | |||
| 42 | SRC_URI:append:class-native = " \ | ||
| 43 | file://0001-Lib-sysconfig.py-use-prefix-value-from-build-configu.patch \ | ||
| 44 | file://0001-distutils-sysconfig-append-STAGING_LIBDIR-python-sys.patch \ | ||
| 45 | file://12-distutils-prefix-is-inside-staging-area.patch \ | ||
| 46 | file://0001-Don-t-search-system-for-headers-libraries.patch \ | ||
| 47 | " | ||
| 48 | SRC_URI[sha256sum] = "ae665bc678abd9ab6a6e1573d2481625a53719bc517e9a634ed2b9fefae3817f" | ||
| 49 | |||
| 50 | # exclude pre-releases for both python 2.x and 3.x | ||
| 51 | UPSTREAM_CHECK_REGEX = "[Pp]ython-(?P<pver>\d+(\.\d+)+).tar" | ||
| 52 | UPSTREAM_CHECK_URI = "https://www.python.org/downloads/source/" | ||
| 53 | |||
| 54 | CVE_PRODUCT = "python" | ||
| 55 | |||
| 56 | # Upstream consider this expected behaviour | ||
| 57 | CVE_CHECK_IGNORE += "CVE-2007-4559" | ||
| 58 | # This is not exploitable when glibc has CVE-2016-10739 fixed. | ||
| 59 | CVE_CHECK_IGNORE += "CVE-2019-18348" | ||
| 60 | # These are specific to Microsoft Windows | ||
| 61 | CVE_CHECK_IGNORE += "CVE-2020-15523 CVE-2022-26488" | ||
| 62 | # The mailcap module is insecure by design, so this can't be fixed in a meaningful way. | ||
| 63 | # The module will be removed in the future and flaws documented. | ||
| 64 | CVE_CHECK_IGNORE += "CVE-2015-20107" | ||
| 65 | # Not an issue, in fact expected behaviour | ||
| 66 | CVE_CHECK_IGNORE += "CVE-2023-36632" | ||
| 67 | # Fixes are included in 3.10.15 | ||
| 68 | CVE_CHECK_IGNORE += "CVE-2023-27043 CVE-2024-6232 CVE-2024-7592" | ||
| 69 | |||
| 70 | PYTHON_MAJMIN = "3.10" | ||
| 71 | |||
| 72 | S = "${WORKDIR}/Python-${PV}" | ||
| 73 | |||
| 74 | BBCLASSEXTEND = "native nativesdk" | ||
| 75 | |||
| 76 | inherit autotools pkgconfig qemu ptest multilib_header update-alternatives | ||
| 77 | |||
| 78 | MULTILIB_SUFFIX = "${@d.getVar('base_libdir',1).split('/')[-1]}" | ||
| 79 | |||
| 80 | ALTERNATIVE:${PN}-dev = "python3-config" | ||
| 81 | ALTERNATIVE_LINK_NAME[python3-config] = "${bindir}/python${PYTHON_MAJMIN}-config" | ||
| 82 | ALTERNATIVE_TARGET[python3-config] = "${bindir}/python${PYTHON_MAJMIN}-config-${MULTILIB_SUFFIX}" | ||
| 83 | |||
| 84 | |||
| 85 | DEPENDS = "bzip2-replacement-native libffi bzip2 openssl sqlite3 zlib virtual/libintl xz virtual/crypt util-linux-libuuid libtirpc libnsl2 autoconf-archive-native ncurses" | ||
| 86 | DEPENDS:append:class-target = " python3-native" | ||
| 87 | DEPENDS:append:class-nativesdk = " python3-native" | ||
| 88 | |||
| 89 | # force to use the mutex+cond implementation (https://bugs.python.org/issue41710) | ||
| 90 | CFLAGS += "-DHAVE_BROKEN_POSIX_SEMAPHORES" | ||
| 91 | |||
| 92 | EXTRA_OECONF = " --without-ensurepip --enable-shared --with-platlibdir=${baselib}" | ||
| 93 | EXTRA_OECONF:append:class-native = " --bindir=${bindir}/${PN}" | ||
| 94 | |||
| 95 | export CROSSPYTHONPATH="${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/" | ||
| 96 | |||
| 97 | EXTRANATIVEPATH += "python3-native" | ||
| 98 | |||
| 99 | # LTO will be enabled via packageconfig depending upong distro features | ||
| 100 | LTO:class-target = "" | ||
| 101 | |||
| 102 | CACHED_CONFIGUREVARS = " \ | ||
| 103 | ac_cv_file__dev_ptmx=yes \ | ||
| 104 | ac_cv_file__dev_ptc=no \ | ||
| 105 | ac_cv_working_tzset=yes \ | ||
| 106 | " | ||
| 107 | |||
| 108 | # PGO currently causes builds to not be reproducible so disable by default, see YOCTO #13407 | ||
| 109 | PACKAGECONFIG:class-target ??= "readline gdbm ${@bb.utils.filter('DISTRO_FEATURES', 'lto', d)}" | ||
| 110 | PACKAGECONFIG:class-native ??= "readline gdbm" | ||
| 111 | PACKAGECONFIG:class-nativesdk ??= "readline gdbm" | ||
| 112 | PACKAGECONFIG[readline] = "--with-readline=readline,,readline,,,editline" | ||
| 113 | PACKAGECONFIG[editline] = "--with-readline=editline,,libedit,,,readline" | ||
| 114 | # Use profile guided optimisation by running PyBench inside qemu-user | ||
| 115 | PACKAGECONFIG[pgo] = "--enable-optimizations,,qemu-native" | ||
| 116 | PACKAGECONFIG[tk] = ",,tk" | ||
| 117 | PACKAGECONFIG[gdbm] = ",,gdbm" | ||
| 118 | PACKAGECONFIG[lto] = "--with-lto,," | ||
| 119 | |||
| 120 | do_configure:prepend () { | ||
| 121 | mkdir -p ${B}/Modules | ||
| 122 | cat > ${B}/Modules/Setup.local << EOF | ||
| 123 | *disabled* | ||
| 124 | ${@bb.utils.contains('PACKAGECONFIG', 'gdbm', '', '_gdbm _dbm', d)} | ||
| 125 | ${@bb.utils.contains_any('PACKAGECONFIG', 'readline editline', '', 'readline', d)} | ||
| 126 | EOF | ||
| 127 | } | ||
| 128 | |||
| 129 | CPPFLAGS:append = " -I${STAGING_INCDIR}/ncursesw -I${STAGING_INCDIR}/uuid" | ||
| 130 | |||
| 131 | EXTRA_OEMAKE = '\ | ||
| 132 | STAGING_LIBDIR=${STAGING_LIBDIR} \ | ||
| 133 | STAGING_INCDIR=${STAGING_INCDIR} \ | ||
| 134 | LIB=${baselib} \ | ||
| 135 | ' | ||
| 136 | |||
| 137 | do_compile:prepend:class-target() { | ||
| 138 | if ${@bb.utils.contains('PACKAGECONFIG', 'pgo', 'true', 'false', d)}; then | ||
| 139 | qemu_binary="${@qemu_wrapper_cmdline(d, '${STAGING_DIR_TARGET}', ['${B}', '${STAGING_DIR_TARGET}/${base_libdir}'])}" | ||
| 140 | cat >pgo-wrapper <<EOF | ||
| 141 | #!/bin/sh | ||
| 142 | cd ${B} | ||
| 143 | $qemu_binary "\$@" | ||
| 144 | EOF | ||
| 145 | chmod +x pgo-wrapper | ||
| 146 | fi | ||
| 147 | } | ||
| 148 | |||
| 149 | do_install:prepend() { | ||
| 150 | ${WORKDIR}/check_build_completeness.py ${T}/log.do_compile | ||
| 151 | } | ||
| 152 | |||
| 153 | do_install:append:class-target() { | ||
| 154 | oe_multilib_header python${PYTHON_MAJMIN}/pyconfig.h | ||
| 155 | } | ||
| 156 | |||
| 157 | do_install:append:class-native() { | ||
| 158 | # Make sure we use /usr/bin/env python | ||
| 159 | for PYTHSCRIPT in `grep -rIl ${bindir}/${PN}/python ${D}${bindir}/${PN}`; do | ||
| 160 | sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' $PYTHSCRIPT | ||
| 161 | done | ||
| 162 | # Add a symlink to the native Python so that scripts can just invoke | ||
| 163 | # "nativepython" and get the right one without needing absolute paths | ||
| 164 | # (these often end up too long for the #! parser in the kernel as the | ||
| 165 | # buffer is 128 bytes long). | ||
| 166 | ln -s python3-native/python3 ${D}${bindir}/nativepython3 | ||
| 167 | |||
| 168 | # Remove the opt-1.pyc and opt-2.pyc files. There are over 3,000 of them | ||
| 169 | # and the overhead in each recipe-sysroot-native isn't worth it, particularly | ||
| 170 | # when they're only used for python called with -O or -OO. | ||
| 171 | #find ${D} -name *opt-*.pyc -delete | ||
| 172 | # Remove all pyc files. There are a ton of them and it is probably faster to let | ||
| 173 | # python create the ones it wants at runtime rather than manage in the sstate | ||
| 174 | # tarballs and sysroot creation. | ||
| 175 | find ${D} -name *.pyc -delete | ||
| 176 | |||
| 177 | # Nothing should be looking into ${B} for python3-native | ||
| 178 | sed -i -e 's:${B}:/build/path/unavailable/:g' \ | ||
| 179 | ${D}/${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}${PYTHON_ABI}*/Makefile | ||
| 180 | } | ||
| 181 | |||
| 182 | do_install:append() { | ||
| 183 | for c in ${D}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py; do | ||
| 184 | python3 ${WORKDIR}/reformat_sysconfig.py $c | ||
| 185 | done | ||
| 186 | rm -f ${D}${libdir}/python${PYTHON_MAJMIN}/__pycache__/_sysconfigdata*.cpython* | ||
| 187 | |||
| 188 | mkdir -p ${D}${libdir}/python-sysconfigdata | ||
| 189 | sysconfigfile=`find ${D} -name _sysconfig*.py` | ||
| 190 | sed -i \ | ||
| 191 | -e "s,^ 'LIBDIR'.*, 'LIBDIR': '${STAGING_LIBDIR}'\,,g" \ | ||
| 192 | -e "s,^ 'INCLUDEDIR'.*, 'INCLUDEDIR': '${STAGING_INCDIR}'\,,g" \ | ||
| 193 | -e "s,^ 'CONFINCLUDEDIR'.*, 'CONFINCLUDEDIR': '${STAGING_INCDIR}'\,,g" \ | ||
| 194 | -e "/^ 'INCLDIRSTOMAKE'/{N; s,/usr/include,${STAGING_INCDIR},g}" \ | ||
| 195 | -e "/^ 'INCLUDEPY'/s,/usr/include,${STAGING_INCDIR},g" \ | ||
| 196 | -e "s,${B},/build/path/unavailable/,g" \ | ||
| 197 | $sysconfigfile | ||
| 198 | cp $sysconfigfile ${D}${libdir}/python-sysconfigdata/_sysconfigdata.py | ||
| 199 | |||
| 200 | |||
| 201 | # Unfortunately the following pyc files are non-deterministc due to 'frozenset' | ||
| 202 | # being written without strict ordering, even with PYTHONHASHSEED = 0 | ||
| 203 | # Upstream is discussing ways to solve the issue properly, until then let's | ||
| 204 | # just not install the problematic files. | ||
| 205 | # More info: http://benno.id.au/blog/2013/01/15/python-determinism | ||
| 206 | rm -f ${D}${libdir}/python${PYTHON_MAJMIN}/test/__pycache__/test_range.cpython* | ||
| 207 | rm -f ${D}${libdir}/python${PYTHON_MAJMIN}/test/__pycache__/test_xml_etree.cpython* | ||
| 208 | |||
| 209 | # Similar to the above, we're getting reproducibility issues with | ||
| 210 | # /usr/lib/python3.10/__pycache__/traceback.cpython-310.pyc | ||
| 211 | # so remove it too | ||
| 212 | rm -f ${D}${libdir}/python${PYTHON_MAJMIN}/__pycache__/traceback.cpython* | ||
| 213 | |||
| 214 | # Remove the opt-1.pyc and opt-2.pyc files. They effectively waste space on embedded | ||
| 215 | # style targets as they're only used when python is called with the -O or -OO options | ||
| 216 | # which is rare. | ||
| 217 | find ${D} -name *opt-*.pyc -delete | ||
| 218 | } | ||
| 219 | |||
| 220 | do_install:append:class-nativesdk () { | ||
| 221 | # Make sure we use /usr/bin/env python | ||
| 222 | for PYTHSCRIPT in `grep -rIl ${bindir}/python ${D}${bindir}`; do | ||
| 223 | sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' $PYTHSCRIPT | ||
| 224 | done | ||
| 225 | create_wrapper ${D}${bindir}/python${PYTHON_MAJMIN} TERMINFO_DIRS='${sysconfdir}/terminfo:/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo' PYTHONNOUSERSITE='1' | ||
| 226 | } | ||
| 227 | |||
| 228 | SSTATE_SCAN_FILES += "Makefile _sysconfigdata.py" | ||
| 229 | SSTATE_HASHEQUIV_FILEMAP = " \ | ||
| 230 | populate_sysroot:*/lib*/python3*/_sysconfigdata*.py:${TMPDIR} \ | ||
| 231 | populate_sysroot:*/lib*/python3*/_sysconfigdata*.py:${COREBASE} \ | ||
| 232 | populate_sysroot:*/lib*/python3*/config-*/Makefile:${TMPDIR} \ | ||
| 233 | populate_sysroot:*/lib*/python3*/config-*/Makefile:${COREBASE} \ | ||
| 234 | populate_sysroot:*/lib*/python-sysconfigdata/_sysconfigdata.py:${TMPDIR} \ | ||
| 235 | populate_sysroot:*/lib*/python-sysconfigdata/_sysconfigdata.py:${COREBASE} \ | ||
| 236 | " | ||
| 237 | PACKAGE_PREPROCESS_FUNCS += "py_package_preprocess" | ||
| 238 | |||
| 239 | py_package_preprocess () { | ||
| 240 | # Remove references to buildmachine paths in target Makefile and _sysconfigdata | ||
| 241 | sed -i -e 's:--sysroot=${STAGING_DIR_TARGET}::g' -e s:'--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g \ | ||
| 242 | -e 's|${DEBUG_PREFIX_MAP}||g' \ | ||
| 243 | -e 's:${HOSTTOOLS_DIR}/::g' \ | ||
| 244 | -e 's:${RECIPE_SYSROOT_NATIVE}::g' \ | ||
| 245 | -e 's:${RECIPE_SYSROOT}::g' \ | ||
| 246 | -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \ | ||
| 247 | ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}${PYTHON_ABI}*/Makefile \ | ||
| 248 | ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py \ | ||
| 249 | ${PKGD}/${bindir}/python${PYTHON_MAJMIN}-config | ||
| 250 | |||
| 251 | # Reformat _sysconfigdata after modifying it so that it remains | ||
| 252 | # reproducible | ||
| 253 | for c in ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py; do | ||
| 254 | python3 ${WORKDIR}/reformat_sysconfig.py $c | ||
| 255 | done | ||
| 256 | |||
| 257 | # Recompile _sysconfigdata after modifying it | ||
| 258 | cd ${PKGD} | ||
| 259 | sysconfigfile=`find . -name _sysconfigdata_*.py` | ||
| 260 | ${STAGING_BINDIR_NATIVE}/python3-native/python3 \ | ||
| 261 | -c "from py_compile import compile; compile('$sysconfigfile')" | ||
| 262 | ${STAGING_BINDIR_NATIVE}/python3-native/python3 \ | ||
| 263 | -c "from py_compile import compile; compile('$sysconfigfile', optimize=1)" | ||
| 264 | ${STAGING_BINDIR_NATIVE}/python3-native/python3 \ | ||
| 265 | -c "from py_compile import compile; compile('$sysconfigfile', optimize=2)" | ||
| 266 | cd - | ||
| 267 | |||
| 268 | mv ${PKGD}/${bindir}/python${PYTHON_MAJMIN}-config ${PKGD}/${bindir}/python${PYTHON_MAJMIN}-config-${MULTILIB_SUFFIX} | ||
| 269 | |||
| 270 | #Remove the unneeded copy of target sysconfig data | ||
| 271 | rm -rf ${PKGD}/${libdir}/python-sysconfigdata | ||
| 272 | } | ||
| 273 | |||
| 274 | # We want bytecode precompiled .py files (.pyc's) by default | ||
| 275 | # but the user may set it on their own conf | ||
| 276 | INCLUDE_PYCS ?= "1" | ||
| 277 | |||
| 278 | python(){ | ||
| 279 | import collections, json | ||
| 280 | |||
| 281 | filename = os.path.join(d.getVar('THISDIR'), 'python3', 'python3-manifest.json') | ||
| 282 | # This python changes the datastore based on the contents of a file, so mark | ||
| 283 | # that dependency. | ||
| 284 | bb.parse.mark_dependency(d, filename) | ||
| 285 | |||
| 286 | with open(filename) as manifest_file: | ||
| 287 | manifest_str = manifest_file.read() | ||
| 288 | json_start = manifest_str.find('# EOC') + 6 | ||
| 289 | manifest_file.seek(json_start) | ||
| 290 | manifest_str = manifest_file.read() | ||
| 291 | python_manifest = json.loads(manifest_str, object_pairs_hook=collections.OrderedDict) | ||
| 292 | |||
| 293 | # First set RPROVIDES for -native case | ||
| 294 | # Hardcoded since it cant be python3-native-foo, should be python3-foo-native | ||
| 295 | pn = 'python3' | ||
| 296 | rprovides = (d.getVar('RPROVIDES') or "").split() | ||
| 297 | |||
| 298 | # ${PN}-misc-native is not in the manifest | ||
| 299 | rprovides.append(pn + '-misc-native') | ||
| 300 | |||
| 301 | for key in python_manifest: | ||
| 302 | pypackage = pn + '-' + key + '-native' | ||
| 303 | if pypackage not in rprovides: | ||
| 304 | rprovides.append(pypackage) | ||
| 305 | |||
| 306 | d.setVar('RPROVIDES:class-native', ' '.join(rprovides)) | ||
| 307 | |||
| 308 | # Then work on the target | ||
| 309 | include_pycs = d.getVar('INCLUDE_PYCS') | ||
| 310 | |||
| 311 | packages = d.getVar('PACKAGES').split() | ||
| 312 | pn = d.getVar('PN') | ||
| 313 | |||
| 314 | newpackages=[] | ||
| 315 | for key in python_manifest: | ||
| 316 | pypackage = pn + '-' + key | ||
| 317 | |||
| 318 | if pypackage not in packages: | ||
| 319 | # We need to prepend, otherwise python-misc gets everything | ||
| 320 | # so we use a new variable | ||
| 321 | newpackages.append(pypackage) | ||
| 322 | |||
| 323 | # "Build" python's manifest FILES, RDEPENDS and SUMMARY | ||
| 324 | d.setVar('FILES:' + pypackage, '') | ||
| 325 | for value in python_manifest[key]['files']: | ||
| 326 | d.appendVar('FILES:' + pypackage, ' ' + value) | ||
| 327 | |||
| 328 | # Add cached files | ||
| 329 | if include_pycs == '1': | ||
| 330 | for value in python_manifest[key]['cached']: | ||
| 331 | d.appendVar('FILES:' + pypackage, ' ' + value) | ||
| 332 | |||
| 333 | for value in python_manifest[key]['rdepends']: | ||
| 334 | # Make it work with or without $PN | ||
| 335 | if '${PN}' in value: | ||
| 336 | value=value.split('-', 1)[1] | ||
| 337 | d.appendVar('RDEPENDS:' + pypackage, ' ' + pn + '-' + value) | ||
| 338 | |||
| 339 | for value in python_manifest[key].get('rrecommends', ()): | ||
| 340 | if '${PN}' in value: | ||
| 341 | value=value.split('-', 1)[1] | ||
| 342 | d.appendVar('RRECOMMENDS:' + pypackage, ' ' + pn + '-' + value) | ||
| 343 | |||
| 344 | d.setVar('SUMMARY:' + pypackage, python_manifest[key]['summary']) | ||
| 345 | |||
| 346 | # Prepending so to avoid python-misc getting everything | ||
| 347 | packages = newpackages + packages | ||
| 348 | d.setVar('PACKAGES', ' '.join(packages)) | ||
| 349 | d.setVar('ALLOW_EMPTY:${PN}-modules', '1') | ||
| 350 | d.setVar('ALLOW_EMPTY:${PN}-pkgutil', '1') | ||
| 351 | |||
| 352 | if "pgo" in d.getVar("PACKAGECONFIG").split() and not bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', True, False, d): | ||
| 353 | bb.fatal("pgo cannot be enabled as there is no qemu-usermode support for this architecture/machine") | ||
| 354 | } | ||
| 355 | |||
| 356 | # Files needed to create a new manifest | ||
| 357 | |||
| 358 | do_create_manifest() { | ||
| 359 | # This task should be run with every new release of Python. | ||
| 360 | # We must ensure that PACKAGECONFIG enables everything when creating | ||
| 361 | # a new manifest, this is to base our new manifest on a complete | ||
| 362 | # native python build, containing all dependencies, otherwise the task | ||
| 363 | # wont be able to find the required files. | ||
| 364 | # e.g. BerkeleyDB is an optional build dependency so it may or may not | ||
| 365 | # be present, we must ensure it is. | ||
| 366 | |||
| 367 | cd ${WORKDIR} | ||
| 368 | # This needs to be executed by python-native and NOT by HOST's python | ||
| 369 | nativepython3 create_manifest3.py ${PYTHON_MAJMIN} | ||
| 370 | cp python3-manifest.json.new ${THISDIR}/python3/python3-manifest.json | ||
| 371 | } | ||
| 372 | |||
| 373 | # bitbake python -c create_manifest | ||
| 374 | # Make sure we have native python ready when we create a new manifest | ||
| 375 | addtask do_create_manifest after do_patch do_prepare_recipe_sysroot | ||
| 376 | |||
| 377 | # manual dependency additions | ||
| 378 | RRECOMMENDS:${PN}-core:append:class-nativesdk = " nativesdk-python3-modules" | ||
| 379 | RRECOMMENDS:${PN}-crypt:append:class-target = " ${MLPREFIX}openssl ${MLPREFIX}ca-certificates" | ||
| 380 | RRECOMMENDS:${PN}-crypt:append:class-nativesdk = " ${MLPREFIX}openssl ${MLPREFIX}ca-certificates" | ||
| 381 | |||
| 382 | # For historical reasons PN is empty and provided by python3-modules | ||
| 383 | FILES:${PN} = "" | ||
| 384 | RPROVIDES:${PN}-modules = "${PN}" | ||
| 385 | |||
| 386 | FILES:${PN}-pydoc += "${bindir}/pydoc${PYTHON_MAJMIN} ${bindir}/pydoc3" | ||
| 387 | FILES:${PN}-idle += "${bindir}/idle3 ${bindir}/idle${PYTHON_MAJMIN}" | ||
| 388 | |||
| 389 | # provide python-pyvenv from python3-venv | ||
| 390 | RPROVIDES:${PN}-venv += "${MLPREFIX}python3-pyvenv" | ||
| 391 | |||
| 392 | # package libpython3 | ||
| 393 | PACKAGES =+ "libpython3 libpython3-staticdev" | ||
| 394 | FILES:libpython3 = "${libdir}/libpython*.so.*" | ||
| 395 | FILES:libpython3-staticdev += "${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}-*/libpython${PYTHON_MAJMIN}.a" | ||
| 396 | INSANE_SKIP:${PN}-dev += "dev-elf" | ||
| 397 | INSANE_SKIP:${PN}-ptest = "dev-deps" | ||
| 398 | |||
| 399 | # catch all the rest (unsorted) | ||
| 400 | PACKAGES += "${PN}-misc" | ||
| 401 | RDEPENDS:${PN}-misc += "\ | ||
| 402 | ${PN}-core \ | ||
| 403 | ${PN}-email \ | ||
| 404 | ${PN}-codecs \ | ||
| 405 | ${PN}-pydoc \ | ||
| 406 | ${PN}-pickle \ | ||
| 407 | ${PN}-audio \ | ||
| 408 | ${PN}-numbers \ | ||
| 409 | " | ||
| 410 | RDEPENDS:${PN}-modules:append:class-target = " ${MLPREFIX}python3-misc" | ||
| 411 | RDEPENDS:${PN}-modules:append:class-nativesdk = " ${MLPREFIX}python3-misc" | ||
| 412 | FILES:${PN}-misc = "${libdir}/python${PYTHON_MAJMIN} ${libdir}/python${PYTHON_MAJMIN}/lib-dynload" | ||
| 413 | |||
| 414 | # catch manpage | ||
| 415 | PACKAGES += "${PN}-man" | ||
| 416 | FILES:${PN}-man = "${datadir}/man" | ||
| 417 | |||
| 418 | # See https://bugs.python.org/issue18748 and https://bugs.python.org/issue37395 | ||
| 419 | RDEPENDS:libpython3:append:libc-glibc = " libgcc" | ||
| 420 | RDEPENDS:${PN}-ctypes:append:libc-glibc = " ${MLPREFIX}ldconfig" | ||
| 421 | RDEPENDS:${PN}-ptest = "${PN}-modules ${PN}-tests ${PN}-dev unzip bzip2 libgcc tzdata-europe coreutils sed" | ||
| 422 | RDEPENDS:${PN}-ptest:append:libc-glibc = " locale-base-tr-tr.iso-8859-9" | ||
| 423 | RDEPENDS:${PN}-tkinter += "${@bb.utils.contains('PACKAGECONFIG', 'tk', '${MLPREFIX}tk ${MLPREFIX}tk-lib', '', d)}" | ||
| 424 | RDEPENDS:${PN}-idle += "${@bb.utils.contains('PACKAGECONFIG', 'tk', '${PN}-tkinter ${MLPREFIX}tcl', '', d)}" | ||
| 425 | RDEPENDS:${PN}-dev = "" | ||
| 426 | RDEPENDS:${PN}-pydoc += "${PN}-io" | ||
| 427 | |||
| 428 | RDEPENDS:${PN}-tests:append:class-target = " ${MLPREFIX}bash" | ||
| 429 | RDEPENDS:${PN}-tests:append:class-nativesdk = " ${MLPREFIX}bash" | ||
| 430 | |||
| 431 | # Python's tests contain large numbers of files we don't need in the recipe sysroots | ||
| 432 | SYSROOT_PREPROCESS_FUNCS += " py3_sysroot_cleanup" | ||
| 433 | py3_sysroot_cleanup () { | ||
| 434 | rm -rf ${SYSROOT_DESTDIR}${libdir}/python${PYTHON_MAJMIN}/test | ||
| 435 | } | ||
