[meta-security][PATCH] tpm2-pkcs11: build and package python tools


Ioan-Adrian Ratiu
 

Signed-off-by: Adrian Ratiu <adrian.ratiu@...>
---
.../tpm2-pkcs11/tpm2-pkcs11_1.4.0.bb | 25 +++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/meta-tpm/recipes-tpm2/tpm2-pkcs11/tpm2-pkcs11_1.4.0.bb b/met=
a-tpm/recipes-tpm2/tpm2-pkcs11/tpm2-pkcs11_1.4.0.bb
index 4865733..6beb67a 100644
--- a/meta-tpm/recipes-tpm2/tpm2-pkcs11/tpm2-pkcs11_1.4.0.bb
+++ b/meta-tpm/recipes-tpm2/tpm2-pkcs11/tpm2-pkcs11_1.4.0.bb
@@ -4,7 +4,7 @@ SECTION =3D "security/tpm"
LICENSE =3D "BSD-2-Clause"
LIC_FILES_CHKSUM =3D "file://LICENSE;md5=3D0fc19f620a102768d6dbd1e7166e7=
8ab"
=20
-DEPENDS =3D "autoconf-archive pkgconfig dstat sqlite3 openssl libtss2-de=
v tpm2-tools libyaml"
+DEPENDS =3D "autoconf-archive pkgconfig dstat sqlite3 openssl libtss2-de=
v tpm2-tools libyaml python3-setuptools-native"
=20
SRC_URI =3D "git://github.com/tpm2-software/tpm2-pkcs11.git;branch=3D1.X=
\
file://bootstrap_fixup.patch \
@@ -14,10 +14,31 @@ SRCREV =3D "78bbf6a0237351830d0c3923b25ba0b57ae0b7e9"
=20
S =3D "${WORKDIR}/git"
=20
-inherit autotools-brokensep pkgconfig
+inherit autotools-brokensep pkgconfig python3native
=20
do_configure_prepend () {
${S}/bootstrap
}
=20
+do_compile_append() {
+ cd ${S}/tools
+ python3 setup.py build
+}
+
+do_install_append() {
+ cd ${S}/tools
+ export PYTHONPATH=3D"${D}${PYTHON_SITEPACKAGES_DIR}"
+ ${PYTHON_PN} setup.py install --root=3D"${D}" --prefix=3D"${prefix}"=
--install-lib=3D"${PYTHON_SITEPACKAGES_DIR}" --optimize=3D1 --skip-build
+
+ sed -i -e "s:${PYTHON}:${USRBINPATH}/env ${PYTHON_PN}:g" "${D}${bind=
ir}"/tpm2_ptool
+}
+
RDEPNDS_${PN} =3D "tpm2-tools"
+
+PACKAGES =3D+ "${PN}-tools"
+RDEPENDS_${PN}-tools +=3D "${PYTHON_PN}-setuptools ${PYTHON_PN}-pyyaml $=
{PYTHON_PN}-cryptography ${PYTHON_PN}-pyasn1-modules"
+
+FILES_${PN}-tools =3D "\
+ ${bindir}/tpm2_ptool \
+ ${libdir}/${PYTHON_DIR}/* \
+"
--=20
2.29.2

Join {yocto@lists.yoctoproject.org to automatically receive all group messages.