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