问题
I am creating an image containing standard recipes and my owns. I wanted to list the licenses I use in all of the included packages and later check if I can use them for commercial application for example.
I had the bad surprise packagegroups have a LICENSE flag already. I noticed it doing:
bitbake -e -n -v core-image-minimal | grep "LICENSE"
It returns LICENSE=MIT since it is defined in the bb file.
But I have no information about all the included packages. This MIT has been put manually in the core-image-minimal.bb, but I'd be interested in all dependencies. I have the same issue for my .bb file.
Approach 1
A solution would be to put every license as INCOMPATIBLE_LICENSE and then
bitbake -k -n -e -v <recipe> | grep "incompatible with license"
then check which one pops out, add them in LICENSE_FLAGS_WHITELIST and removing them from INCOMPATIBLE_LICENSE and iterate. Problem is, each time it's done, it parses again the whole workspace, and it takes ages.
Is there a script somewhere to check that easily? A python one like Yocto always does.
Approach 2 I edited meta/classes/license.bbclass and added
bb.warn('%s license is %s' %(pn, licenses))
in the for loop of check_license_format function. Now it prints license for each package, but I'd like to have sort of sum up
Good way to do it
So, I couldn't compile my whole recipe since the "package-management" feature doesn't currently work with deb packages (read here). Please adapt your image recipe and use @Roman Khimov's method down there. It's the clean way to do it.
回答1:
You don't need to do anything special, just build your image and look at the resulting manifest file in build/tmp/deploy/licenses/$IMAGE_NAME-$MACHINE-$DATE/license.manifest
(if, of course, you didn't redefine LICENSE_DIRECTORY
).
For example, if I build core-image-minimal
for my own generic-amd64
MACHINE I get the result in build/tmp-musl/deploy/licenses/core-image-minimal-generic-amd64-20160818141324/license.manifest
:
PACKAGE NAME: base-files
PACKAGE VERSION: 3.0.14
RECIPE NAME: base-files
LICENSE: GPLv2
PACKAGE NAME: base-passwd
PACKAGE VERSION: 3.5.29
RECIPE NAME: base-passwd
LICENSE: GPLv2+
...
来源:https://stackoverflow.com/questions/39018941/licenses-for-packagegroups-and-images-on-yocto