Skip to contentSkip to conversation

Add necessary lib and python tool to handle CoSWID tag

PATCH Superseded Jun Nie 2 participants 8 messages May 9, 2023 – May 11, 2023

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jun Nie

author
#0 lore raw

cover Add necessary lib and python tool to handle CoSWID tag

Software Identification (SWID) tags provide an extensible XML-based structure to identify and describe individual software components, patches, and installation bundles.

CoSWID supports a similar set of semantics and features as SWID tags, as well as new semantics that allow us to describe additional types of information, all in a more memory efficient format.

Jun Nie (3):
libcbor: Add initial support
python3-pefile: Add initial support
python3-uswid: Add initial support

 meta-oe/recipes-extended/libcbor/libcbor_git.bb   | 13 +++++++++++++
 .../python/python3-pefile_2023.2.7.bb             | 13 +++++++++++++
 .../recipes-devtools/python/python3-uswid_git.bb  | 15 +++++++++++++++
 3 files changed, 41 insertions(+)
 create mode 100755 meta-oe/recipes-extended/libcbor/libcbor_git.bb
 create mode 100644 meta-python/recipes-devtools/python/python3-pefile_2023.2.7.bb
 create mode 100644 meta-python/recipes-devtools/python/python3-uswid_git.bb
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 1/3 libcbor: Add initial support

To handle the general-purpose schema-less binary data format

---
 meta-oe/recipes-extended/libcbor/libcbor_git.bb | 13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100755 meta-oe/recipes-extended/libcbor/libcbor_git.bb
meta-oe/recipes-extended/libcbor/libcbor_git.bb new file +13 -0
new file mode 100755
index 0000000000..53ba230533
@@ -0,0 +1,13 @@
+SUMMARY = "library for CBOR"
+DESCRIPTION = " C library for parsing and generating CBOR, the general-purpose schema-less binary data format."
+
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE.md;md5=6f3b3881df62ca763a02d359a6e94071"
+
+SRC_URI = "git://github.com/PJK/libcbor.git;protocol=https;branch=master"
+SRCREV = "efa6c0886bae46bdaef9b679f61f4b9d8bc296ae"
+
+S = "${WORKDIR}/git"
+PV = "git${SRCPV}"
+
+inherit cmake
Signature · 1 line
2.34.1
#2 lore raw

Re: [meta-oe 1/3] libcbor: Add initial support

Quoted 15 lines · Jun Nie

To handle the general-purpose schema-less binary data format

---
 meta-oe/recipes-extended/libcbor/libcbor_git.bb | 13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100755 meta-oe/recipes-extended/libcbor/libcbor_git.bb
meta-oe/recipes-extended/libcbor/libcbor_git.bb new file +0 -0
new file mode 100755
index 0000000000..53ba230533

meta-oe/recipes-extended/libcbor/libcbor_git.bb line 9

Quoted 9 lines
meta-oe/recipes-extended/libcbor/libcbor_git.bb new file +9 -0
@@ -0,0 +1,13 @@
+SUMMARY = "library for CBOR"
+DESCRIPTION = " C library for parsing and generating CBOR, the general-purpose schema-less binary data format."
+
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE.md;md5=6f3b3881df62ca763a02d359a6e94071"
+
+SRC_URI = "git://github.com/PJK/libcbor.git;protocol=https;branch=master"
+SRCREV = "efa6c0886bae46bdaef9b679f61f4b9d8bc296ae"
+

Please rename the recipe to reflect version libcbor_0.10.2.bb, you are using the right SHA1 for SRCREV above

meta-oe/recipes-extended/libcbor/libcbor_git.bb line 11

Quoted 2 lines
meta-oe/recipes-extended/libcbor/libcbor_git.bb new file +2 -0
+S = "${WORKDIR}/git"
+PV = "git${SRCPV}"

Setting PV is not needed if its using a SRCREV corresponding to a release tag

Quoted 5 lines
meta-oe/recipes-extended/libcbor/libcbor_git.bb new file +2 -1
+
+inherit cmake
--

2.34.1

#3 lore raw

Re: [meta-oe 1/3] libcbor: Add initial support

more errors in build QA

