1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-02 13:29:49 +00:00

perf: change dependencies on python to python3

The upstream kernel can now handle python3 for the perf scripts, coupled
with the impending EOL of python2, we switch the dependencies in perf
(scripting) to python3.

Outside of dependency changes, we also pass the following two variables
to the perf build: PYTHON=python3 PYTHON_CONFIG=python3-config. To
ensure that our python3 components are used.

For configurations that disable perf scripting, there is no change in
behaviour.

[YOCTO #13358]

(From OE-Core rev: 584af667e0000129bcb5c9e8108485f2f6590eaf)

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Bruce Ashfield
2019-08-28 22:14:41 -04:00
committed by Richard Purdie
parent 4c62122ecb
commit e66d183b9e
+11 -8
View File
@@ -13,7 +13,7 @@ PR = "r9"
PACKAGECONFIG ??= "scripting tui libunwind" PACKAGECONFIG ??= "scripting tui libunwind"
PACKAGECONFIG[dwarf] = ",NO_DWARF=1" PACKAGECONFIG[dwarf] = ",NO_DWARF=1"
PACKAGECONFIG[scripting] = ",NO_LIBPERL=1 NO_LIBPYTHON=1,perl python" PACKAGECONFIG[scripting] = ",NO_LIBPERL=1 NO_LIBPYTHON=1,perl python3"
# gui support was added with kernel 3.6.35 # gui support was added with kernel 3.6.35
# since 3.10 libnewt was replaced by slang # since 3.10 libnewt was replaced by slang
# to cover a wide range of kernel we add both dependencies # to cover a wide range of kernel we add both dependencies
@@ -44,8 +44,8 @@ PROVIDES = "virtual/perf"
inherit linux-kernel-base kernel-arch manpages inherit linux-kernel-base kernel-arch manpages
# needed for building the tools/perf Python bindings # needed for building the tools/perf Python bindings
inherit ${@bb.utils.contains('PACKAGECONFIG', 'scripting', 'pythonnative', '', d)} inherit ${@bb.utils.contains('PACKAGECONFIG', 'scripting', 'python3native', '', d)}
inherit python-dir inherit python3-dir
export PYTHON_SITEPACKAGES_DIR export PYTHON_SITEPACKAGES_DIR
#kernel 3.1+ supports WERROR to disable warnings as errors #kernel 3.1+ supports WERROR to disable warnings as errors
@@ -94,6 +94,7 @@ EXTRA_OEMAKE += "\
'sharedir=${@os.path.relpath(datadir, prefix)}' \ 'sharedir=${@os.path.relpath(datadir, prefix)}' \
'mandir=${@os.path.relpath(mandir, prefix)}' \ 'mandir=${@os.path.relpath(mandir, prefix)}' \
'infodir=${@os.path.relpath(infodir, prefix)}' \ 'infodir=${@os.path.relpath(infodir, prefix)}' \
${@bb.utils.contains('PACKAGECONFIG', 'scripting', 'PYTHON=python3 PYTHON_CONFIG=python3-config', '', d)} \
" "
# During do_configure, we might run a 'make clean'. That often breaks # During do_configure, we might run a 'make clean'. That often breaks
@@ -132,7 +133,7 @@ do_install() {
oe_runmake install oe_runmake install
# we are checking for this make target to be compatible with older perf versions # we are checking for this make target to be compatible with older perf versions
if ${@bb.utils.contains('PACKAGECONFIG', 'scripting', 'true', 'false', d)} && grep -q install-python_ext ${S}/tools/perf/Makefile*; then if ${@bb.utils.contains('PACKAGECONFIG', 'scripting', 'true', 'false', d)} && grep -q install-python_ext ${S}/tools/perf/Makefile*; then
oe_runmake DESTDIR=${D} install-python_ext oe_runmake DESTDIR=${D} install-python_ext
fi fi
} }
@@ -232,8 +233,10 @@ do_configure_prepend () {
fi fi
# use /usr/bin/env instead of version specific python # use /usr/bin/env instead of version specific python
for s in `find ${S}/tools/perf/scripts/python/ -name '*.py'`; do for s in `find ${S}/tools/perf/ -name '*.py'`; do
sed -i 's,/usr/bin/python2,/usr/bin/env python,' "${s}" sed -i 's,/usr/bin/python,/usr/bin/env python3,' "${s}"
sed -i 's,/usr/bin/python2,/usr/bin/env python3,' "${s}"
sed -i 's,/usr/bin/env python2,/usr/bin/env python3,' "${s}"
done done
# unistd.h can be out of sync between libc-headers and the captured version in the perf source # unistd.h can be out of sync between libc-headers and the captured version in the perf source
@@ -252,9 +255,9 @@ PACKAGES =+ "${PN}-archive ${PN}-tests ${PN}-perl ${PN}-python"
RDEPENDS_${PN} += "elfutils bash" RDEPENDS_${PN} += "elfutils bash"
RDEPENDS_${PN}-archive =+ "bash" RDEPENDS_${PN}-archive =+ "bash"
RDEPENDS_${PN}-python =+ "bash python python-modules ${@bb.utils.contains('PACKAGECONFIG', 'audit', 'audit-python', '', d)}" RDEPENDS_${PN}-python =+ "bash python3 python3-modules ${@bb.utils.contains('PACKAGECONFIG', 'audit', 'audit-python3', '', d)}"
RDEPENDS_${PN}-perl =+ "bash perl perl-modules" RDEPENDS_${PN}-perl =+ "bash perl perl-modules"
RDEPENDS_${PN}-tests =+ "python" RDEPENDS_${PN}-tests =+ "python3"
RSUGGESTS_SCRIPTING = "${@bb.utils.contains('PACKAGECONFIG', 'scripting', '${PN}-perl ${PN}-python', '',d)}" RSUGGESTS_SCRIPTING = "${@bb.utils.contains('PACKAGECONFIG', 'scripting', '${PN}-perl ${PN}-python', '',d)}"
RSUGGESTS_${PN} += "${PN}-archive ${PN}-tests ${RSUGGESTS_SCRIPTING}" RSUGGESTS_${PN} += "${PN}-archive ${PN}-tests ${RSUGGESTS_SCRIPTING}"