diff options
author | Anuj Mittal <anuj.mittal@intel.com> | 2019-07-17 11:04:08 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-07-17 19:25:02 +0100 |
commit | edab4b2cecf502a672cc39a8796e60e2fd25cc1c (patch) | |
tree | 46964f260c00395a1eaca4f64b51001b867f9615 /meta/recipes-devtools/python/python3_3.7.3.bb | |
parent | 494a622cb8e83ffe766071e37fb601efcd163c3a (diff) | |
download | poky-edab4b2cecf502a672cc39a8796e60e2fd25cc1c.tar.gz |
python3: upgrade 3.7.3 -> 3.7.4
Also fixes CVE-2019-9740, CVE-2019-9948. For details, see:
https://docs.python.org/3.7/whatsnew/changelog.html#python-3-7-4-final
(From OE-Core rev: 73579c846fe02fb14464869ed382faf8fe299636)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/python/python3_3.7.3.bb')
-rw-r--r-- | meta/recipes-devtools/python/python3_3.7.3.bb | 319 |
1 files changed, 0 insertions, 319 deletions
diff --git a/meta/recipes-devtools/python/python3_3.7.3.bb b/meta/recipes-devtools/python/python3_3.7.3.bb deleted file mode 100644 index 573624528d..0000000000 --- a/meta/recipes-devtools/python/python3_3.7.3.bb +++ /dev/null | |||
@@ -1,319 +0,0 @@ | |||
1 | SUMMARY = "The Python Programming Language" | ||
2 | HOMEPAGE = "http://www.python.org" | ||
3 | LICENSE = "PSFv2" | ||
4 | SECTION = "devel/python" | ||
5 | |||
6 | LIC_FILES_CHKSUM = "file://LICENSE;md5=e466242989bd33c1bd2b6a526a742498" | ||
7 | |||
8 | SRC_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://0002-Don-t-do-runtime-test-to-get-float-byte-order.patch \ | ||
23 | file://0003-setup.py-pass-missing-libraries-to-Extension-for-mul.patch \ | ||
24 | file://0001-Lib-sysconfig.py-fix-another-place-where-lib-is-hard.patch \ | ||
25 | file://0001-Makefile-fix-Issue36464-parallel-build-race-problem.patch \ | ||
26 | file://0001-bpo-36852-proper-detection-of-mips-architecture-for-.patch \ | ||
27 | file://crosspythonpath.patch \ | ||
28 | file://reformat_sysconfig.py \ | ||
29 | file://0001-Use-FLAG_REF-always-for-interned-strings.patch \ | ||
30 | " | ||
31 | |||
32 | SRC_URI_append_class-native = " \ | ||
33 | file://0001-distutils-sysconfig-append-STAGING_LIBDIR-python-sys.patch \ | ||
34 | file://12-distutils-prefix-is-inside-staging-area.patch \ | ||
35 | " | ||
36 | SRC_URI_append_class-nativesdk = " \ | ||
37 | file://0001-main.c-if-OEPYTHON3HOME-is-set-use-instead-of-PYTHON.patch \ | ||
38 | " | ||
39 | |||
40 | SRC_URI[md5sum] = "93df27aec0cd18d6d42173e601ffbbfd" | ||
41 | SRC_URI[sha256sum] = "da60b54064d4cfcd9c26576f6df2690e62085123826cff2e667e72a91952d318" | ||
42 | |||
43 | # exclude pre-releases for both python 2.x and 3.x | ||
44 | UPSTREAM_CHECK_REGEX = "[Pp]ython-(?P<pver>\d+(\.\d+)+).tar" | ||
45 | |||
46 | CVE_PRODUCT = "python" | ||
47 | |||
48 | PYTHON_MAJMIN = "3.7" | ||
49 | PYTHON_BINABI = "${PYTHON_MAJMIN}m" | ||
50 | |||
51 | S = "${WORKDIR}/Python-${PV}" | ||
52 | |||
53 | BBCLASSEXTEND = "native nativesdk" | ||
54 | |||
55 | inherit autotools pkgconfig qemu ptest multilib_header update-alternatives | ||
56 | |||
57 | MULTILIB_SUFFIX = "${@d.getVar('base_libdir',1).split('/')[-1]}" | ||
58 | |||
59 | ALTERNATIVE_${PN}-dev = "python-config" | ||
60 | ALTERNATIVE_LINK_NAME[python-config] = "${bindir}/python${PYTHON_BINABI}-config" | ||
61 | ALTERNATIVE_TARGET[python-config] = "${bindir}/python${PYTHON_BINABI}-config-${MULTILIB_SUFFIX}" | ||
62 | |||
63 | |||
64 | DEPENDS = "bzip2-replacement-native libffi bzip2 gdbm openssl sqlite3 zlib virtual/libintl xz virtual/crypt util-linux libtirpc libnsl2" | ||
65 | DEPENDS_append_class-target = " python3-native" | ||
66 | DEPENDS_append_class-nativesdk = " python3-native" | ||
67 | |||
68 | EXTRA_OECONF = " --without-ensurepip --enable-shared" | ||
69 | EXTRA_OECONF_append_class-native = " --bindir=${bindir}/${PN}" | ||
70 | |||
71 | export CROSSPYTHONPATH="${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/" | ||
72 | |||
73 | EXTRANATIVEPATH += "python3-native" | ||
74 | |||
75 | CACHED_CONFIGUREVARS = " \ | ||
76 | ac_cv_file__dev_ptmx=yes \ | ||
77 | ac_cv_file__dev_ptc=no \ | ||
78 | ac_cv_working_tzset=yes \ | ||
79 | " | ||
80 | python() { | ||
81 | # PGO currently causes builds to not be reproducible, so disable it for | ||
82 | # now. See YOCTO #13407 | ||
83 | if bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', True, False, d) and d.getVar('BUILD_REPRODUCIBLE_BINARIES') != '1': | ||
84 | d.setVar('PACKAGECONFIG_PGO', 'pgo') | ||
85 | else: | ||
86 | d.setVar('PACKAGECONFIG_PGO', '') | ||
87 | } | ||
88 | |||
89 | PACKAGECONFIG_class-target ??= "readline ${PACKAGECONFIG_PGO}" | ||
90 | PACKAGECONFIG_class-native ??= "readline" | ||
91 | PACKAGECONFIG_class-nativesdk ??= "readline" | ||
92 | PACKAGECONFIG[readline] = ",,readline" | ||
93 | # Use profile guided optimisation by running PyBench inside qemu-user | ||
94 | PACKAGECONFIG[pgo] = "--enable-optimizations,,qemu-native" | ||
95 | PACKAGECONFIG[tk] = ",,tk" | ||
96 | |||
97 | CPPFLAGS_append = " -I${STAGING_INCDIR}/ncursesw -I${STAGING_INCDIR}/uuid" | ||
98 | |||
99 | EXTRA_OEMAKE = '\ | ||
100 | STAGING_LIBDIR=${STAGING_LIBDIR} \ | ||
101 | STAGING_INCDIR=${STAGING_INCDIR} \ | ||
102 | LIB=${baselib} \ | ||
103 | ' | ||
104 | |||
105 | do_compile_prepend_class-target() { | ||
106 | if ${@bb.utils.contains('PACKAGECONFIG', 'pgo', 'true', 'false', d)}; then | ||
107 | qemu_binary="${@qemu_wrapper_cmdline(d, '${STAGING_DIR_TARGET}', ['${B}', '${STAGING_DIR_TARGET}/${base_libdir}'])}" | ||
108 | cat >pgo-wrapper <<EOF | ||
109 | #!/bin/sh | ||
110 | cd ${B} | ||
111 | $qemu_binary "\$@" | ||
112 | EOF | ||
113 | chmod +x pgo-wrapper | ||
114 | fi | ||
115 | } | ||
116 | |||
117 | do_install_prepend() { | ||
118 | ${WORKDIR}/check_build_completeness.py ${T}/log.do_compile | ||
119 | } | ||
120 | |||
121 | do_install_append_class-target() { | ||
122 | oe_multilib_header python${PYTHON_BINABI}/pyconfig.h | ||
123 | } | ||
124 | |||
125 | do_install_append_class-native() { | ||
126 | # Make sure we use /usr/bin/env python | ||
127 | for PYTHSCRIPT in `grep -rIl ${bindir}/${PN}/python ${D}${bindir}/${PN}`; do | ||
128 | sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' $PYTHSCRIPT | ||
129 | done | ||
130 | # Add a symlink to the native Python so that scripts can just invoke | ||
131 | # "nativepython" and get the right one without needing absolute paths | ||
132 | # (these often end up too long for the #! parser in the kernel as the | ||
133 | # buffer is 128 bytes long). | ||
134 | ln -s python3-native/python3 ${D}${bindir}/nativepython3 | ||
135 | } | ||
136 | |||
137 | do_install_append() { | ||
138 | mkdir -p ${D}${libdir}/python-sysconfigdata | ||
139 | sysconfigfile=`find ${D} -name _sysconfig*.py` | ||
140 | cp $sysconfigfile ${D}${libdir}/python-sysconfigdata/_sysconfigdata.py | ||
141 | |||
142 | sed -i \ | ||
143 | -e "s,^ 'LIBDIR'.*, 'LIBDIR': '${STAGING_LIBDIR}'\,,g" \ | ||
144 | -e "s,^ 'INCLUDEDIR'.*, 'INCLUDEDIR': '${STAGING_INCDIR}'\,,g" \ | ||
145 | -e "s,^ 'CONFINCLUDEDIR'.*, 'CONFINCLUDEDIR': '${STAGING_INCDIR}'\,,g" \ | ||
146 | -e "/^ 'INCLDIRSTOMAKE'/{N; s,/usr/include,${STAGING_INCDIR},g}" \ | ||
147 | -e "/^ 'INCLUDEPY'/s,/usr/include,${STAGING_INCDIR},g" \ | ||
148 | ${D}${libdir}/python-sysconfigdata/_sysconfigdata.py | ||
149 | } | ||
150 | |||
151 | do_install_append_class-nativesdk () { | ||
152 | create_wrapper ${D}${bindir}/python${PYTHON_MAJMIN} OEPYTHON3HOME='${prefix}' TERMINFO_DIRS='${sysconfdir}/terminfo:/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo' PYTHONNOUSERSITE='1' | ||
153 | } | ||
154 | |||
155 | SSTATE_SCAN_FILES += "Makefile _sysconfigdata.py" | ||
156 | PACKAGE_PREPROCESS_FUNCS += "py_package_preprocess" | ||
157 | |||
158 | py_package_preprocess () { | ||
159 | # Remove references to buildmachine paths in target Makefile and _sysconfigdata | ||
160 | sed -i -e 's:--sysroot=${STAGING_DIR_TARGET}::g' -e s:'--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g \ | ||
161 | -e 's|${DEBUG_PREFIX_MAP}||g' \ | ||
162 | -e 's:${HOSTTOOLS_DIR}/::g' \ | ||
163 | -e 's:${RECIPE_SYSROOT_NATIVE}::g' \ | ||
164 | -e 's:${RECIPE_SYSROOT}::g' \ | ||
165 | -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \ | ||
166 | ${PKGD}/${prefix}/lib/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}${PYTHON_ABI}*/Makefile \ | ||
167 | ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py \ | ||
168 | ${PKGD}/${bindir}/python${PYTHON_BINABI}-config | ||
169 | |||
170 | # Reformat _sysconfigdata after modifying it so that it remains | ||
171 | # reproducible | ||
172 | for c in ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py; do | ||
173 | python3 ${WORKDIR}/reformat_sysconfig.py $c | ||
174 | done | ||
175 | |||
176 | # Recompile _sysconfigdata after modifying it | ||
177 | cd ${PKGD} | ||
178 | sysconfigfile=`find . -name _sysconfigdata_*.py` | ||
179 | ${STAGING_BINDIR_NATIVE}/python3-native/python3 \ | ||
180 | -c "from py_compile import compile; compile('$sysconfigfile')" | ||
181 | ${STAGING_BINDIR_NATIVE}/python3-native/python3 \ | ||
182 | -c "from py_compile import compile; compile('$sysconfigfile', optimize=1)" | ||
183 | ${STAGING_BINDIR_NATIVE}/python3-native/python3 \ | ||
184 | -c "from py_compile import compile; compile('$sysconfigfile', optimize=2)" | ||
185 | cd - | ||
186 | |||
187 | mv ${PKGD}/${bindir}/python${PYTHON_BINABI}-config ${PKGD}/${bindir}/python${PYTHON_BINABI}-config-${MULTILIB_SUFFIX} | ||
188 | |||
189 | #Remove the unneeded copy of target sysconfig data | ||
190 | rm -rf ${PKGD}/${libdir}/python-sysconfigdata | ||
191 | } | ||
192 | |||
193 | # We want bytecode precompiled .py files (.pyc's) by default | ||
194 | # but the user may set it on their own conf | ||
195 | INCLUDE_PYCS ?= "1" | ||
196 | |||
197 | python(){ | ||
198 | import collections, json | ||
199 | |||
200 | filename = os.path.join(d.getVar('THISDIR'), 'python3', 'python3-manifest.json') | ||
201 | # This python changes the datastore based on the contents of a file, so mark | ||
202 | # that dependency. | ||
203 | bb.parse.mark_dependency(d, filename) | ||
204 | |||
205 | with open(filename) as manifest_file: | ||
206 | manifest_str = manifest_file.read() | ||
207 | json_start = manifest_str.find('# EOC') + 6 | ||
208 | manifest_file.seek(json_start) | ||
209 | manifest_str = manifest_file.read() | ||
210 | python_manifest = json.loads(manifest_str, object_pairs_hook=collections.OrderedDict) | ||
211 | |||
212 | # First set RPROVIDES for -native case | ||
213 | # Hardcoded since it cant be python3-native-foo, should be python3-foo-native | ||
214 | pn = 'python3' | ||
215 | rprovides = d.getVar('RPROVIDES').split() | ||
216 | |||
217 | for key in python_manifest: | ||
218 | pypackage = pn + '-' + key + '-native' | ||
219 | if pypackage not in rprovides: | ||
220 | rprovides.append(pypackage) | ||
221 | |||
222 | d.setVar('RPROVIDES_class-native', ' '.join(rprovides)) | ||
223 | |||
224 | # Then work on the target | ||
225 | include_pycs = d.getVar('INCLUDE_PYCS') | ||
226 | |||
227 | packages = d.getVar('PACKAGES').split() | ||
228 | pn = d.getVar('PN') | ||
229 | |||
230 | newpackages=[] | ||
231 | for key in python_manifest: | ||
232 | pypackage= pn + '-' + key | ||
233 | |||
234 | if pypackage not in packages: | ||
235 | # We need to prepend, otherwise python-misc gets everything | ||
236 | # so we use a new variable | ||
237 | newpackages.append(pypackage) | ||
238 | |||
239 | # "Build" python's manifest FILES, RDEPENDS and SUMMARY | ||
240 | d.setVar('FILES_' + pypackage, '') | ||
241 | for value in python_manifest[key]['files']: | ||
242 | d.appendVar('FILES_' + pypackage, ' ' + value) | ||
243 | |||
244 | # Add cached files | ||
245 | if include_pycs == '1': | ||
246 | for value in python_manifest[key]['cached']: | ||
247 | d.appendVar('FILES_' + pypackage, ' ' + value) | ||
248 | |||
249 | for value in python_manifest[key]['rdepends']: | ||
250 | # Make it work with or without $PN | ||
251 | if '${PN}' in value: | ||
252 | value=value.split('-')[1] | ||
253 | d.appendVar('RDEPENDS_' + pypackage, ' ' + pn + '-' + value) | ||
254 | d.setVar('SUMMARY_' + pypackage, python_manifest[key]['summary']) | ||
255 | |||
256 | # Prepending so to avoid python-misc getting everything | ||
257 | packages = newpackages + packages | ||
258 | d.setVar('PACKAGES', ' '.join(packages)) | ||
259 | d.setVar('ALLOW_EMPTY_${PN}-modules', '1') | ||
260 | } | ||
261 | |||
262 | # Files needed to create a new manifest | ||
263 | |||
264 | do_create_manifest() { | ||
265 | # This task should be run with every new release of Python. | ||
266 | # We must ensure that PACKAGECONFIG enables everything when creating | ||
267 | # a new manifest, this is to base our new manifest on a complete | ||
268 | # native python build, containing all dependencies, otherwise the task | ||
269 | # wont be able to find the required files. | ||
270 | # e.g. BerkeleyDB is an optional build dependency so it may or may not | ||
271 | # be present, we must ensure it is. | ||
272 | |||
273 | cd ${WORKDIR} | ||
274 | # This needs to be executed by python-native and NOT by HOST's python | ||
275 | nativepython3 create_manifest3.py ${PYTHON_MAJMIN} | ||
276 | cp python3-manifest.json.new ${THISDIR}/python3/python3-manifest.json | ||
277 | } | ||
278 | |||
279 | # bitbake python -c create_manifest | ||
280 | addtask do_create_manifest | ||
281 | |||
282 | # Make sure we have native python ready when we create a new manifest | ||
283 | do_create_manifest[depends] += "${PN}:do_prepare_recipe_sysroot" | ||
284 | do_create_manifest[depends] += "${PN}:do_patch" | ||
285 | |||
286 | # manual dependency additions | ||
287 | RPROVIDES_${PN}-modules = "${PN}" | ||
288 | RRECOMMENDS_${PN}-core_append_class-nativesdk = " nativesdk-python3-modules" | ||
289 | RRECOMMENDS_${PN}-crypt_append_class-target = " openssl ca-certificates" | ||
290 | RRECOMMENDS_${PN}-crypt_append_class-nativesdk = " openssl ca-certificates" | ||
291 | |||
292 | FILES_${PN}-pydoc += "${bindir}/pydoc${PYTHON_MAJMIN} ${bindir}/pydoc3" | ||
293 | FILES_${PN}-idle += "${bindir}/idle3 ${bindir}/idle${PYTHON_MAJMIN}" | ||
294 | |||
295 | # provide python-pyvenv from python3-venv | ||
296 | RPROVIDES_${PN}-venv += "python3-pyvenv" | ||
297 | |||
298 | # package libpython3 | ||
299 | PACKAGES =+ "libpython3 libpython3-staticdev" | ||
300 | FILES_libpython3 = "${libdir}/libpython*.so.*" | ||
301 | FILES_libpython3-staticdev += "${prefix}/lib/python${PYTHON_MAJMIN}/config-${PYTHON_BINABI}-*/libpython${PYTHON_BINABI}.a" | ||
302 | INSANE_SKIP_${PN}-dev += "dev-elf" | ||
303 | |||
304 | # catch all the rest (unsorted) | ||
305 | PACKAGES += "${PN}-misc" | ||
306 | RDEPENDS_${PN}-misc += "python3-core python3-email python3-codecs" | ||
307 | RDEPENDS_${PN}-modules_append_class-target = " python3-misc" | ||
308 | RDEPENDS_${PN}-modules_append_class-nativesdk = " python3-misc" | ||
309 | FILES_${PN}-misc = "${libdir}/python${PYTHON_MAJMIN} ${libdir}/python${PYTHON_MAJMIN}/lib-dynload" | ||
310 | |||
311 | # catch manpage | ||
312 | PACKAGES += "${PN}-man" | ||
313 | FILES_${PN}-man = "${datadir}/man" | ||
314 | |||
315 | RDEPENDS_${PN}-ptest = "${PN}-modules ${PN}-tests unzip bzip2 libgcc tzdata-europe coreutils sed" | ||
316 | RDEPENDS_${PN}-ptest_append_libc-glibc = " locale-base-tr-tr.iso-8859-9" | ||
317 | RDEPENDS_${PN}-tkinter += "${@bb.utils.contains('PACKAGECONFIG', 'tk', 'tk', '', d)}" | ||
318 | RDEPENDS_${PN}-dev = "" | ||
319 | |||