ERROR: libcbor-gitAUTOINC+efa6c0886b-r0 do_package: dwarfsrcfiles
failed with exit code 1 (cmd was ['dwarfsrcfiles', '/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/libcbor/gitAUTOINC+efa6c0886b-r0

       /package/usr/lib/libcbor.a']):

dwarfsrcfiles:
/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/libcbor/gitAUTOINC+efa6c0886b-r0/package/usr/lib/libcbor.a:
not a valid ELF file

Quoted 40 lines · Khem Raj
Quoted 15 lines · Jun Nie

To handle the general-purpose schema-less binary data format

---
 meta-oe/recipes-extended/libcbor/libcbor_git.bb | 13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100755 meta-oe/recipes-extended/libcbor/libcbor_git.bb
meta-oe/recipes-extended/libcbor/libcbor_git.bb new file +0 -0
new file mode 100755
index 0000000000..53ba230533

meta-oe/recipes-extended/libcbor/libcbor_git.bb line 9

Quoted 9 lines
meta-oe/recipes-extended/libcbor/libcbor_git.bb new file +9 -0
@@ -0,0 +1,13 @@
+SUMMARY = "library for CBOR"
+DESCRIPTION = " C library for parsing and generating CBOR, the general-purpose schema-less binary data format."
+
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE.md;md5=6f3b3881df62ca763a02d359a6e94071"
+
+SRC_URI = "git://github.com/PJK/libcbor.git;protocol=https;branch=master"
+SRCREV = "efa6c0886bae46bdaef9b679f61f4b9d8bc296ae"
+

Please rename the recipe to reflect version libcbor_0.10.2.bb, you are using the right SHA1 for SRCREV above

meta-oe/recipes-extended/libcbor/libcbor_git.bb line 11

Quoted 2 lines
meta-oe/recipes-extended/libcbor/libcbor_git.bb new file +2 -0
+S = "${WORKDIR}/git"
+PV = "git${SRCPV}"

Setting PV is not needed if its using a SRCREV corresponding to a release tag

Quoted 5 lines
meta-oe/recipes-extended/libcbor/libcbor_git.bb new file +2 -1
+
+inherit cmake
--

2.34.1

author
#4 lore raw

Re: [meta-oe 1/3] libcbor: Add initial support

In reply to Khem Raj
Quoted 35 lines · Khem Raj <[email protected]> 于2023年5月10日周三 08:28写道:
Quoted 15 lines · Jun Nie

To handle the general-purpose schema-less binary data format

---
 meta-oe/recipes-extended/libcbor/libcbor_git.bb | 13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100755 meta-oe/recipes-extended/libcbor/libcbor_git.bb
meta-oe/recipes-extended/libcbor/libcbor_git.bb new file +0 -0
new file mode 100755
index 0000000000..53ba230533

meta-oe/recipes-extended/libcbor/libcbor_git.bb line 9

Quoted 9 lines
meta-oe/recipes-extended/libcbor/libcbor_git.bb new file +9 -0
@@ -0,0 +1,13 @@
+SUMMARY = "library for CBOR"
+DESCRIPTION = " C library for parsing and generating CBOR, the general-purpose schema-less binary data format."
+
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE.md;md5=6f3b3881df62ca763a02d359a6e94071"
+
+SRC_URI = "git://github.com/PJK/libcbor.git;protocol=https;branch=master"
+SRCREV = "efa6c0886bae46bdaef9b679f61f4b9d8bc296ae"
+

Please rename the recipe to reflect version libcbor_0.10.2.bb, you are using the right SHA1 for SRCREV above

meta-oe/recipes-extended/libcbor/libcbor_git.bb line 11

Quoted 2 lines
meta-oe/recipes-extended/libcbor/libcbor_git.bb new file +2 -0
+S = "${WORKDIR}/git"
+PV = "git${SRCPV}"

Setting PV is not needed if its using a SRCREV corresponding to a release tag

Quoted 5 lines
Quoted 5 lines
meta-oe/recipes-extended/libcbor/libcbor_git.bb new file +2 -1
+
+inherit cmake
--

2.34.1

Thanks! Will rename the recipe and remove PV in future version.

For the "not a valid ELF file" issue, it is due to missing a CMAKE argument. I did not find the error as
there is no issue in real use case. But dwarfdump cannot find any information with the issue.
Is there any method to run QA test locally? Or the error notification can be forwarded to patch owner
directly from auto-build server?

- Jun

author
#5 lore raw

PATCH 2/3 python3-pefile: Add initial support

In reply to Jun Nie

To parse and work with Portable Executable (PE) files

---
 .../python/python3-pefile_2023.2.7.bb               | 13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-pefile_2023.2.7.bb
meta-python/recipes-devtools/python/python3-pefile_2023.2.7.bb new file +13 -0
new file mode 100644
index 0000000000..37e27b1a03
@@ -0,0 +1,13 @@
+SUMMARY = "Python PE parsing module"
+DESCRIPTION = "A multi-platform Python module to parse and work with Portable Executable (PE) files."
+HOMEPAGE = "https://github.com/erocarrera/pefile"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=38066667888b01d8118ff9cc23da1873"
+
+inherit setuptools3 pypi ptest
+SRC_URI[sha256sum] = "11cd7ed7082d5256e9741e8b98c654f061723fafb5b2719c01a0b4cc6f89e09d"
+
+PIP_INSTALL_PACKAGE = "pefile"
+PIP_INSTALL_DIST_PATH = "${S}/dist"
+
+BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.34.1
#6 lore raw

Re: [meta-oe 2/3] python3-pefile: Add initial support

how was this tested ?

For new recipes its always good to do a bitbake -ccleanall <recipe> && bitbake recipe as a sanity check before sending.

I am seeing fetch errors like below

File: '/mnt/b/yoe/master/downloads/pefile-2023.2.7.tar.gz.tmp' has sha256 checksum '82e6114004b3d6911c77c3953e3838654b04511b8b66e8583db70c65998017dc' when '11cd7ed7082d5256e9741e8b98c654f061723fafb5b2719c01a0b4cc6f 89e09d' was expected
If this change is expected (e.g. you have upgraded to a new version without updating the checksums) then you can use these lines within the recipe:
SRC_URI[sha256sum] = "82e6114004b3d6911c77c3953e3838654b04511b8b66e8583db70c65998017dc"

Quoted 31 lines · Jun Nie

To parse and work with Portable Executable (PE) files

---
 .../python/python3-pefile_2023.2.7.bb               | 13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-pefile_2023.2.7.bb
meta-python/recipes-devtools/python/python3-pefile_2023.2.7.bb new file +13 -1
new file mode 100644
index 0000000000..37e27b1a03
@@ -0,0 +1,13 @@
+SUMMARY = "Python PE parsing module"
+DESCRIPTION = "A multi-platform Python module to parse and work with Portable Executable (PE) files."
+HOMEPAGE = "https://github.com/erocarrera/pefile"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=38066667888b01d8118ff9cc23da1873"
+
+inherit setuptools3 pypi ptest
+SRC_URI[sha256sum] = "11cd7ed7082d5256e9741e8b98c654f061723fafb5b2719c01a0b4cc6f89e09d"
+
+PIP_INSTALL_PACKAGE = "pefile"
+PIP_INSTALL_DIST_PATH = "${S}/dist"
+
+BBCLASSEXTEND = "native nativesdk"
--

2.34.1

author
#7 lore raw

PATCH 3/3 python3-uswid: Add initial support

In reply to Jun Nie

Software Identification (SWID) tags provide an extensible XML-based structure to identify and describe individual software components, patches, and installation bundles.

CoSWID supports a similar set of semantics and features as SWID tags, as well as new semantics that allow us to describe additional types of information, all in a more memory efficient format.

python3-uswid is used to generate the CoSWID data blob. For example, fwupd project requires CoSWID data to be embedded into firmware binary to hold the version information.

---
 .../recipes-devtools/python/python3-uswid_git.bb  | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-uswid_git.bb
meta-python/recipes-devtools/python/python3-uswid_git.bb new file +15 -0
new file mode 100644
index 0000000000..6b2089893f
@@ -0,0 +1,15 @@
+SUMMARY = "A pure-python library for embedding CoSWID data"
+HOMEPAGE = "https://github.com/hughsie/python-uswid"
+SECTION = "devel/python"
+LICENSE = "LGPL-2.1-or-later"
+
+DEPENDS += " python3-cbor2 python3-lxml python3-pefile"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=40d2542b8c43a3ec2b7f5da31a697b88"
+
+SRC_URI = "git://github.com/hughsie/python-uswid.git;branch=main;protocol=https"
+SRCREV = "3223034abef88ae29cf79fdc7fe11ec7e21e11ff"
+S = "${WORKDIR}/git"
+
+inherit setuptools3 python3native
+
+BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.34.1