mirror of
https://git.yoctoproject.org/meta-arm
synced 2026-07-27 19:37:04 +00:00
arm/trusted-firmware-m: use python3-cbor2 instead of python3-cbor
Backport a patch to switch from the unmaintained python3-cbor module to the active python3-cbor2 module. Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Jon Mason <jon.mason@arm.com>
This commit is contained in:
@@ -0,0 +1,80 @@
|
|||||||
|
Upstream-Status: Backport [https://github.com/mcu-tools/mcuboot/commit/a6df132b68f8e08c2b0ab428377d478436376556]
|
||||||
|
Signed-off-by: Ross Burton <ross.burton@arm.com>
|
||||||
|
|
||||||
|
From a5f747643e3a51b8dfce192203b9b84e033728b9 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ross Burton <ross.burton@arm.com>
|
||||||
|
Date: Tue, 2 Nov 2021 11:12:04 +0000
|
||||||
|
Subject: [PATCH] imgtool: prefer cbor2 over cbor
|
||||||
|
|
||||||
|
The cbor module is unmaintained, with the last release in 2016[1]. The
|
||||||
|
cbor2 module however is under active development and was last released
|
||||||
|
just last month[2].
|
||||||
|
|
||||||
|
As the APIs are identical, we can import cbor2 and if that fails fall
|
||||||
|
back to cbor.
|
||||||
|
|
||||||
|
[1] https://pypi.org/project/cbor/#history
|
||||||
|
[2] https://pypi.org/project/cbor2/#history
|
||||||
|
|
||||||
|
Closes #1189
|
||||||
|
|
||||||
|
Signed-off-by: Ross Burton <ross.burton@arm.com>
|
||||||
|
Change-Id: Iaf2d0df625a200a5cebf72dec4a89877a26194ea
|
||||||
|
---
|
||||||
|
scripts/imgtool.nix | 2 +-
|
||||||
|
scripts/imgtool/boot_record.py | 9 ++++++---
|
||||||
|
scripts/requirements.txt | 2 +-
|
||||||
|
scripts/setup.py | 2 +-
|
||||||
|
4 files changed, 9 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/scripts/imgtool.nix b/scripts/imgtool.nix
|
||||||
|
index 9ac41bc..ea9ba8b 100644
|
||||||
|
diff --git a/scripts/imgtool/boot_record.py b/scripts/imgtool/boot_record.py
|
||||||
|
index ac433aa..8ab2f60 100644
|
||||||
|
--- a/scripts/imgtool/boot_record.py
|
||||||
|
+++ b/scripts/imgtool/boot_record.py
|
||||||
|
@@ -14,8 +14,11 @@
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
from enum import Enum
|
||||||
|
-import cbor
|
||||||
|
|
||||||
|
+try:
|
||||||
|
+ from cbor2 import dumps
|
||||||
|
+except ImportError:
|
||||||
|
+ from cbor import dumps
|
||||||
|
|
||||||
|
class SwComponent(int, Enum):
|
||||||
|
"""
|
||||||
|
@@ -46,4 +49,4 @@ def create_sw_component_data(sw_type, sw_version, sw_measurement_description,
|
||||||
|
# list because later it will be modified by the bootloader.
|
||||||
|
properties[SwComponent.MEASUREMENT_VALUE] = sw_measurement_value
|
||||||
|
|
||||||
|
- return cbor.dumps(properties)
|
||||||
|
+ return dumps(properties)
|
||||||
|
diff --git a/scripts/requirements.txt b/scripts/requirements.txt
|
||||||
|
index 9481e2c..2446928 100644
|
||||||
|
--- a/scripts/requirements.txt
|
||||||
|
+++ b/scripts/requirements.txt
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
cryptography>=2.6
|
||||||
|
intelhex
|
||||||
|
click
|
||||||
|
-cbor>=1.0.0
|
||||||
|
+cbor2
|
||||||
|
diff --git a/scripts/setup.py b/scripts/setup.py
|
||||||
|
index a228ea3..692cfb7 100644
|
||||||
|
--- a/scripts/setup.py
|
||||||
|
+++ b/scripts/setup.py
|
||||||
|
@@ -15,7 +15,7 @@ setuptools.setup(
|
||||||
|
'cryptography>=2.4.2',
|
||||||
|
'intelhex>=2.2.1',
|
||||||
|
'click',
|
||||||
|
- 'cbor>=1.0.0',
|
||||||
|
+ 'cbor2',
|
||||||
|
],
|
||||||
|
entry_points={
|
||||||
|
"console_scripts": ["imgtool=imgtool.main:imgtool"]
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
@@ -19,6 +19,7 @@ SRC_URI = "git://git.trustedfirmware.org/TF-M/trusted-firmware-m.git;protocol=h
|
|||||||
git://git.trustedfirmware.org/TF-M/tf-m-tests.git;protocol=https;branch=master;name=tfm-tests;destsuffix=${S}/../tf-m-tests \
|
git://git.trustedfirmware.org/TF-M/tf-m-tests.git;protocol=https;branch=master;name=tfm-tests;destsuffix=${S}/../tf-m-tests \
|
||||||
git://github.com/ARMmbed/mbedtls.git;protocol=https;branch=master;name=mbedtls;destsuffix=${S}/../mbedtls \
|
git://github.com/ARMmbed/mbedtls.git;protocol=https;branch=master;name=mbedtls;destsuffix=${S}/../mbedtls \
|
||||||
git://github.com/mcu-tools/mcuboot.git;protocol=https;branch=main;name=mcuboot;destsuffix=${S}/../mcuboot \
|
git://github.com/mcu-tools/mcuboot.git;protocol=https;branch=main;name=mcuboot;destsuffix=${S}/../mcuboot \
|
||||||
|
file://cbor2.patch;patchdir=${S}/../mcuboot \
|
||||||
"
|
"
|
||||||
|
|
||||||
# The required dependencies are documented in tf-m/config/config_default.cmake
|
# The required dependencies are documented in tf-m/config/config_default.cmake
|
||||||
@@ -52,7 +53,7 @@ DEPENDS += "cmake-native \
|
|||||||
python3-click-native \
|
python3-click-native \
|
||||||
python3-cryptography-native \
|
python3-cryptography-native \
|
||||||
python3-pyasn1-native \
|
python3-pyasn1-native \
|
||||||
python3-cbor-native"
|
python3-cbor2-native"
|
||||||
|
|
||||||
S = "${WORKDIR}/git/tfm"
|
S = "${WORKDIR}/git/tfm"
|
||||||
B = "${WORKDIR}/build"
|
B = "${WORKDIR}/build"
|
||||||
|
|||||||
Reference in New Issue
Block a user