summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python/python3_3.8.11.bb
diff options
context:
space:
mode:
authorMarta Rybczynska <rybczynska@gmail.com>2021-11-26 12:08:41 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-12-02 16:53:07 +0000
commit409df675a84d5e082efb2aa675e5afd016dbec98 (patch)
tree1a030b344f8179c159e8a873a5fd248f93efead0 /meta/recipes-devtools/python/python3_3.8.11.bb
parentb2089f012a7763463d310e547892684466b9718a (diff)
downloadpoky-409df675a84d5e082efb2aa675e5afd016dbec98.tar.gz
python3: upgrade 3.8.11 -> 3.8.12
Release Date: Aug. 30, 2021 This is a security release of Python 3.8 Note: The release you're looking at is Python 3.8.12, a security bugfix release for the legacy 3.8 series. Python 3.10 is now the latest feature release series of Python 3. Get the latest release of 3.10.x here. Security content in this release contains four fixes. There are also four additional fixes for bugs that might have lead to denial-of-service attacks. Finally, while we're not providing binary installers anymore, for those users who produce installers, we upgraded the OpenSSL version used to 1.1.1l. Take a look at the change log for details. According to the release calendar specified in PEP 569, Python 3.8 is now in the "security fixes only" stage of its life cycle: 3.8 branch only accepts security fixes and releases of those are made irregularly in source-only form until October 2024. Python 3.8 isn't receiving regular bug fixes anymore, and binary installers are no longer provided for it. Python 3.8.10 was the last full bugfix release of Python 3.8 with binary installers. This release includes a fix for CVE-2021-29921. References: https://docs.python.org/release/3.8.12/whatsnew/changelog.html#changelog (From OE-Core rev: ff52cf448c5e26246f8637d0b8957c5c479fa389) Signed-off-by: Marta Rybczynska <marta.rybczynska@huawei.com> Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/python/python3_3.8.11.bb')
-rw-r--r--meta/recipes-devtools/python/python3_3.8.11.bb363
1 files changed, 0 insertions, 363 deletions
diff --git a/meta/recipes-devtools/python/python3_3.8.11.bb b/meta/recipes-devtools/python/python3_3.8.11.bb
deleted file mode 100644
index 2a2472b3d0..0000000000
--- a/meta/recipes-devtools/python/python3_3.8.11.bb
+++ /dev/null
@@ -1,363 +0,0 @@
1SUMMARY = "The Python Programming Language"
2HOMEPAGE = "http://www.python.org"
3DESCRIPTION = "Python is a programming language that lets you work more quickly and integrate your systems more effectively."
4LICENSE = "PSF-2.0 & BSD-0-Clause"
5SECTION = "devel/python"
6
7LIC_FILES_CHKSUM = "file://LICENSE;md5=c22d2438294c784731bf9dd224a467b7"
8
9SRC_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://cgi_py.patch \
16 file://0001-Do-not-add-usr-lib-termcap-to-linker-flags-to-avoid-.patch \
17 ${@bb.utils.contains('PACKAGECONFIG', 'tk', '', 'file://avoid_warning_about_tkinter.patch', d)} \
18 file://0001-Do-not-use-the-shell-version-of-python-config-that-w.patch \
19 file://python-config.patch \
20 file://0001-Makefile.pre-use-qemu-wrapper-when-gathering-profile.patch \
21 file://0001-Do-not-hardcode-lib-as-location-for-site-packages-an.patch \
22 file://0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch \
23 file://0001-Lib-sysconfig.py-fix-another-place-where-lib-is-hard.patch \
24 file://0001-Makefile-fix-Issue36464-parallel-build-race-problem.patch \
25 file://0001-bpo-36852-proper-detection-of-mips-architecture-for-.patch \
26 file://crosspythonpath.patch \
27 file://reformat_sysconfig.py \
28 file://0001-Use-FLAG_REF-always-for-interned-strings.patch \
29 file://0001-test_locale.py-correct-the-test-output-format.patch \
30 file://0017-setup.py-do-not-report-missing-dependencies-for-disa.patch \
31 file://0001-setup.py-pass-missing-libraries-to-Extension-for-mul.patch \
32 file://0001-Makefile-do-not-compile-.pyc-in-parallel.patch \
33 file://0001-configure.ac-fix-LIBPL.patch \
34 file://0001-python3-Do-not-hardcode-lib-for-distutils.patch \
35 file://0020-configure.ac-setup.py-do-not-add-a-curses-include-pa.patch \
36 file://makerace.patch \
37 "
38
39SRC_URI_append_class-native = " \
40 file://0001-distutils-sysconfig-append-STAGING_LIBDIR-python-sys.patch \
41 file://12-distutils-prefix-is-inside-staging-area.patch \
42 file://0001-Don-t-search-system-for-headers-libraries.patch \
43 "
44
45SRC_URI[md5sum] = "5840ba601128f48fee4e7c98fbdac65d"
46SRC_URI[sha256sum] = "fb1a1114ebfe9e97199603c6083e20b236a0e007a2c51f29283ffb50c1420fb2"
47
48# exclude pre-releases for both python 2.x and 3.x
49UPSTREAM_CHECK_REGEX = "[Pp]ython-(?P<pver>\d+(\.\d+)+).tar"
50
51CVE_PRODUCT = "python"
52
53# Upstream consider this expected behaviour
54CVE_CHECK_WHITELIST += "CVE-2007-4559"
55# This is not exploitable when glibc has CVE-2016-10739 fixed.
56CVE_CHECK_WHITELIST += "CVE-2019-18348"
57
58# This is windows only issue.
59CVE_CHECK_WHITELIST += "CVE-2020-15523"
60
61PYTHON_MAJMIN = "3.8"
62
63S = "${WORKDIR}/Python-${PV}"
64
65BBCLASSEXTEND = "native nativesdk"
66
67inherit autotools pkgconfig qemu ptest multilib_header update-alternatives
68
69MULTILIB_SUFFIX = "${@d.getVar('base_libdir',1).split('/')[-1]}"
70
71ALTERNATIVE_${PN}-dev = "python3-config"
72ALTERNATIVE_LINK_NAME[python3-config] = "${bindir}/python${PYTHON_MAJMIN}-config"
73ALTERNATIVE_TARGET[python3-config] = "${bindir}/python${PYTHON_MAJMIN}-config-${MULTILIB_SUFFIX}"
74
75
76DEPENDS = "bzip2-replacement-native libffi bzip2 openssl sqlite3 zlib virtual/libintl xz virtual/crypt util-linux libtirpc libnsl2 autoconf-archive"
77DEPENDS_append_class-target = " python3-native"
78DEPENDS_append_class-nativesdk = " python3-native"
79
80EXTRA_OECONF = " --without-ensurepip --enable-shared"
81EXTRA_OECONF_append_class-native = " --bindir=${bindir}/${PN}"
82
83export CROSSPYTHONPATH="${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/"
84
85EXTRANATIVEPATH += "python3-native"
86
87CACHED_CONFIGUREVARS = " \
88 ac_cv_file__dev_ptmx=yes \
89 ac_cv_file__dev_ptc=no \
90 ac_cv_working_tzset=yes \
91"
92python() {
93 # PGO currently causes builds to not be reproducible, so disable it for
94 # now. See YOCTO #13407
95 if bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', True, False, d) and d.getVar('BUILD_REPRODUCIBLE_BINARIES') != '1':
96 d.setVar('PACKAGECONFIG_PGO', 'pgo')
97 else:
98 d.setVar('PACKAGECONFIG_PGO', '')
99}
100
101PACKAGECONFIG_class-target ??= "readline ${PACKAGECONFIG_PGO} gdbm"
102PACKAGECONFIG_class-native ??= "readline gdbm"
103PACKAGECONFIG_class-nativesdk ??= "readline gdbm"
104PACKAGECONFIG[readline] = ",,readline"
105# Use profile guided optimisation by running PyBench inside qemu-user
106PACKAGECONFIG[pgo] = "--enable-optimizations,,qemu-native"
107PACKAGECONFIG[tk] = ",,tk"
108PACKAGECONFIG[gdbm] = ",,gdbm"
109
110do_configure_prepend () {
111 mkdir -p ${B}/Modules
112 cat > ${B}/Modules/Setup.local << EOF
113*disabled*
114${@bb.utils.contains('PACKAGECONFIG', 'gdbm', '', '_gdbm _dbm', d)}
115${@bb.utils.contains('PACKAGECONFIG', 'readline', '', 'readline', d)}
116EOF
117}
118
119CPPFLAGS_append = " -I${STAGING_INCDIR}/ncursesw -I${STAGING_INCDIR}/uuid"
120
121EXTRA_OEMAKE = '\
122 STAGING_LIBDIR=${STAGING_LIBDIR} \
123 STAGING_INCDIR=${STAGING_INCDIR} \
124 LIB=${baselib} \
125'
126
127do_compile_prepend_class-target() {
128 if ${@bb.utils.contains('PACKAGECONFIG', 'pgo', 'true', 'false', d)}; then
129 qemu_binary="${@qemu_wrapper_cmdline(d, '${STAGING_DIR_TARGET}', ['${B}', '${STAGING_DIR_TARGET}/${base_libdir}'])}"
130 cat >pgo-wrapper <<EOF
131#!/bin/sh
132cd ${B}
133$qemu_binary "\$@"
134EOF
135 chmod +x pgo-wrapper
136 fi
137}
138
139do_install_prepend() {
140 ${WORKDIR}/check_build_completeness.py ${T}/log.do_compile
141}
142
143do_install_append_class-target() {
144 oe_multilib_header python${PYTHON_MAJMIN}/pyconfig.h
145}
146
147do_install_append_class-native() {
148 # Make sure we use /usr/bin/env python
149 for PYTHSCRIPT in `grep -rIl ${bindir}/${PN}/python ${D}${bindir}/${PN}`; do
150 sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' $PYTHSCRIPT
151 done
152 # Add a symlink to the native Python so that scripts can just invoke
153 # "nativepython" and get the right one without needing absolute paths
154 # (these often end up too long for the #! parser in the kernel as the
155 # buffer is 128 bytes long).
156 ln -s python3-native/python3 ${D}${bindir}/nativepython3
157}
158
159do_install_append() {
160 mkdir -p ${D}${libdir}/python-sysconfigdata
161 sysconfigfile=`find ${D} -name _sysconfig*.py`
162 cp $sysconfigfile ${D}${libdir}/python-sysconfigdata/_sysconfigdata.py
163
164 sed -i \
165 -e "s,^ 'LIBDIR'.*, 'LIBDIR': '${STAGING_LIBDIR}'\,,g" \
166 -e "s,^ 'INCLUDEDIR'.*, 'INCLUDEDIR': '${STAGING_INCDIR}'\,,g" \
167 -e "s,^ 'CONFINCLUDEDIR'.*, 'CONFINCLUDEDIR': '${STAGING_INCDIR}'\,,g" \
168 -e "/^ 'INCLDIRSTOMAKE'/{N; s,/usr/include,${STAGING_INCDIR},g}" \
169 -e "/^ 'INCLUDEPY'/s,/usr/include,${STAGING_INCDIR},g" \
170 ${D}${libdir}/python-sysconfigdata/_sysconfigdata.py
171}
172
173do_install_append_class-nativesdk () {
174 create_wrapper ${D}${bindir}/python${PYTHON_MAJMIN} TERMINFO_DIRS='${sysconfdir}/terminfo:/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo' PYTHONNOUSERSITE='1'
175}
176
177SSTATE_SCAN_FILES += "Makefile _sysconfigdata.py"
178PACKAGE_PREPROCESS_FUNCS += "py_package_preprocess"
179
180py_package_preprocess () {
181 # Remove references to buildmachine paths in target Makefile and _sysconfigdata
182 sed -i -e 's:--sysroot=${STAGING_DIR_TARGET}::g' -e s:'--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g \
183 -e 's|${DEBUG_PREFIX_MAP}||g' \
184 -e 's:${HOSTTOOLS_DIR}/::g' \
185 -e 's:${RECIPE_SYSROOT_NATIVE}::g' \
186 -e 's:${RECIPE_SYSROOT}::g' \
187 -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \
188 ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}${PYTHON_ABI}*/Makefile \
189 ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py \
190 ${PKGD}/${bindir}/python${PYTHON_MAJMIN}-config
191
192 # Reformat _sysconfigdata after modifying it so that it remains
193 # reproducible
194 for c in ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py; do
195 python3 ${WORKDIR}/reformat_sysconfig.py $c
196 done
197
198 # Recompile _sysconfigdata after modifying it
199 cd ${PKGD}
200 sysconfigfile=`find . -name _sysconfigdata_*.py`
201 ${STAGING_BINDIR_NATIVE}/python3-native/python3 \
202 -c "from py_compile import compile; compile('$sysconfigfile')"
203 ${STAGING_BINDIR_NATIVE}/python3-native/python3 \
204 -c "from py_compile import compile; compile('$sysconfigfile', optimize=1)"
205 ${STAGING_BINDIR_NATIVE}/python3-native/python3 \
206 -c "from py_compile import compile; compile('$sysconfigfile', optimize=2)"
207 cd -
208
209 mv ${PKGD}/${bindir}/python${PYTHON_MAJMIN}-config ${PKGD}/${bindir}/python${PYTHON_MAJMIN}-config-${MULTILIB_SUFFIX}
210
211 #Remove the unneeded copy of target sysconfig data
212 rm -rf ${PKGD}/${libdir}/python-sysconfigdata
213}
214
215# We want bytecode precompiled .py files (.pyc's) by default
216# but the user may set it on their own conf
217INCLUDE_PYCS ?= "1"
218
219python(){
220 import collections, json
221
222 filename = os.path.join(d.getVar('THISDIR'), 'python3', 'python3-manifest.json')
223 # This python changes the datastore based on the contents of a file, so mark
224 # that dependency.
225 bb.parse.mark_dependency(d, filename)
226
227 with open(filename) as manifest_file:
228 manifest_str = manifest_file.read()
229 json_start = manifest_str.find('# EOC') + 6
230 manifest_file.seek(json_start)
231 manifest_str = manifest_file.read()
232 python_manifest = json.loads(manifest_str, object_pairs_hook=collections.OrderedDict)
233
234 # First set RPROVIDES for -native case
235 # Hardcoded since it cant be python3-native-foo, should be python3-foo-native
236 pn = 'python3'
237 rprovides = d.getVar('RPROVIDES').split()
238
239 # ${PN}-misc-native is not in the manifest
240 rprovides.append(pn + '-misc-native')
241
242 for key in python_manifest:
243 pypackage = pn + '-' + key + '-native'
244 if pypackage not in rprovides:
245 rprovides.append(pypackage)
246
247 d.setVar('RPROVIDES_class-native', ' '.join(rprovides))
248
249 # Then work on the target
250 include_pycs = d.getVar('INCLUDE_PYCS')
251
252 packages = d.getVar('PACKAGES').split()
253 pn = d.getVar('PN')
254
255 newpackages=[]
256 for key in python_manifest:
257 pypackage = pn + '-' + key
258
259 if pypackage not in packages:
260 # We need to prepend, otherwise python-misc gets everything
261 # so we use a new variable
262 newpackages.append(pypackage)
263
264 # "Build" python's manifest FILES, RDEPENDS and SUMMARY
265 d.setVar('FILES_' + pypackage, '')
266 for value in python_manifest[key]['files']:
267 d.appendVar('FILES_' + pypackage, ' ' + value)
268
269 # Add cached files
270 if include_pycs == '1':
271 for value in python_manifest[key]['cached']:
272 d.appendVar('FILES_' + pypackage, ' ' + value)
273
274 for value in python_manifest[key]['rdepends']:
275 # Make it work with or without $PN
276 if '${PN}' in value:
277 value=value.split('-', 1)[1]
278 d.appendVar('RDEPENDS_' + pypackage, ' ' + pn + '-' + value)
279
280 for value in python_manifest[key].get('rrecommends', ()):
281 if '${PN}' in value:
282 value=value.split('-', 1)[1]
283 d.appendVar('RRECOMMENDS_' + pypackage, ' ' + pn + '-' + value)
284
285 d.setVar('SUMMARY_' + pypackage, python_manifest[key]['summary'])
286
287 # Prepending so to avoid python-misc getting everything
288 packages = newpackages + packages
289 d.setVar('PACKAGES', ' '.join(packages))
290 d.setVar('ALLOW_EMPTY_${PN}-modules', '1')
291 d.setVar('ALLOW_EMPTY_${PN}-pkgutil', '1')
292}
293
294# Files needed to create a new manifest
295
296do_create_manifest() {
297 # This task should be run with every new release of Python.
298 # We must ensure that PACKAGECONFIG enables everything when creating
299 # a new manifest, this is to base our new manifest on a complete
300 # native python build, containing all dependencies, otherwise the task
301 # wont be able to find the required files.
302 # e.g. BerkeleyDB is an optional build dependency so it may or may not
303 # be present, we must ensure it is.
304
305 cd ${WORKDIR}
306 # This needs to be executed by python-native and NOT by HOST's python
307 nativepython3 create_manifest3.py ${PYTHON_MAJMIN}
308 cp python3-manifest.json.new ${THISDIR}/python3/python3-manifest.json
309}
310
311# bitbake python -c create_manifest
312# Make sure we have native python ready when we create a new manifest
313addtask do_create_manifest after do_patch do_prepare_recipe_sysroot
314
315# manual dependency additions
316RRECOMMENDS_${PN}-core_append_class-nativesdk = " nativesdk-python3-modules"
317RRECOMMENDS_${PN}-crypt_append_class-target = " openssl ca-certificates"
318RRECOMMENDS_${PN}-crypt_append_class-nativesdk = " openssl ca-certificates"
319
320# For historical reasons PN is empty and provided by python3-modules
321FILES_${PN} = ""
322RPROVIDES_${PN}-modules = "${PN}"
323
324FILES_${PN}-pydoc += "${bindir}/pydoc${PYTHON_MAJMIN} ${bindir}/pydoc3"
325FILES_${PN}-idle += "${bindir}/idle3 ${bindir}/idle${PYTHON_MAJMIN}"
326
327# provide python-pyvenv from python3-venv
328RPROVIDES_${PN}-venv += "python3-pyvenv"
329
330# package libpython3
331PACKAGES =+ "libpython3 libpython3-staticdev"
332FILES_libpython3 = "${libdir}/libpython*.so.*"
333FILES_libpython3-staticdev += "${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}-*/libpython${PYTHON_MAJMIN}.a"
334INSANE_SKIP_${PN}-dev += "dev-elf"
335INSANE_SKIP_${PN}-ptest += "dev-deps"
336
337# catch all the rest (unsorted)
338PACKAGES += "${PN}-misc"
339RDEPENDS_${PN}-misc += "python3-core python3-email python3-codecs python3-pydoc python3-pickle python3-audio"
340RDEPENDS_${PN}-modules_append_class-target = " python3-misc"
341RDEPENDS_${PN}-modules_append_class-nativesdk = " python3-misc"
342FILES_${PN}-misc = "${libdir}/python${PYTHON_MAJMIN} ${libdir}/python${PYTHON_MAJMIN}/lib-dynload"
343
344# catch manpage
345PACKAGES += "${PN}-man"
346FILES_${PN}-man = "${datadir}/man"
347
348# See https://bugs.python.org/issue18748 and https://bugs.python.org/issue37395
349RDEPENDS_libpython3_append_libc-glibc = " libgcc"
350RDEPENDS_${PN}-ctypes_append_libc-glibc = " ${MLPREFIX}ldconfig"
351RDEPENDS_${PN}-ptest = "${PN}-modules ${PN}-tests ${PN}-dev unzip bzip2 libgcc tzdata-europe coreutils sed"
352RDEPENDS_${PN}-ptest_append_libc-glibc = " locale-base-tr-tr.iso-8859-9"
353RDEPENDS_${PN}-tkinter += "${@bb.utils.contains('PACKAGECONFIG', 'tk', 'tk tk-lib', '', d)}"
354RDEPENDS_${PN}-dev = ""
355
356RDEPENDS_${PN}-tests_append_class-target = " bash"
357RDEPENDS_${PN}-tests_append_class-nativesdk = " bash"
358
359# Python's tests contain large numbers of files we don't need in the recipe sysroots
360SYSROOT_PREPROCESS_FUNCS += " py3_sysroot_cleanup"
361py3_sysroot_cleanup () {
362 rm -rf ${SYSROOT_DESTDIR}${libdir}/python${PYTHON_MAJMIN}/test
363}