Bug 14123 - License manifest loss when switching MACHINE
Summary: License manifest loss when switching MACHINE
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 3.1.4
Hardware: x86 Multiple
: Medium normal
Target Milestone: 5.0
Assignee: Richard Purdie
QA Contact:
URL:
Whiteboard: AB-INT AB-HAVE-PLAN
Depends on:
Blocks:
 
Reported: 2020-11-10 15:21 UTC by Steve Sakoman
Modified: 2024-01-26 16:24 UTC (History)
8 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Sakoman 2020-11-10 15:21:42 UTC
ERROR: core-image-minimal-1.0-r0 do_populate_lic_deploy: Error executing a python function in exec_python_func() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_python_func() autogenerated', lineno: 2, function: <module>
     0001:
 *** 0002:do_populate_lic_deploy(d)
     0003:
File: '/home/pokybuild/yocto-worker/oe-selftest-debian/build/meta/classes/license_image.bbclass', lineno: 251, function: do_populate_lic_deploy
     0247:ROOTFS_POSTPROCESS_COMMAND_prepend = "write_package_manifest; license_create_manifest; "
     0248:do_rootfs[recrdeptask] += "do_populate_lic"
     0249:
     0250:python do_populate_lic_deploy() {
 *** 0251:    license_deployed_manifest(d)
     0252:}
     0253:
     0254:addtask populate_lic_deploy before do_build after do_image_complete
     0255:do_populate_lic_deploy[recrdeptask] += "do_populate_lic do_deploy"
File: '/home/pokybuild/yocto-worker/oe-selftest-debian/build/meta/classes/license_image.bbclass', lineno: 192, function: license_deployed_manifest
     0188:        man_dic[dep]["IMAGE_MANIFEST"] = True
     0189:        man_dic[dep]["PN"] = dep
     0190:        man_dic[dep]["FILES"] = \
     0191:            " ".join(get_deployed_files(dep_dic[dep]))
 *** 0192:        with open(os.path.join(lic_dir, dep, "recipeinfo"), "r") as f:
     0193:            for line in f.readlines():
     0194:                key,val = line.split(": ", 1)
     0195:                man_dic[dep][key] = val[:-1]
     0196:
Exception: FileNotFoundError: [Errno 2] No such file or directory: '/home/pokybuild/yocto-worker/oe-selftest-debian/build/build-st-21565/tmp/deploy/licenses/linux-yocto/recipeinfo'


Complete log at:

https://errors.yoctoproject.org/Errors/Details/538106/

Build directory saved in /home/pokybuild/saved/build-st-21565 on debian9-ty-2

A quick look shows that there is no tmp/deploy/licenses/linux-yocto directory
Comment 1 Richard Purdie 2021-07-06 11:46:29 UTC
There were builds for both qemux86-64 and genericx86-64 which would have overlapping files for tmp/deploy/licenses/linux-yocto/

The workdir for genericx86-64 linux-yocto does show the files as being present and should have been installed. The qemux86-64 kernel is only built up to do_patch. There are logs showing linux-yocto was cleaned for qemux86-64.

The mixing of machine specific files like this looks like a recipe for disaster and I think it is just luck we're not hitting many more issues with this code.
Comment 2 Richard Purdie 2021-07-06 14:00:08 UTC
Reproduction steps:

MACHINE=qemux86-64 bitbake core-image-minimal
MACHINE=genericx86-64 bitbake core-image-minimal
MACHINE=qemux86-64 bitbake linux-yocto -c clean
MACHINE=genericx86-64 bitbake core-image-minimal -C rootfs
Comment 3 Richard Purdie 2023-09-18 13:33:16 UTC
With create-spdx as default, this now fails with:

ERROR: core-image-minimal-1.0-r0 do_rootfs: 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:image_combine_spdx(d)
     0003:
