diff options
| author | Elizabeth Flanagan <elizabeth.flanagan@intel.com> | 2011-12-03 15:16:15 -0800 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-12-08 15:23:40 +0000 |
| commit | 558b5043e1d5a36caff137093fd04abcf025af1c (patch) | |
| tree | bcbe76b99d6860a112885eaa2f7a48c0eeaa333f /meta | |
| parent | 25dc5af38230fdf5891597c07c4f96c633001006 (diff) | |
| download | openembedded-core-558b5043e1d5a36caff137093fd04abcf025af1c.tar.gz openembedded-core-558b5043e1d5a36caff137093fd04abcf025af1c.tar.bz2 openembedded-core-558b5043e1d5a36caff137093fd04abcf025af1c.zip | |
[YOCTO #1776] license: manifest and license path
This is a fairly large commit, so I want to step through some of
what this accomplishes:
1. Additional licenses
I've added/modified/corrected some of the common licenses
within OE-core in prep. for a major license audit. Most of these
are in SPDX format. A few, there is no OSI equivalent.
2. Additional SPDX mappings
I've added some additional SPDX mappings to account for removing
some duplicate licenses. (ie GPL-2 and GPL-2.0 were the same)
I've also remapped a few things to more accurately reflect what
they should be pointing at.
Note: Artistic/LGPL/GPL/MPL. Quite a few LICENSE fields list these
licenses. They make no sense and need auditing. In a future commit
I have some fixes to particularly egregious LICENSE fields, but
a full audit should be done. I've listed to obvious candidates at:
https://wiki.yoctoproject.org/wiki/License_Audit
3. License manifest
We now have a license manifest generation that occurs in rootfs for
everything BUT .deb. This requires the changes Paul Eggleton has
done to rootfs_* particularly the list_installed_packages function.
The manifest is accurate during a parallel bitbake now (Weee!) and
is prime for my planned SPDX format manifest during the next period.
4. License manifest on image.
We also want the ability to add licenses to the image. This
functionality is also in base-files and will be stripped out in my
next commit. The manifest is not added by default and is a two var
setting in license.conf:
If I want *just* the manifest on the image (small) then I set:
COPY_LIC_MANIFEST = "1"
This copies the manifest to:
/usr/share/common-licenses/license.manifest
If I want the actual PKG license text on the image (much larger)
I need to set both both COPY_LIC_MANIFEST and COPY_LIC_DIRS in
license.conf. This will create:
/usr/share/common-licenses/(package name)/(licenses in LIC_SRC_URI)
Word of warning. This can be larger than wanted depending on image
and is probably ripe for linking licenses, but I ran out of time this
week to get that done.
5. Custom License search path.
We now have the ability to add licenses to the build without touching
common-licenses. This is set via license.conf:
LICENSE_PATH += "/path/to/custom/licenses"
You want to make sure the license is unique. license.bbclass picks the
first license it finds.
Signed-off-by: Elizabeth Flanagan <elizabeth.flanagan@intel.com>
Diffstat (limited to 'meta')
104 files changed, 1119 insertions, 17671 deletions
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass index 8c6e2d2c9b..8c64e4cd8a 100644 --- a/meta/classes/license.bbclass +++ b/meta/classes/license.bbclass @@ -1,17 +1,12 @@ # Populates LICENSE_DIRECTORY as set in distro config with the license files as set by # LIC_FILES_CHKSUM. # TODO: -# - We should also enable the ability to put the generated license directory onto the -# rootfs -# - Gather up more generic licenses -# - There is a real issue revolving around license naming standards. See license names -# licenses.conf and compare them to the license names in the recipes. You'll see some -# differences and that should be corrected. +# - There is a real issue revolving around license naming standards. LICENSE_DIRECTORY ??= "${DEPLOY_DIR}/licenses" LICSSTATEDIR = "${WORKDIR}/license-destdir/" -addtask populate_lic after do_patch before do_package +addtask populate_lic after do_patch before do_compile do_populate_lic[dirs] = "${LICSSTATEDIR}/${PN}" do_populate_lic[cleandirs] = "${LICSSTATEDIR}" @@ -22,33 +17,122 @@ do_populate_lic[cleandirs] = "${LICSSTATEDIR}" # # We should really discuss standardizing this field, but that's a longer term goal. # For now, we can do this and it should grab the most common LICENSE naming variations. - -#GPL variations -SPDXLICENSEMAP[GPL] = "GPL-1" -SPDXLICENSEMAP[GPLv2] = "GPL-2" -SPDXLICENSEMAP[GPLv3] = "GPL-3" +# +# Changing GPL mapping to GPL-2 as it's not very likely to be GPL-1 +# We should NEVER have a GPL/LGPL without a version!!!! +# Any mapping to MPL/LGPL/GPL should be fixed +# see: https://wiki.yoctoproject.org/wiki/License_Audit + +# GPL variations +SPDXLICENSEMAP[GPL-2] = "GPL-2.0" +SPDXLICENSEMAP[GPLv2] = "GPL-2.0" +SPDXLICENSEMAP[GPLv2.0] = "GPL-2.0" +SPDXLICENSEMAP[GPL-3] = "GPL-3.0" +SPDXLICENSEMAP[GPLv3] = "GPL-3.0" +SPDXLICENSEMAP[GPLv3.0] = "GPL-3.0" #LGPL variations -SPDXLICENSEMAP[LGPL] = "LGPL-2" -SPDXLICENSEMAP[LGPLv2] = "LGPL-2" +SPDXLICENSEMAP[LGPLv2] = "LGPL-2.0" SPDXLICENSEMAP[LGPL2.1] = "LGPL-2.1" SPDXLICENSEMAP[LGPLv2.1] = "LGPL-2.1" -SPDXLICENSEMAP[LGPLv3] = "LGPL-3" +SPDXLICENSEMAP[LGPLv3] = "LGPL-3.0" #MPL variations -SPDXLICENSEMAP[MPL] = "MPL-1" -SPDXLICENSEMAP[MPLv1] = "MPL-1" -SPDXLICENSEMAP[MPLv1.1] = "MPL-1" +SPDXLICENSEMAP[MPL-1] = "MPL-1.0" +SPDXLICENSEMAP[MPLv1] = "MPL-1.0" +SPDXLICENSEMAP[MPLv1.1] = "MPL-1.1" #MIT variations SPDXLICENSEMAP[MIT-X] = "MIT" +SPDXLICENSEMAP[MIT-style] = "MIT" #Openssl variations SPDXLICENSEMAP[openssl] = "OpenSSL" +#Python variations +SPDXLICENSEMAP[PSF] = "Python-2.0" +SPDXLICENSEMAP[PSFv2] = "Python-2.0" +SPDXLICENSEMAP[Python-2] = "Python-2.0" + +#Apache variations +SPDXLICENSEMAP[Apachev2] = "Apache-2.0" +SPDXLICENSEMAP[Apache-2] = "Apache-2.0" + +#Artistic variations +SPDXLICENSEMAP[Artisticv1] = "Artistic-1.0" +SPDXLICENSEMAP[Artistic-1] = "Artistic-1.0" + +#Academic variations +SPDXLICENSEMAP[AFL-2] = "AFL-2.0" +SPDXLICENSEMAP[AFL-1] = "AFL-1.2" +SPDXLICENSEMAP[AFLv2] = "AFL-2.0" +SPDXLICENSEMAP[AFLv1] = "AFL-1.2" + #Other variations -SPDXLICENSEMAP[AFL2.1] = "AFL-2" -SPDXLICENSEMAP[EPLv1.0] = "EPL-1" +SPDXLICENSEMAP[EPLv1.0] = "EPL-1.0" + +license_create_manifest() { + mkdir -p ${LICENSE_DIRECTORY}/${IMAGE_NAME} + # Get list of installed packages + list_installed_packages | grep -v "locale" |sort > ${LICENSE_DIRECTORY}/${IMAGE_NAME}/package.manifest + INSTALLED_PKGS=`cat ${LICENSE_DIRECTORY}/${IMAGE_NAME}/package.manifest` + # list of installed packages is broken for deb + if [ ${IMAGE_PKGTYPE} != "deb" ]; then + + for pkg in ${INSTALLED_PKGS}; do + # not the best way to do this but licenses are not arch dependant iirc + files=`find ${TMPDIR}/pkgdata/*/runtime -name ${pkg}| head -1` + for filename in $files; do + pkged_pn="$(sed -n 's/^PN: //p' ${filename})" + pkged_lic="$(sed -n '/^LICENSE: /{ s/^LICENSE: //; s/[+|&()*]/ /g; s/ */ /g; p }' ${filename})" + # check to see if the package name exists in the manifest. if so, bail. + if ! grep -q "PACKAGE NAME: ${pkg}" ${filename}; then + # exclude local recipes + if [ ! ${pkged_pn} == "*locale*" ]; then + echo "PACKAGE NAME:" ${pkg} >> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest + echo "RECIPE NAME:" ${pkged_pn} >> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest + echo "LICENSE: " >> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest + for lic in ${pkged_lic}; do + if [ -e "${LICENSE_DIRECTORY}/${pkged_pn}/generic_${lic}" ]; then + echo ${lic}|sed s'/generic_//'g >> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest + else + echo "WARNING: The license listed, " ${lic} " was not in the licenses collected for " ${pkged_pn}>> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest + fi + done + echo "" >> ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest + fi + fi + done + done + fi + + # Two options here: + # - Just copy the manifest + # - Copy the manifest and the license directories + # This will make your image a bit larger, however + # if you are concerned about license compliance + # and delivery this should cover all your bases + + if [ -n ${COPY_LIC_MANIFEST} ]; then + mkdir -p ${IMAGE_ROOTFS}/usr/share/common-licenses/ + cp ${LICENSE_DIRECTORY}/${IMAGE_NAME}/license.manifest ${IMAGE_ROOTFS}/usr/share/common-licenses/license.manifest + |
