From 166d5ad78731bc9747baf41ca4bc6da91f884242 Mon Sep 17 00:00:00 2001 From: Andrey Zhizhikin Date: Wed, 22 Jan 2020 10:53:13 +0000 Subject: [PATCH] optee[-imx]: update recipes to use python3 Since Python2 is dropped in oe-core and classes are not available anymore, optee components should be updated to utilize python3. optee-os recipe received an additionl patch to re-target the Python version in the source tree to python3. Signed-off-by: Andrey Zhizhikin --- .../optee-imx/optee-client_3.2.0.imx.bb | 2 +- ...cripts-update-scripts-to-use-python3.patch | 427 ++++++++++++++++++ .../optee-imx/optee-os_3.2.0.imx.bb | 10 +- .../optee-imx/optee-test_3.2.0.imx.bb | 2 +- recipes-security/optee/optee-client-qoriq.bb | 2 +- recipes-security/optee/optee-os-qoriq_git.bb | 2 +- .../optee/optee-test-qoriq_git.bb | 2 +- 7 files changed, 439 insertions(+), 8 deletions(-) create mode 100644 recipes-security/optee-imx/optee-os/0001-scripts-update-scripts-to-use-python3.patch diff --git a/recipes-security/optee-imx/optee-client_3.2.0.imx.bb b/recipes-security/optee-imx/optee-client_3.2.0.imx.bb index 4fed4c10..f7b22e1a 100644 --- a/recipes-security/optee-imx/optee-client_3.2.0.imx.bb +++ b/recipes-security/optee-imx/optee-client_3.2.0.imx.bb @@ -5,7 +5,7 @@ HOMEPAGE = "http://www.optee.org/" LICENSE = "BSD" LIC_FILES_CHKSUM = "file://LICENSE;md5=69663ab153298557a59c67a60a743e5b" -inherit pythonnative systemd +inherit python3native systemd SRCBRANCH = "imx_4.19.35_1.1.0" OPTEE_CLIENT_SRC ?= "git://source.codeaurora.org/external/imx/imx-optee-client.git;protocol=https" diff --git a/recipes-security/optee-imx/optee-os/0001-scripts-update-scripts-to-use-python3.patch b/recipes-security/optee-imx/optee-os/0001-scripts-update-scripts-to-use-python3.patch new file mode 100644 index 00000000..9621cf6c --- /dev/null +++ b/recipes-security/optee-imx/optee-os/0001-scripts-update-scripts-to-use-python3.patch @@ -0,0 +1,427 @@ +From 0d4941123b5a88351f5954f6de00892f85ed5abc Mon Sep 17 00:00:00 2001 +From: Andrey Zhizhikin +Date: Mon, 20 Jan 2020 22:32:13 +0000 +Subject: [PATCH] scripts: update scripts to use python3 + +Python2 is deprecated effective Jan. 2020, and is not available in +several distributions. + +Update scripts here to re-target then onto python version 3. + +Upstream-Status: Pending + +Signed-off-by: Andrey Zhizhikin +--- + scripts/gen_hashed_bin.py | 282 ++++++++++++++++++++------------------ + scripts/gen_ld_sects.py | 8 +- + scripts/pem_to_pub_c.py | 2 +- + scripts/sign.py | 2 +- + scripts/symbolize.py | 2 +- + scripts/ta_bin_to_c.py | 2 +- + scripts/tee_bin_parser.py | 2 +- + 7 files changed, 157 insertions(+), 143 deletions(-) + +diff --git a/scripts/gen_hashed_bin.py b/scripts/gen_hashed_bin.py +index 32350a47..a76a62cc 100755 +--- a/scripts/gen_hashed_bin.py ++++ b/scripts/gen_hashed_bin.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # SPDX-License-Identifier: BSD-2-Clause + # + # Copyright (c) 2014-2017, Linaro Limited +@@ -14,163 +14,177 @@ import hashlib + arch_id = {'arm32': 0, 'arm64': 1} + image_id = {'pager': 0, 'paged': 1} + ++ + def write_header_v1(outf, init_size, args, paged_size): +- magic = 0x4554504f # 'OPTE' +- version = 1; +- outf.write(struct.pack(' [...]".format( \ +- sys.argv[0]) ++ print("Usage: {0}
[...]".format( \ ++ sys.argv[0])) + sys.exit (1) + + def main(): +@@ -55,7 +55,7 @@ def main(): + if sect_name in skip_sections : + continue + +- print '\t*({0})'.format(sect_name) ++ print ('\t*({0})'.format(sect_name)) + + if __name__ == "__main__": + main() +diff --git a/scripts/pem_to_pub_c.py b/scripts/pem_to_pub_c.py +index 6b8fa365..0b03d62e 100755 +--- a/scripts/pem_to_pub_c.py ++++ b/scripts/pem_to_pub_c.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # SPDX-License-Identifier: BSD-2-Clause + # + # Copyright (c) 2015, Linaro Limited +diff --git a/scripts/sign.py b/scripts/sign.py +index ad47479b..348b40a2 100755 +--- a/scripts/sign.py ++++ b/scripts/sign.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # + # Copyright (c) 2015, 2017, Linaro Limited + # +diff --git a/scripts/symbolize.py b/scripts/symbolize.py +index 1eecf758..0e9bd3ed 100755 +--- a/scripts/symbolize.py ++++ b/scripts/symbolize.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # SPDX-License-Identifier: BSD-2-Clause + # + # Copyright (c) 2017, Linaro Limited +diff --git a/scripts/ta_bin_to_c.py b/scripts/ta_bin_to_c.py +index cabddbbd..f325fda0 100755 +--- a/scripts/ta_bin_to_c.py ++++ b/scripts/ta_bin_to_c.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # SPDX-License-Identifier: BSD-2-Clause + # + # Copyright (c) 2017, Linaro Limited +diff --git a/scripts/tee_bin_parser.py b/scripts/tee_bin_parser.py +index 5f7dd3f0..07da5791 100755 +--- a/scripts/tee_bin_parser.py ++++ b/scripts/tee_bin_parser.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # SPDX-License-Identifier: BSD-2-Clause + # + # Copyright (c) 2016, Linaro Limited +-- +2.17.1 + diff --git a/recipes-security/optee-imx/optee-os_3.2.0.imx.bb b/recipes-security/optee-imx/optee-os_3.2.0.imx.bb index c5328c9c..be07f0ef 100644 --- a/recipes-security/optee-imx/optee-os_3.2.0.imx.bb +++ b/recipes-security/optee-imx/optee-os_3.2.0.imx.bb @@ -6,12 +6,16 @@ HOMEPAGE = "http://www.optee.org/" LICENSE = "BSD" LIC_FILES_CHKSUM = "file://LICENSE;md5=69663ab153298557a59c67a60a743e5b" -inherit deploy pythonnative autotools -DEPENDS = "python-pycrypto-native u-boot-mkimage-native" +inherit deploy python3native autotools +DEPENDS = "python3-pycrypto-native u-boot-mkimage-native" SRCBRANCH = "imx_4.19.35_1.1.0" OPTEE_OS_SRC ?= "git://source.codeaurora.org/external/imx/imx-optee-os.git;protocol=https" -SRC_URI = "${OPTEE_OS_SRC};branch=${SRCBRANCH}" +SRC_URI = "\ + ${OPTEE_OS_SRC};branch=${SRCBRANCH} \ + file://0001-scripts-update-scripts-to-use-python3.patch \ +" + SRCREV = "6a22e6e8a2840b245808527679f3397b7e620b3c" S = "${WORKDIR}/git" diff --git a/recipes-security/optee-imx/optee-test_3.2.0.imx.bb b/recipes-security/optee-imx/optee-test_3.2.0.imx.bb index 8b1c232e..e36f3355 100644 --- a/recipes-security/optee-imx/optee-test_3.2.0.imx.bb +++ b/recipes-security/optee-imx/optee-test_3.2.0.imx.bb @@ -7,7 +7,7 @@ LICENSE = "BSD" LIC_FILES_CHKSUM = "file://LICENSE.md;md5=daa2bcccc666345ab8940aab1315a4fa" DEPENDS = "optee-os optee-client python-pycrypto-native openssl" -inherit pythonnative +inherit python3native FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" diff --git a/recipes-security/optee/optee-client-qoriq.bb b/recipes-security/optee/optee-client-qoriq.bb index 4d1caa16..af5fc095 100644 --- a/recipes-security/optee/optee-client-qoriq.bb +++ b/recipes-security/optee/optee-client-qoriq.bb @@ -4,7 +4,7 @@ HOMEPAGE = "https://github.com/qoriq-open-source/optee_client" LICENSE = "BSD" LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=69663ab153298557a59c67a60a743e5b" -inherit pythonnative systemd +inherit python3native systemd SRC_URI = "git://source.codeaurora.org/external/qoriq/qoriq-components/optee_client;nobranch=1 \ " diff --git a/recipes-security/optee/optee-os-qoriq_git.bb b/recipes-security/optee/optee-os-qoriq_git.bb index fbde2616..8b3159d6 100644 --- a/recipes-security/optee/optee-os-qoriq_git.bb +++ b/recipes-security/optee/optee-os-qoriq_git.bb @@ -6,7 +6,7 @@ LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=69663ab153298557a59c67a60a743e5b" DEPENDS = "python-pycrypto-native" -inherit deploy pythonnative +inherit deploy python3native SRCREV = "4e8d2e5307b99a91a0cac3ea3560ecb7d62898d6" SRC_URI = "git://source.codeaurora.org/external/qoriq/qoriq-components/optee_os;nobranch=1 \ diff --git a/recipes-security/optee/optee-test-qoriq_git.bb b/recipes-security/optee/optee-test-qoriq_git.bb index 1c6ca22e..7aea24f9 100644 --- a/recipes-security/optee/optee-test-qoriq_git.bb +++ b/recipes-security/optee/optee-test-qoriq_git.bb @@ -6,7 +6,7 @@ LIC_FILES_CHKSUM = "file://${S}/LICENSE.md;md5=daa2bcccc666345ab8940aab1315a4fa" DEPENDS = "optee-client-qoriq optee-os-qoriq python-pycrypto-native" -inherit pythonnative +inherit python3native SRC_URI = "git://source.codeaurora.org/external/qoriq/qoriq-components/optee_test;nobranch=1 \ file://0001-fix-build-failure-with-GCC-9.patch \ -- 2.40.1