File: '/media/build/poky/meta/classes/create-spdx-2.2.bbclass', lineno: 953, function: image_combine_spdx
     0949:    imgdeploydir = Path(d.getVar("IMGDEPLOYDIR"))
     0950:    img_spdxid = oe.sbom.get_image_spdxid(image_name)
     0951:    packages = image_list_installed_packages(d)
     0952:
 *** 0953:    combine_spdx(d, image_name, imgdeploydir, img_spdxid, packages, Path(d.getVar("SPDXIMAGEWORK")))
     0954:
     0955:    def make_image_link(target_path, suffix):
     0956:        if image_link_name:
     0957:            link = imgdeploydir / (image_link_name + suffix)
File: '/media/build/poky/meta/classes/create-spdx-2.2.bbclass', lineno: 1117, function: combine_spdx
     1113:                for ref in doc.externalDocumentRefs:
     1114:                    ref_path = oe.sbom.doc_path_by_namespace(deploy_dir_spdx, ref.spdxDocument)
     1115:                    collect_spdx_document(ref_path)
     1116:
 *** 1117:            collect_spdx_document(image_spdx_path)
     1118:
     1119:            index["documents"].sort(key=lambda x: x["filename"])
     1120:
     1121:            index_str = io.BytesIO(json.dumps(
File: '/media/build/poky/meta/classes/create-spdx-2.2.bbclass', lineno: 1115, function: collect_spdx_document
     1111:                    })
     1112:
     1113:                for ref in doc.externalDocumentRefs:
     1114:                    ref_path = oe.sbom.doc_path_by_namespace(deploy_dir_spdx, ref.spdxDocument)
 *** 1115:                    collect_spdx_document(ref_path)
     1116:
     1117:            collect_spdx_document(image_spdx_path)
     1118:
     1119:            index["documents"].sort(key=lambda x: x["filename"])
File: '/media/build/poky/meta/classes/create-spdx-2.2.bbclass', lineno: 1085, function: collect_spdx_document
     1081:                    return
     1082:
     1083:                visited_docs.add(path)
     1084:
 *** 1085:                with path.open("rb") as f:
     1086:                    doc, sha1 = oe.sbom.read_doc(f)
     1087:                    f.seek(0)
     1088:
     1089:                    if doc.documentNamespace in visited_docs:
File: '/usr/lib/python3.10/pathlib.py', lineno: 1119, function: open
     1115:        the built-in open() function does.
     1116:        """
     1117:        if "b" not in mode:
     1118:            encoding = io.text_encoding(encoding)
 *** 1119:        return self._accessor.open(self, mode, buffering, encoding, errors,
     1120:                                   newline)
     1121:
     1122:    def read_bytes(self):
     1123:        """
Exception: FileNotFoundError: [Errno 2] No such file or directory: '/media/build/poky/build/tmp/deploy/spdx/by-namespace/http:__spdx.org_spdxdoc_kernel-a04b82a2-40ce-50cc-92b7-d98ced8e6259'

ERROR: Logfile of failure stored in: /media/build/poky/build/tmp/work/genericx86_64-poky-linux/core-image-minimal/1.0/temp/log.do_rootfs.2396412
ERROR: Task (/media/build/poky/meta/recipes-core/images/core-image-minimal.bb:do_rootfs) failed with exit code '1'
Comment 4 Randy MacLeod 2023-10-30 15:37:31 UTC
Build move to 5.0 -- ../Randy
Comment 5 Ross Burton 2024-01-23 18:17:01 UTC
Is this still an issue?
Comment 6 Simone Weiß 2024-01-25 06:23:38 UTC
Tried to reproduce with the steps mentioned in https://bugzilla.yoctoproject.org/show_bug.cgi?id=14123#c2. No issue was visible any more.
Comment 7 Randy MacLeod 2024-01-25 15:55:49 UTC
Richard wants to double check and maybe find the commit that fixed this.
Comment 8 Simone Weiß 2024-01-25 16:11:54 UTC
I checked, this was fixed via b0b0b89ad763a50cb02429b31f24400ddd4491b7 by Richard already. Seems just like the Bug was not updated.
Comment 9 Richard Purdie 2024-01-26 16:24:14 UTC
I double checked that the license issue was fixed as well as the spdx one and it was so we can close this as fixed by b0b0b89ad763a50cb02429b31f24400ddd4491b7, thanks for the commit Simone.