[meta-zephyr] meets create-spdx


Marta Rybczynska
 

Hello all,
We're trying to use create-spdx.bbclass with meta-zephyr. However,
this is failing with errors like the one at the bottom of the message.
While digging deeper, it is hard to reproduce reliably (but happens at
different recipes and frequently enough to have it at every build).
The workaround that works is to add:
do_create_spdx[nostamp] = "1"
which isn't great.

Has anyone tried create-spdx.bbclass with meta-zephyr? Any insight?

Kind regards,
Marta

And an example error message:

ERROR: python3-native-3.10.4-r0 do_create_spdx: Error executing a
python function in exec_func_python() autogenerated:
The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
0001:
*** 0002:do_create_spdx(d)
0003:
File: '/tmp/workspace.yd5o77EYlf/oe-core/meta/classes/create-spdx.bbclass',
lineno: 516, function: do_create_spdx
0512:
0513: if archive is not None:
0514: recipe.packageFileName = str(recipe_archive.name)
0515:
*** 0516: dep_recipes = collect_dep_recipes(d, doc, recipe)
0517:
0518: doc_sha1 = oe.sbom.write_doc(d, doc, "recipes")
0519: dep_recipes.append(oe.sbom.DepRecipe(doc, doc_sha1, recipe))
0520:
File: '/tmp/workspace.yd5o77EYlf/oe-core/meta/classes/create-spdx.bbclass',
lineno: 345, function: collect_dep_recipes
0341: ))
0342: for dep_pn in deps:
0343: dep_recipe_path = deploy_dir_spdx / "recipes" /
("recipe-%s.spdx.json" % dep_pn)
0344:
*** 0345: spdx_dep_doc, spdx_dep_sha1 = oe.sbom.read_doc(dep_recipe_path)
0346:
0347: for pkg in spdx_dep_doc.packages:
0348: if pkg.name == dep_pn:
0349: spdx_dep_recipe = pkg
File: '/tmp/workspace.yd5o77EYlf/oe-core/meta/lib/oe/sbom.py', lineno:
67, function: read_doc
0063: else:
0064: with fn.open("rb") as f:
0065: yield f
0066:
*** 0067: with get_file() as f:
0068: sha1 = hashlib.sha1()
0069: while True:
0070: chunk = f.read(4096)
0071: if not chunk:
File: '/usr/lib/python3.8/contextlib.py', lineno: 113, function: __enter__
0109: # do not keep args and kwds alive unnecessarily
0110: # they are only needed for recreation, which is not possible anymore
0111: del self.args, self.kwds, self.func
0112: try:
*** 0113: return next(self.gen)
0114: except StopIteration:
0115: raise RuntimeError("generator didn't yield") from None
0116:
0117: def __exit__(self, type, value, traceback):
File: '/tmp/workspace.yd5o77EYlf/oe-core/meta/lib/oe/sbom.py', lineno:
64, function: get_file
0060: def get_file():
0061: if isinstance(fn, io.IOBase):
0062: yield fn
0063: else:
*** 0064: with fn.open("rb") as f:
0065: yield f
0066:
0067: with get_file() as f:
0068: sha1 = hashlib.sha1()
File: '/usr/lib/python3.8/pathlib.py', lineno: 1222, function: open
1218: the built-in open() function does.
1219: """
1220: if self._closed:
1221: self._raise_closed()
*** 1222: return io.open(self, mode, buffering, encoding, errors, newline,
1223: opener=self._opener)
1224:
1225: def read_bytes(self):
1226: """
File: '/usr/lib/python3.8/pathlib.py', lineno: 1078, function: _opener
1074: raise ValueError("I/O operation on closed path")
1075:
1076: def _opener(self, name, flags, mode=0o666):
1077: # A stub for the opener argument to built-in open()
*** 1078: return self._accessor.open(self, flags, mode)
1079:
1080: def _raw_open(self, flags, mode=0o777):
1081: """
1082: Open the file pointed by this path and return a file descriptor,
Exception: FileNotFoundError: [Errno 2] No such file or directory:
'/tmp/workspace.yd5o77EYlf/build/tmp-newlib/deploy/spdx/qemu-cortex-m3/recipes/recipe-gnu-config-native.spdx.json'
ERROR: Logfile of failure stored in:
/tmp/workspace.yd5o77EYlf/build/tmp-newlib/work/x86_64-linux/python3-native/3.10.4-r0/temp/log.do_create_spdx.12842
NOTE: recipe python3-native-3.10.4-r0: task do_create_spdx: Failed
ERROR: Task (virtual:native:/tmp/workspace.yd5o77EYlf/oe-core/meta/recipes-devtools/python/python3_3.10.4.bb:do_create_spdx)
failed with exit code '1'


Joshua Watt
 

On Fri, Jul 1, 2022 at 2:14 AM Marta Rybczynska <rybczynska@...> wrote:

Hello all,
We're trying to use create-spdx.bbclass with meta-zephyr. However,
this is failing with errors like the one at the bottom of the message.
While digging deeper, it is hard to reproduce reliably (but happens at
different recipes and frequently enough to have it at every build).
The workaround that works is to add:
do_create_spdx[nostamp] = "1"
which isn't great.

Has anyone tried create-spdx.bbclass with meta-zephyr? Any insight?

Kind regards,
Marta

And an example error message:

ERROR: python3-native-3.10.4-r0 do_create_spdx: Error executing a
python function in exec_func_python() autogenerated:
The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
0001:
*** 0002:do_create_spdx(d)
0003:
File: '/tmp/workspace.yd5o77EYlf/oe-core/meta/classes/create-spdx.bbclass',
lineno: 516, function: do_create_spdx
0512:
0513: if archive is not None:
0514: recipe.packageFileName = str(recipe_archive.name)
0515:
*** 0516: dep_recipes = collect_dep_recipes(d, doc, recipe)
0517:
0518: doc_sha1 = oe.sbom.write_doc(d, doc, "recipes")
0519: dep_recipes.append(oe.sbom.DepRecipe(doc, doc_sha1, recipe))
0520:
File: '/tmp/workspace.yd5o77EYlf/oe-core/meta/classes/create-spdx.bbclass',
lineno: 345, function: collect_dep_recipes
0341: ))
0342: for dep_pn in deps:
0343: dep_recipe_path = deploy_dir_spdx / "recipes" /
("recipe-%s.spdx.json" % dep_pn)
0344:
*** 0345: spdx_dep_doc, spdx_dep_sha1 = oe.sbom.read_doc(dep_recipe_path)
0346:
0347: for pkg in spdx_dep_doc.packages:
0348: if pkg.name == dep_pn:
0349: spdx_dep_recipe = pkg
File: '/tmp/workspace.yd5o77EYlf/oe-core/meta/lib/oe/sbom.py', lineno:
67, function: read_doc
0063: else:
0064: with fn.open("rb") as f:
0065: yield f
0066:
*** 0067: with get_file() as f:
0068: sha1 = hashlib.sha1()
0069: while True:
0070: chunk = f.read(4096)
0071: if not chunk:
File: '/usr/lib/python3.8/contextlib.py', lineno: 113, function: __enter__
0109: # do not keep args and kwds alive unnecessarily
0110: # they are only needed for recreation, which is not possible anymore
0111: del self.args, self.kwds, self.func
0112: try:
*** 0113: return next(self.gen)
0114: except StopIteration:
0115: raise RuntimeError("generator didn't yield") from None
0116:
0117: def __exit__(self, type, value, traceback):
File: '/tmp/workspace.yd5o77EYlf/oe-core/meta/lib/oe/sbom.py', lineno:
64, function: get_file
0060: def get_file():
0061: if isinstance(fn, io.IOBase):
0062: yield fn
0063: else:
*** 0064: with fn.open("rb") as f:
0065: yield f
0066:
0067: with get_file() as f:
0068: sha1 = hashlib.sha1()
File: '/usr/lib/python3.8/pathlib.py', lineno: 1222, function: open
1218: the built-in open() function does.
1219: """
1220: if self._closed:
1221: self._raise_closed()
*** 1222: return io.open(self, mode, buffering, encoding, errors, newline,
1223: opener=self._opener)
1224:
1225: def read_bytes(self):
1226: """
File: '/usr/lib/python3.8/pathlib.py', lineno: 1078, function: _opener
1074: raise ValueError("I/O operation on closed path")
1075:
1076: def _opener(self, name, flags, mode=0o666):
1077: # A stub for the opener argument to built-in open()
*** 1078: return self._accessor.open(self, flags, mode)
1079:
1080: def _raw_open(self, flags, mode=0o777):
1081: """
1082: Open the file pointed by this path and return a file descriptor,
Exception: FileNotFoundError: [Errno 2] No such file or directory:
'/tmp/workspace.yd5o77EYlf/build/tmp-newlib/deploy/spdx/qemu-cortex-m3/recipes/recipe-gnu-config-native.spdx.json'
This appears to be the actual error: python3:do_create_spdx can't find
the recipe-gnu-config-native.spdx.json. I'm not sure why that would be
the case though; do_create_spdx for gnu-config-native should always
run before do_create_spdx for python3 since it's a deptask

ERROR: Logfile of failure stored in:
/tmp/workspace.yd5o77EYlf/build/tmp-newlib/work/x86_64-linux/python3-native/3.10.4-r0/temp/log.do_create_spdx.12842
NOTE: recipe python3-native-3.10.4-r0: task do_create_spdx: Failed
ERROR: Task (virtual:native:/tmp/workspace.yd5o77EYlf/oe-core/meta/recipes-devtools/python/python3_3.10.4.bb:do_create_spdx)
failed with exit code '1'