License Files in torizon-core-docker bitbake

Hi!

When building a modified BSP based off of the torizon-core-docker image, the final license check of the rootfs build fails a lot, with errors like

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
     0001:
 *** 0002:license_create_manifest(d)
     0003:
File: '/home/beb/npu-test/bsp-synchron/build/conf/../../layers/openembedded-core/meta/classes/license_image.bbclass', lineno: 37, function: license_create_manifest
     0033:            pkg_dic[pkg_name]["LICENSE"] = pkg_dic[pkg_name][pkg_lic_name]
     0034:
     0035:    rootfs_license_manifest = os.path.join(d.getVar('LICENSE_DIRECTORY'),
     0036:                        d.getVar('IMAGE_NAME'), 'license.manifest')
 *** 0037:    write_license_files(d, rootfs_license_manifest, pkg_dic, rootfs=True)
     0038:}
     0039:
     0040:def write_license_files(d, license_manifest, pkg_dic, rootfs=True):
     0041:    import re
File: '/home/beb/npu-test/bsp-synchron/build/conf/../../layers/openembedded-core/meta/classes/license_image.bbclass', lineno: 127, function: write_license_files
     0123:
     0124:                pkg_manifest_licenses = [canonical_license(d, lic) \
     0125:                        for lic in pkg_dic[pkg]["LICENSES"]]
     0126:
 *** 0127:                licenses = os.listdir(pkg_license_dir)
     0128:                for lic in licenses:
     0129:                    pkg_license = os.path.join(pkg_license_dir, lic)
     0130:                    pkg_rootfs_license = os.path.join(pkg_rootfs_license_dir, lic)
     0131:

Exception: FileNotFoundError: [Errno 2] No such file or directory: '/home/beb/npu-test/bsp-synchron/build/deploy/licenses/cryptsetup'

Curiously, these failures are all from packages in openembedded-core (like cryptsetup, bridge-utils, cpufrequtils), packages whose recipes and licenses had worked before and presumably have been tested by many others.

It seems like I have an issue with the license_image.bbclass that generates and populates the license directory. I’ve tried wiping that directory to get bitbake to repopulate it, as well as manually adding a few directories to the license directory (in case it was only a few for some reason), but it would seem the issue is systemic.

Do you have any advice for dealing with such an issue?

Florence L.

Hi @beb,

It seems that there are some issues with the license for the cryptsetup package, you can check which package is the problem by seeing the last line:

Exception: FileNotFoundError: [Errno 2] No such file or directory: '/home/beb/npu-test/bsp-synchron/build/deploy/licenses/cryptsetup'

You can solve this issue by cleaning the package and building it again:

bitbake cryptsetup -c cleanall

Best regards,
Daniel Morais

My main issue is that there seems to be issues with multiple licenses. Cleaning cryptsetup and rebuilding gives me an error with acl, and so on.

Would you recommend just cleaning and rebuilding entirely?

HI @beb,

I suggest cleaning package by package, another alternative is cleaning your environment (deleting tmp folder as an example), but it will take more time since you will need to rebuild every package from the beginning.

Best regards,
Daniel Morais

I am in the process of building after cleaning the environment (I tried package by package but it seemed the issue was affecting so many packages I didn’t want to do all that manually)

I will update this thread when the build succeeds or fails

I cleaned the environment entirely (deleting tmp, deploy, sstate-cache) and rebuilt the image, and got an acl license issue again:

ERROR: torizon-core-docker-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:license_create_manifest(d)
     0003:
File: '/home/beb/npu-test/bsp-synchron/build/conf/../../layers/openembedded-core/meta/classes/license_image.bbclass', lineno: 37, function: license_create_manifest
     0033:            pkg_dic[pkg_name]["LICENSE"] = pkg_dic[pkg_name][pkg_lic_name]
     0034:
     0035:    rootfs_license_manifest = os.path.join(d.getVar('LICENSE_DIRECTORY'),
     0036:                        d.getVar('IMAGE_NAME'), 'license.manifest')
 *** 0037:    write_license_files(d, rootfs_license_manifest, pkg_dic, rootfs=True)
     0038:}
     0039:
     0040:def write_license_files(d, license_manifest, pkg_dic, rootfs=True):
     0041:    import re
File: '/home/beb/npu-test/bsp-synchron/build/conf/../../layers/openembedded-core/meta/classes/license_image.bbclass', lineno: 127, function: write_license_files
     0123:
     0124:                pkg_manifest_licenses = [canonical_license(d, lic) \
     0125:                        for lic in pkg_dic[pkg]["LICENSES"]]
     0126:
 *** 0127:                licenses = os.listdir(pkg_license_dir)
     0128:                for lic in licenses:
     0129:                    pkg_license = os.path.join(pkg_license_dir, lic)
     0130:                    pkg_rootfs_license = os.path.join(pkg_rootfs_license_dir, lic)
     0131:
Exception: FileNotFoundError: [Errno 2] No such file or directory: '/home/beb/npu-test/bsp-synchron/build/deploy/licenses/acl'

Similarly to before i cleaned everything, cleaning and rebuilding acl results in a different license error (in this case aktualizer-docker-compose-sec), and I suspect rebuilding that will also result in another license error.

Have you seen any similar issues with perhaps the license_image.bbclass that creates the license directories? Is there a way to (at least temporarily) disable the license checking in the local.conf or something?

Beb

Hi @beb,

Thanks for the logs!

That’s strange, can you please create a new oe-core folder and start the build from the beginning on this new directory? I expected this to solve the issue.

Yes, I have faced this issue before and to solve this I cleaned package by package.

Best regards,
Daniel Morais