Tuesday, August 3, 2010

distribute_license.bbclass

This blog post is going to be about the distribute_license.bbclass file that was added to openembedded mainline recently. It was added as commit id 5e75fa8c1b28055b610eb47ba5d3368a16810aa4 on July 30th 2010.

The reason I created this class was that while distributing images and software packages as part of an SDK I needed to also distribute a manifest of what software components were distributed and their licensing. However, some packages like liboil had "unknown" licensing defined in the ipk control file. This is because they don't have a standard license like GPL.

Instead packages like liboil have a COPYING or LICENSE or some other type of file in their soruces that indicates their licensing terms. The purpose of the distribute_license class is to take these files from the sources and copy them into the deploy direcgtory. Then the meta sdk package can include them for distribution. Thus packages like liboil can have their license set to "liboil" and users can look at the liboil directory in the deploy/licenses directory to find the license files for liboil.

By default this class will look only in the top-level source directory of a package for files matching the pattern COPYING* or LICENSE*. However, each package has the ability to define its own LICENSE_FILES pattern as well as LICENSE_SEARCH_DEPTH. This can be done using overrides such as:

LICENSE_FILES_liboil = "COPYING"
LICENSE_SEARCH_DEPTH_liboil = "2"

The reason for this is that packages may use a non-standard name for their license files. Thus it is useful to be able to change the search string. They may also not include the license file in the top-level directory, or sub-directories could have different licenses. This is why we allow varying search depth.

When the search depth is expanded past the top-level directory any matching licenses in a sub-directory will be placed in the ${DEPLOY_DIR}/licenses/${PN}/ relative path. That way it is clear what directory each license file corresponds to.

No comments:

Post a Comment