Bug 10325

Summary: license.bbclass should only copy licenses for packages actually installed
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Saul Wold <sgw>
Component: coreAssignee: Aníbal Limón <anibal.limon>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: Medium CC: anibal.limon, bluelightning, meta.mr.watcher, meta.watcher, net147, ross.burton
Version: 2.2   
Target Milestone: 2.3 M3   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Yes (doc changes required)

Description Saul Wold 2016-09-23 03:32:16 UTC
The license.bbclass has 2 options, COPY_LIC_MANIFEST and COPY_LIC_DIRS.  The MANIFEST option will correctly collect the licenses from the packages installed on the target rootfs.

The LIC_DIRS copies all of the recipe's licenses regardless of whether that installed packages use those licenses or not.  This is most noticed with the linux-firmware recipe and related packages where there are many licenses for the firmware, but only the installed packages with specific licenses should be included.

One solution would be to modify the COPY_LIC_DIRS to always create the manifest, which is based on the installed packages and only copy those licenses to the common-licenses directory.
Comment 1 Saul Wold 2017-01-03 23:35:29 UTC
I started to do some investigation on this and I think it can be accomplished by tracking in an array which licenses are listed in the manifest.

There seems to be an additional behavior that I am not sure is correct or not, this is also copying additional files like recipeinfo from the license deploy dir to the rootfs.
Comment 2 Aníbal Limón 2017-02-13 20:36:23 UTC
The current implementation takes into account packages at time of copy licenses to the rootfs.

The problem seems to be at do_populate_lic [1], that is copying all the licenses associated with a recipe in every package.

[1] http://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/classes/license.bbclass#n291