2011-04-21 11:26:25 +00:00
|
|
|
# Populates LICENSE_DIRECTORY as set in distro config with the license files as set by
|
2011-12-05 01:03:37 +00:00
|
|
|
# LIC_FILES_CHKSUM.
|
2011-01-27 19:25:12 +00:00
|
|
|
# TODO:
|
2011-12-03 23:16:15 +00:00
|
|
|
# - There is a real issue revolving around license naming standards.
|
2011-01-27 19:25:12 +00:00
|
|
|
|
2011-05-17 09:47:53 +00:00
|
|
|
LICENSE_DIRECTORY ??= "${DEPLOY_DIR}/licenses"
|
2011-02-03 12:33:18 +00:00
|
|
|
LICSSTATEDIR = "${WORKDIR}/license-destdir/"
|
2011-01-27 19:25:12 +00:00
|
|
|
|
2013-01-17 11:49:44 +00:00
|
|
|
# Create extra package with license texts and add it to RRECOMMENDS_${PN}
|
2013-01-29 21:17:20 +00:00
|
|
|
LICENSE_CREATE_PACKAGE[type] = "boolean"
|
2013-01-17 11:49:44 +00:00
|
|
|
LICENSE_CREATE_PACKAGE ??= "0"
|
|
|
|
LICENSE_PACKAGE_SUFFIX ??= "-lic"
|
|
|
|
LICENSE_FILES_DIRECTORY ??= "${datadir}/licenses/"
|
|
|
|
|
2012-11-16 18:26:44 +00:00
|
|
|
addtask populate_lic after do_patch before do_build
|
2011-02-03 12:33:18 +00:00
|
|
|
do_populate_lic[dirs] = "${LICSSTATEDIR}/${PN}"
|
|
|
|
do_populate_lic[cleandirs] = "${LICSSTATEDIR}"
|
2011-05-25 20:58:35 +00:00
|
|
|
|
2014-01-27 01:41:31 +00:00
|
|
|
python write_package_manifest() {
|
2014-07-18 12:41:34 +00:00
|
|
|
# Get list of installed packages
|
|
|
|
license_image_dir = d.expand('${LICENSE_DIRECTORY}/${IMAGE_NAME}')
|
|
|
|
bb.utils.mkdirhier(license_image_dir)
|
|
|
|
from oe.rootfs import image_list_installed_packages
|
2016-01-18 14:33:06 +00:00
|
|
|
from oe.utils import format_pkg_list
|
|
|
|
|
|
|
|
pkgs = image_list_installed_packages(d)
|
|
|
|
output = format_pkg_list(pkgs)
|
2014-07-18 12:41:34 +00:00
|
|
|
open(os.path.join(license_image_dir, 'package.manifest'),
|
2016-01-18 14:33:06 +00:00
|
|
|
'w+').write(output)
|
2014-01-27 01:41:31 +00:00
|
|
|
}
|
|
|
|
|
2015-11-13 14:29:18 +00:00
|
|
|
python write_deploy_manifest() {
|
|
|
|
license_deployed_manifest(d)
|
|
|
|
}
|
|
|
|
|
2015-05-08 20:41:28 +00:00
|
|
|
python license_create_manifest() {
|
|
|
|
import oe.packagedata
|
2015-05-08 20:41:32 +00:00
|
|
|
from oe.rootfs import image_list_installed_packages
|
2015-05-08 20:41:28 +00:00
|
|
|
|
2016-12-14 21:13:04 +00:00
|
|
|
build_images_from_feeds = d.getVar('BUILD_IMAGES_FROM_FEEDS')
|
2015-05-08 20:41:28 +00:00
|
|
|
if build_images_from_feeds == "1":
|
|
|
|
return 0
|
|
|
|
|
|
|
|
pkg_dic = {}
|
2016-01-18 14:33:06 +00:00
|
|
|
for pkg in sorted(image_list_installed_packages(d)):
|
2016-12-14 21:13:04 +00:00
|
|
|
pkg_info = os.path.join(d.getVar('PKGDATA_DIR'),
|
2015-05-08 20:41:32 +00:00
|
|
|
'runtime-reverse', pkg)
|
|
|
|
pkg_name = os.path.basename(os.readlink(pkg_info))
|
|
|
|
|
|
|
|
pkg_dic[pkg_name] = oe.packagedata.read_pkgdatafile(pkg_info)
|
|
|
|
if not "LICENSE" in pkg_dic[pkg_name].keys():
|
|
|
|
pkg_lic_name = "LICENSE_" + pkg_name
|
|
|
|
pkg_dic[pkg_name]["LICENSE"] = pkg_dic[pkg_name][pkg_lic_name]
|
2015-05-08 20:41:28 +00:00
|
|
|
|
2016-12-14 21:13:04 +00:00
|
|
|
rootfs_license_manifest = os.path.join(d.getVar('LICENSE_DIRECTORY'),
|
|
|
|
d.getVar('IMAGE_NAME'), 'license.manifest')
|
2015-10-01 11:25:08 +00:00
|
|
|
write_license_files(d, rootfs_license_manifest, pkg_dic)
|
|
|
|
}
|
|
|
|
|
|
|
|
def write_license_files(d, license_manifest, pkg_dic):
|
|
|
|
import re
|
|
|
|
|
2016-12-14 21:13:04 +00:00
|
|
|
bad_licenses = (d.getVar("INCOMPATIBLE_LICENSE") or "").split()
|
2015-10-01 11:25:08 +00:00
|
|
|
bad_licenses = map(lambda l: canonical_license(d, l), bad_licenses)
|
|
|
|
bad_licenses = expand_wildcard_licenses(d, bad_licenses)
|
|
|
|
|
2015-05-08 20:41:28 +00:00
|
|
|
with open(license_manifest, "w") as license_file:
|
|
|
|
for pkg in sorted(pkg_dic):
|
2015-05-08 20:41:31 +00:00
|
|
|
if bad_licenses:
|
|
|
|
try:
|
|
|
|
(pkg_dic[pkg]["LICENSE"], pkg_dic[pkg]["LICENSES"]) = \
|
|
|
|
oe.license.manifest_licenses(pkg_dic[pkg]["LICENSE"],
|
|
|
|
bad_licenses, canonical_license, d)
|
|
|
|
except oe.license.LicenseError as exc:
|
2016-12-14 21:13:04 +00:00
|
|
|
bb.fatal('%s: %s' % (d.getVar('P'), exc))
|
2015-05-08 20:41:31 +00:00
|
|
|
else:
|
2016-01-11 05:55:38 +00:00
|
|
|
pkg_dic[pkg]["LICENSES"] = re.sub('[|&()*]', ' ', pkg_dic[pkg]["LICENSE"])
|
2015-05-08 20:41:31 +00:00
|
|
|
pkg_dic[pkg]["LICENSES"] = re.sub(' *', ' ', pkg_dic[pkg]["LICENSES"])
|
|
|
|
pkg_dic[pkg]["LICENSES"] = pkg_dic[pkg]["LICENSES"].split()
|
|
|
|
|
2015-11-13 14:29:18 +00:00
|
|
|
if not "IMAGE_MANIFEST" in pkg_dic[pkg]:
|
|
|
|
# Rootfs manifest
|
|
|
|
license_file.write("PACKAGE NAME: %s\n" % pkg)
|
|
|
|
license_file.write("PACKAGE VERSION: %s\n" % pkg_dic[pkg]["PV"])
|
|
|
|
license_file.write("RECIPE NAME: %s\n" % pkg_dic[pkg]["PN"])
|
|
|
|
license_file.write("LICENSE: %s\n\n" % pkg_dic[pkg]["LICENSE"])
|
|
|
|
|
|
|
|
# If the package doesn't contain any file, that is, its size is 0, the license
|
|
|
|
# isn't relevant as far as the final image is concerned. So doing license check
|
|
|
|
# doesn't make much sense, skip it.
|
|
|
|
if pkg_dic[pkg]["PKGSIZE_%s" % pkg] == "0":
|
|
|
|
continue
|
|
|
|
else:
|
|
|
|
# Image manifest
|
|
|
|
license_file.write("RECIPE NAME: %s\n" % pkg_dic[pkg]["PN"])
|
|
|
|
license_file.write("VERSION: %s\n" % pkg_dic[pkg]["PV"])
|
|
|
|
license_file.write("LICENSE: %s\n" % pkg_dic[pkg]["LICENSE"])
|
|
|
|
license_file.write("FILES: %s\n\n" % pkg_dic[pkg]["FILES"])
|
2015-05-08 20:41:28 +00:00
|
|
|
|
2015-05-08 20:41:31 +00:00
|
|
|
for lic in pkg_dic[pkg]["LICENSES"]:
|
2016-12-14 21:13:04 +00:00
|
|
|
lic_file = os.path.join(d.getVar('LICENSE_DIRECTORY'),
|
2015-05-08 20:41:28 +00:00
|
|
|
pkg_dic[pkg]["PN"], "generic_%s" %
|
|
|
|
re.sub('\+', '', lic))
|
2015-05-18 20:33:07 +00:00
|
|
|
# add explicity avoid of CLOSED license because isn't generic
|
|
|
|
if lic == "CLOSED":
|
|
|
|
continue
|
|
|
|
|
2015-05-08 20:41:28 +00:00
|
|
|
if not os.path.exists(lic_file):
|
|
|
|
bb.warn("The license listed %s was not in the "\
|
|
|
|
"licenses collected for recipe %s"
|
|
|
|
% (lic, pkg_dic[pkg]["PN"]))
|
|
|
|
|
|
|
|
# Two options here:
|
|
|
|
# - Just copy the manifest
|
|
|
|
# - Copy the manifest and the license directories
|
|
|
|
# With both options set we see a .5 M increase in core-image-minimal
|
2016-12-14 21:13:04 +00:00
|
|
|
copy_lic_manifest = d.getVar('COPY_LIC_MANIFEST')
|
|
|
|
copy_lic_dirs = d.getVar('COPY_LIC_DIRS')
|
2015-05-08 20:41:28 +00:00
|
|
|
if copy_lic_manifest == "1":
|
2017-01-05 21:15:08 +00:00
|
|
|
rootfs_license_dir = os.path.join(d.getVar('IMAGE_ROOTFS'),
|
2015-05-08 20:41:28 +00:00
|
|
|
'usr', 'share', 'common-licenses')
|
2015-10-01 11:25:08 +00:00
|
|
|
bb.utils.mkdirhier(rootfs_license_dir)
|
2015-05-08 20:41:28 +00:00
|
|
|
rootfs_license_manifest = os.path.join(rootfs_license_dir,
|
2015-10-01 11:25:08 +00:00
|
|
|
os.path.split(license_manifest)[1])
|
|
|
|
if not os.path.exists(rootfs_license_manifest):
|
|
|
|
os.link(license_manifest, rootfs_license_manifest)
|
2015-05-08 20:41:28 +00:00
|
|
|
|
|
|
|
if copy_lic_dirs == "1":
|
|
|
|
for pkg in sorted(pkg_dic):
|
|
|
|
pkg_rootfs_license_dir = os.path.join(rootfs_license_dir, pkg)
|
2015-10-01 11:25:08 +00:00
|
|
|
bb.utils.mkdirhier(pkg_rootfs_license_dir)
|
2016-12-14 21:13:04 +00:00
|
|
|
pkg_license_dir = os.path.join(d.getVar('LICENSE_DIRECTORY'),
|
2015-05-08 20:41:28 +00:00
|
|
|
pkg_dic[pkg]["PN"])
|
2017-02-16 16:45:32 +00:00
|
|
|
|
|
|
|
pkg_manifest_licenses = [canonical_license(d, lic) \
|
|
|
|
for lic in pkg_dic[pkg]["LICENSES"]]
|
|
|
|
|
2015-05-08 20:41:28 +00:00
|
|
|
licenses = os.listdir(pkg_license_dir)
|
|
|
|
for lic in licenses:
|
|
|
|
rootfs_license = os.path.join(rootfs_license_dir, lic)
|
|
|
|
pkg_license = os.path.join(pkg_license_dir, lic)
|
|
|
|
pkg_rootfs_license = os.path.join(pkg_rootfs_license_dir, lic)
|
|
|
|
|
|
|
|
if re.match("^generic_.*$", lic):
|
2017-02-16 16:45:32 +00:00
|
|
|
generic_lic = canonical_license(d,
|
|
|
|
re.search("^generic_(.*)$", lic).group(1))
|
|
|
|
|
|
|
|
# Do not copy generic license into package if isn't
|
|
|
|
# declared into LICENSES of the package.
|
|
|
|
if not re.sub('\+$', '', generic_lic) in \
|
|
|
|
[re.sub('\+', '', lic) for lic in \
|
|
|
|
pkg_manifest_licenses]:
|
|
|
|
continue
|
|
|
|
|
|
|
|
if oe.license.license_ok(generic_lic,
|
|
|
|
bad_licenses) == False:
|
2015-05-08 20:41:31 +00:00
|
|
|
continue
|
|
|
|
|
2015-05-08 20:41:28 +00:00
|
|
|
if not os.path.exists(rootfs_license):
|
|
|
|
os.link(pkg_license, rootfs_license)
|
|
|
|
|
2015-10-01 11:25:08 +00:00
|
|
|
if not os.path.exists(pkg_rootfs_license):
|
|
|
|
os.symlink(os.path.join('..', lic), pkg_rootfs_license)
|
2015-05-08 20:41:28 +00:00
|
|
|
else:
|
2015-10-01 11:25:08 +00:00
|
|
|
if (oe.license.license_ok(canonical_license(d,
|
|
|
|
lic), bad_licenses) == False or
|
|
|
|
os.path.exists(pkg_rootfs_license)):
|
2015-05-08 20:41:31 +00:00
|
|
|
continue
|
|
|
|
|
2015-05-08 20:41:28 +00:00
|
|
|
os.link(pkg_license, pkg_rootfs_license)
|
2015-10-01 11:25:08 +00:00
|
|
|
|
2011-12-03 23:16:15 +00:00
|
|
|
|
2015-11-13 14:29:18 +00:00
|
|
|
def license_deployed_manifest(d):
|
|
|
|
"""
|
|
|
|
Write the license manifest for the deployed recipes.
|
|
|
|
The deployed recipes usually includes the bootloader
|
|
|
|
and extra files to boot the target.
|
|
|
|
"""
|
|
|
|
|
|
|
|
dep_dic = {}
|
|
|
|
man_dic = {}
|
2016-12-14 21:13:04 +00:00
|
|
|
lic_dir = d.getVar("LICENSE_DIRECTORY")
|
2015-11-13 14:29:18 +00:00
|
|
|
|
|
|
|
dep_dic = get_deployed_dependencies(d)
|
|
|
|
for dep in dep_dic.keys():
|
|
|
|
man_dic[dep] = {}
|
|
|
|
# It is necessary to mark this will be used for image manifest
|
|
|
|
man_dic[dep]["IMAGE_MANIFEST"] = True
|
|
|
|
man_dic[dep]["PN"] = dep
|
|
|
|
man_dic[dep]["FILES"] = \
|
|
|
|
" ".join(get_deployed_files(dep_dic[dep]))
|
|
|
|
with open(os.path.join(lic_dir, dep, "recipeinfo"), "r") as f:
|
|
|
|
for line in f.readlines():
|
|
|
|
key,val = line.split(": ", 1)
|
|
|
|
man_dic[dep][key] = val[:-1]
|
|
|
|
|
2016-12-14 21:13:04 +00:00
|
|
|
lic_manifest_dir = os.path.join(d.getVar('LICENSE_DIRECTORY'),
|
|
|
|
d.getVar('IMAGE_NAME'))
|
2016-04-21 11:03:26 +00:00
|
|
|
bb.utils.mkdirhier(lic_manifest_dir)
|
|
|
|
image_license_manifest = os.path.join(lic_manifest_dir, 'image_license.manifest')
|
2015-11-13 14:29:18 +00:00
|
|
|
write_license_files(d, image_license_manifest, man_dic)
|
|
|
|
|
2015-11-12 14:14:40 +00:00
|
|
|
def get_deployed_dependencies(d):
|
|
|
|
"""
|
|
|
|
Get all the deployed dependencies of an image
|
|
|
|
"""
|
|
|
|
|
|
|
|
deploy = {}
|
|
|
|
# Get all the dependencies for the current task (rootfs).
|
|
|
|
# Also get EXTRA_IMAGEDEPENDS because the bootloader is
|
|
|
|
# usually in this var and not listed in rootfs.
|
|
|
|
# At last, get the dependencies from boot classes because
|
|
|
|
# it might contain the bootloader.
|
2015-12-15 16:40:36 +00:00
|
|
|
taskdata = d.getVar("BB_TASKDEPDATA", False)
|
2015-11-12 14:14:40 +00:00
|
|
|
depends = list(set([dep[0] for dep
|
2016-05-20 10:49:34 +00:00
|
|
|
in list(taskdata.values())
|
2015-11-12 14:14:40 +00:00
|
|
|
if not dep[0].endswith("-native")]))
|
2016-12-14 21:13:04 +00:00
|
|
|
extra_depends = d.getVar("EXTRA_IMAGEDEPENDS")
|
2015-11-12 14:14:40 +00:00
|
|
|
boot_depends = get_boot_dependencies(d)
|
|
|
|
depends.extend(extra_depends.split())
|
|
|
|
depends.extend(boot_depends)
|
|
|
|
depends = list(set(depends))
|
|
|
|
|
|
|
|
# To verify what was deployed it checks the rootfs dependencies against
|
|
|
|
# the SSTATE_MANIFESTS for "deploy" task.
|
|
|
|
# The manifest file name contains the arch. Because we are not running
|
|
|
|
# in the recipe context it is necessary to check every arch used.
|
2016-12-14 21:13:04 +00:00
|
|
|
sstate_manifest_dir = d.getVar("SSTATE_MANIFESTS")
|
|
|
|
sstate_archs = d.getVar("SSTATE_ARCHS")
|
|
|
|
extra_archs = d.getVar("PACKAGE_EXTRA_ARCHS")
|
2015-11-12 14:14:40 +00:00
|
|
|
archs = list(set(("%s %s" % (sstate_archs, extra_archs)).split()))
|
|
|
|
for dep in depends:
|
|
|
|
# Some recipes have an arch on their own, so we try that first.
|
2016-12-14 21:13:04 +00:00
|
|
|
special_arch = d.getVar("PACKAGE_ARCH_pn-%s" % dep)
|
2015-11-12 14:14:40 +00:00
|
|
|
if special_arch:
|
|
|
|
sstate_manifest_file = os.path.join(sstate_manifest_dir,
|
|
|
|
"manifest-%s-%s.deploy" % (special_arch, dep))
|
|
|
|
if os.path.exists(sstate_manifest_file):
|
|
|
|
deploy[dep] = sstate_manifest_file
|
|
|
|
continue
|
|
|
|
|
|
|
|
for arch in archs:
|
|
|
|
sstate_manifest_file = os.path.join(sstate_manifest_dir,
|
|
|
|
"manifest-%s-%s.deploy" % (arch, dep))
|
|
|
|
if os.path.exists(sstate_manifest_file):
|
|
|
|
deploy[dep] = sstate_manifest_file
|
|
|
|
break
|
|
|
|
|
|
|
|
return deploy
|
2015-12-15 16:40:36 +00:00
|
|
|
get_deployed_dependencies[vardepsexclude] = "BB_TASKDEPDATA"
|
2015-11-12 14:14:40 +00:00
|
|
|
|
2015-11-12 12:36:02 +00:00
|
|
|
def get_boot_dependencies(d):
|
|
|
|
"""
|
|
|
|
Return the dependencies from boot tasks
|
|
|
|
"""
|
|
|
|
|
|
|
|
depends = []
|
|
|
|
boot_depends_string = ""
|
2015-12-15 16:40:36 +00:00
|
|
|
taskdepdata = d.getVar("BB_TASKDEPDATA", False)
|
2015-11-12 12:36:02 +00:00
|
|
|
# Only bootimg and bootdirectdisk include the depends flag
|
|
|
|
boot_tasks = ["do_bootimg", "do_bootdirectdisk",]
|
|
|
|
|
|
|
|
for task in boot_tasks:
|
|
|
|
boot_depends_string = "%s %s" % (boot_depends_string,
|
2016-12-14 21:13:06 +00:00
|
|
|
d.getVarFlag(task, "depends") or "")
|
2015-11-12 12:36:02 +00:00
|
|
|
boot_depends = [dep.split(":")[0] for dep
|
|
|
|
in boot_depends_string.split()
|
|
|
|
if not dep.split(":")[0].endswith("-native")]
|
|
|
|
for dep in boot_depends:
|
2016-12-14 21:13:04 +00:00
|
|
|
info_file = os.path.join(d.getVar("LICENSE_DIRECTORY"),
|
2015-11-12 12:36:02 +00:00
|
|
|
dep, "recipeinfo")
|
|
|
|
# If the recipe and dependency name is the same
|
|
|
|
if os.path.exists(info_file):
|
|
|
|
depends.append(dep)
|
|
|
|
# We need to search for the provider of the dependency
|
|
|
|
else:
|
2016-05-20 10:49:34 +00:00
|
|
|
for taskdep in taskdepdata.values():
|
2015-11-12 12:36:02 +00:00
|
|
|
# The fifth field contains what the task provides
|
|
|
|
if dep in taskdep[4]:
|
|
|
|
info_file = os.path.join(
|
2016-12-14 21:13:04 +00:00
|
|
|
d.getVar("LICENSE_DIRECTORY"),
|
2015-11-12 12:36:02 +00:00
|
|
|
taskdep[0], "recipeinfo")
|
|
|
|
if os.path.exists(info_file):
|
|
|
|
depends.append(taskdep[0])
|
|
|
|
break
|
|
|
|
return depends
|
2015-12-15 16:40:36 +00:00
|
|
|
get_boot_dependencies[vardepsexclude] = "BB_TASKDEPDATA"
|
2015-11-12 12:36:02 +00:00
|
|
|
|
2015-11-12 14:21:06 +00:00
|
|
|
def get_deployed_files(man_file):
|
|
|
|
"""
|
|
|
|
Get the files deployed from the sstate manifest
|
|
|
|
"""
|
|
|
|
|
|
|
|
dep_files = []
|
2017-02-14 14:20:02 +00:00
|
|
|
excluded_files = []
|
2015-11-12 14:21:06 +00:00
|
|
|
with open(man_file, "r") as manifest:
|
|
|
|
all_files = manifest.read()
|
|
|
|
for f in all_files.splitlines():
|
|
|
|
if ((not (os.path.islink(f) or os.path.isdir(f))) and
|
|
|
|
not os.path.basename(f) in excluded_files):
|
|
|
|
dep_files.append(os.path.basename(f))
|
|
|
|
return dep_files
|
|
|
|
|
2011-01-27 19:25:12 +00:00
|
|
|
python do_populate_lic() {
|
|
|
|
"""
|
|
|
|
Populate LICENSE_DIRECTORY with licenses.
|
|
|
|
"""
|
2013-01-17 11:49:43 +00:00
|
|
|
lic_files_paths = find_license_files(d)
|
|
|
|
|
|
|
|
# The base directory we wrangle licenses to
|
2016-12-14 21:13:04 +00:00
|
|
|
destdir = os.path.join(d.getVar('LICSSTATEDIR'), d.getVar('PN'))
|
2013-01-17 11:49:43 +00:00
|
|
|
copy_license_files(lic_files_paths, destdir)
|
2015-11-19 08:05:46 +00:00
|
|
|
info = get_recipe_info(d)
|
|
|
|
with open(os.path.join(destdir, "recipeinfo"), "w") as f:
|
|
|
|
for key in sorted(info.keys()):
|
|
|
|
f.write("%s: %s\n" % (key, info[key]))
|
2013-01-17 11:49:43 +00:00
|
|
|
}
|
|
|
|
|
2013-01-17 11:49:44 +00:00
|
|
|
# it would be better to copy them in do_install_append, but find_license_filesa is python
|
|
|
|
python perform_packagecopy_prepend () {
|
2013-01-29 21:17:20 +00:00
|
|
|
enabled = oe.data.typed_value('LICENSE_CREATE_PACKAGE', d)
|
2016-12-14 21:13:04 +00:00
|
|
|
if d.getVar('CLASSOVERRIDE') == 'class-target' and enabled:
|
2013-01-17 11:49:44 +00:00
|
|
|
lic_files_paths = find_license_files(d)
|
|
|
|
|
|
|
|
# LICENSE_FILES_DIRECTORY starts with '/' so os.path.join cannot be used to join D and LICENSE_FILES_DIRECTORY
|
2016-12-14 21:13:04 +00:00
|
|
|
destdir = d.getVar('D') + os.path.join(d.getVar('LICENSE_FILES_DIRECTORY'), d.getVar('PN'))
|
2013-01-17 11:49:44 +00:00
|
|
|
copy_license_files(lic_files_paths, destdir)
|
|
|
|
add_package_and_files(d)
|
|
|
|
}
|
2016-02-03 16:34:52 +00:00
|
|
|
perform_packagecopy[vardeps] += "LICENSE_CREATE_PACKAGE"
|
2013-01-17 11:49:44 +00:00
|
|
|
|
2015-11-19 08:05:46 +00:00
|
|
|
def get_recipe_info(d):
|
|
|
|
info = {}
|
2016-12-14 21:13:04 +00:00
|
|
|
info["PV"] = d.getVar("PV")
|
|
|
|
info["PR"] = d.getVar("PR")
|
|
|
|
info["LICENSE"] = d.getVar("LICENSE")
|
2015-11-19 08:05:46 +00:00
|
|
|
return info
|
|
|
|
|
2013-01-17 11:49:44 +00:00
|
|
|
def add_package_and_files(d):
|
2016-12-14 21:13:04 +00:00
|
|
|
packages = d.getVar('PACKAGES')
|
|
|
|
files = d.getVar('LICENSE_FILES_DIRECTORY')
|
|
|
|
pn = d.getVar('PN')
|
2015-06-18 14:14:16 +00:00
|
|
|
pn_lic = "%s%s" % (pn, d.getVar('LICENSE_PACKAGE_SUFFIX', False))
|
2013-01-17 11:49:44 +00:00
|
|
|
if pn_lic in packages:
|
|
|
|
bb.warn("%s package already existed in %s." % (pn_lic, pn))
|
|
|
|
else:
|
|
|
|
# first in PACKAGES to be sure that nothing else gets LICENSE_FILES_DIRECTORY
|
|
|
|
d.setVar('PACKAGES', "%s %s" % (pn_lic, packages))
|
|
|
|
d.setVar('FILES_' + pn_lic, files)
|
2016-12-14 21:13:04 +00:00
|
|
|
rrecommends_pn = d.getVar('RRECOMMENDS_' + pn)
|
2013-01-17 11:49:44 +00:00
|
|
|
if rrecommends_pn:
|
|
|
|
d.setVar('RRECOMMENDS_' + pn, "%s %s" % (pn_lic, rrecommends_pn))
|
|
|
|
else:
|
|
|
|
d.setVar('RRECOMMENDS_' + pn, "%s" % (pn_lic))
|
|
|
|
|
2013-01-17 11:49:43 +00:00
|
|
|
def copy_license_files(lic_files_paths, destdir):
|
2013-10-02 16:30:21 +00:00
|
|
|
import shutil
|
2016-06-11 07:50:02 +00:00
|
|
|
import errno
|
2013-10-02 16:30:21 +00:00
|
|
|
|
2013-09-01 07:52:40 +00:00
|
|
|
bb.utils.mkdirhier(destdir)
|
2017-02-11 03:35:37 +00:00
|
|
|
for (basename, path, beginline, endline) in lic_files_paths:
|
2013-10-02 16:30:21 +00:00
|
|
|
try:
|
2014-09-12 15:39:49 +00:00
|
|
|
src = path
|
|
|
|
dst = os.path.join(destdir, basename)
|
|
|
|
if os.path.exists(dst):
|
|
|
|
os.remove(dst)
|
2016-10-31 03:59:43 +00:00
|
|
|
if os.path.islink(src):
|
|
|
|
src = os.path.realpath(src)
|
2017-02-11 03:35:37 +00:00
|
|
|
canlink = os.access(src, os.W_OK) and (os.stat(src).st_dev == os.stat(destdir).st_dev) and beginline is None and endline is None
|
2016-06-11 07:50:02 +00:00
|
|
|
if canlink:
|
2015-11-28 08:09:54 +00:00
|
|
|
try:
|
2016-06-11 07:50:02 +00:00
|
|
|
os.link(src, dst)
|
|
|
|
except OSError as err:
|
|
|
|
if err.errno == errno.EXDEV:
|
|
|
|
# Copy license files if hard-link is not possible even if st_dev is the
|
|
|
|
# same on source and destination (docker container with device-mapper?)
|
|
|
|
canlink = False
|
|
|
|
else:
|
|
|
|
raise
|
2017-02-22 15:26:50 +00:00
|
|
|
# Only chown if we did hardling, and, we're running under pseudo
|
|
|
|
if canlink and os.environ.get('PSEUDO_DISABLED') == '0':
|
|
|
|
os.chown(dst,0,0)
|
2016-06-11 07:50:02 +00:00
|
|
|
if not canlink:
|
2017-02-11 03:35:37 +00:00
|
|
|
begin_idx = int(beginline)-1 if beginline is not None else None
|
|
|
|
end_idx = int(endline) if endline is not None else None
|
|
|
|
if begin_idx is None and end_idx is None:
|
|
|
|
shutil.copyfile(src, dst)
|
|
|
|
else:
|
2017-03-08 14:30:13 +00:00
|
|
|
with open(src, 'rb') as src_f:
|
|
|
|
with open(dst, 'wb') as dst_f:
|
|
|
|
dst_f.write(b''.join(src_f.readlines()[begin_idx:end_idx]))
|
2017-02-11 03:35:37 +00:00
|
|
|
|
2013-10-02 16:30:21 +00:00
|
|
|
except Exception as e:
|
2014-11-13 07:55:58 +00:00
|
|
|
bb.warn("Could not copy license file %s to %s: %s" % (src, dst, e))
|
2013-01-17 11:49:43 +00:00
|
|
|
|
|
|
|
def find_license_files(d):
|
|
|
|
"""
|
|
|
|
Creates list of files used in LIC_FILES_CHKSUM and generic LICENSE files.
|
|
|
|
"""
|
2011-01-27 19:25:12 +00:00
|
|
|
import shutil
|
2011-12-05 01:03:37 +00:00
|
|
|
import oe.license
|
2016-08-05 10:23:52 +00:00
|
|
|
from collections import defaultdict, OrderedDict
|
2011-05-25 20:58:35 +00:00
|
|
|
|
2011-12-03 23:16:15 +00:00
|
|
|
# All the license files for the package
|
2016-12-14 21:13:04 +00:00
|
|
|
lic_files = d.getVar('LIC_FILES_CHKSUM') or ""
|
|
|
|
pn = d.getVar('PN')
|
2011-12-03 23:16:15 +00:00
|
|
|
# The license files are located in S/LIC_FILE_CHECKSUM.
|
2016-12-14 21:13:04 +00:00
|
|
|
srcdir = d.getVar('S')
|
2011-12-03 23:16:15 +00:00
|
|
|
# Directory we store the generic licenses as set in the distro configuration
|
2016-12-14 21:13:04 +00:00
|
|
|
generic_directory = d.getVar('COMMON_LICENSE_DIR')
|
2013-01-17 11:49:43 +00:00
|
|
|
# List of basename, path tuples
|
|
|
|
lic_files_paths = []
|
2017-02-16 16:45:31 +00:00
|
|
|
# hash for keep track generic lics mappings
|
|
|
|
non_generic_lics = {}
|
2016-08-05 10:23:52 +00:00
|
|
|
# Entries from LIC_FILES_CHKSUM
|
|
|
|
lic_chksums = {}
|
2011-12-03 23:16:15 +00:00
|
|
|
license_source_dirs = []
|
|
|
|
license_source_dirs.append(generic_directory)
|
|
|
|
try:
|
2016-12-14 21:13:04 +00:00
|
|
|
additional_lic_dirs = d.getVar('LICENSE_PATH').split()
|
2011-12-03 23:16:15 +00:00
|
|
|
for lic_dir in additional_lic_dirs:
|
|
|
|
license_source_dirs.append(lic_dir)
|
|
|
|
except:
|
|
|
|
pass
|
|
|
|
|
2011-12-05 01:03:37 +00:00
|
|
|
class FindVisitor(oe.license.LicenseVisitor):
|
2011-05-25 20:58:35 +00:00
|
|
|
def visit_Str(self, node):
|
|
|
|
#
|
|
|
|
# Until I figure out what to do with
|
|
|
|
# the two modifiers I support (or greater = +
|
|
|
|
# and "with exceptions" being *
|
2011-12-05 01:03:37 +00:00
|
|
|
# we'll just strip out the modifier and put
|
2011-05-25 20:58:35 +00:00
|
|
|
# the base license.
|
|
|
|
find_license(node.s.replace("+", "").replace("*", ""))
|
2011-12-05 01:03:37 +00:00
|
|
|
self.generic_visit(node)
|
2011-05-25 20:58:35 +00:00
|
|
|
|
|
|
|
def find_license(license_type):
|
|
|
|
try:
|
2013-09-01 07:52:40 +00:00
|
|
|
bb.utils.mkdirhier(gen_lic_dest)
|
2011-05-25 20:58:35 +00:00
|
|
|
except:
|
|
|
|
pass
|
2011-12-03 23:16:15 +00:00
|
|
|
spdx_generic = None
|
|
|
|
license_source = None
|
2015-04-23 07:05:04 +00:00
|
|
|
# If the generic does not exist we need to check to see if there is an SPDX mapping to it,
|
|
|
|
# unless NO_GENERIC_LICENSE is set.
|
2011-12-03 23:16:15 +00:00
|
|
|
for lic_dir in license_source_dirs:
|
|
|
|
if not os.path.isfile(os.path.join(lic_dir, license_type)):
|
2016-12-14 21:13:06 +00:00
|
|
|
if d.getVarFlag('SPDXLICENSEMAP', license_type) != None:
|
2011-12-03 23:16:15 +00:00
|
|
|
# Great, there is an SPDXLICENSEMAP. We can copy!
|
|
|
|
bb.debug(1, "We need to use a SPDXLICENSEMAP for %s" % (license_type))
|
2016-12-14 21:13:06 +00:00
|
|
|
spdx_generic = d.getVarFlag('SPDXLICENSEMAP', license_type)
|
2011-12-03 23:16:15 +00:00
|
|
|
license_source = lic_dir
|
|
|
|
break
|
|
|
|
elif os.path.isfile(os.path.join(lic_dir, license_type)):
|
|
|
|
spdx_generic = license_type
|
|
|
|
license_source = lic_dir
|
|
|
|
break
|
|
|
|
|
2016-12-14 21:13:06 +00:00
|
|
|
non_generic_lic = d.getVarFlag('NO_GENERIC_LICENSE', license_type)
|
2011-12-03 23:16:15 +00:00
|
|
|
if spdx_generic and license_source:
|
|
|
|
# we really should copy to generic_ + spdx_generic, however, that ends up messing the manifest
|
|
|
|
# audit up. This should be fixed in emit_pkgdata (or, we actually got and fix all the recipes)
|
2012-04-03 11:05:48 +00:00
|
|
|
|
2017-02-11 03:35:37 +00:00
|
|
|
lic_files_paths.append(("generic_" + license_type, os.path.join(license_source, spdx_generic),
|
|
|
|
None, None))
|
2015-04-23 07:05:04 +00:00
|
|
|
|
|
|
|
# The user may attempt to use NO_GENERIC_LICENSE for a generic license which doesn't make sense
|
|
|
|
# and should not be allowed, warn the user in this case.
|
2016-12-14 21:13:06 +00:00
|
|
|
if d.getVarFlag('NO_GENERIC_LICENSE', license_type):
|
2015-04-23 07:05:04 +00:00
|
|
|
bb.warn("%s: %s is a generic license, please don't use NO_GENERIC_LICENSE for it." % (pn, license_type))
|
|
|
|
|
2016-08-05 10:23:52 +00:00
|
|
|
elif non_generic_lic and non_generic_lic in lic_chksums:
|
2015-04-23 07:05:04 +00:00
|
|
|
# if NO_GENERIC_LICENSE is set, we copy the license files from the fetched source
|
|
|
|
# of the package rather than the license_source_dirs.
|
2016-08-05 10:23:52 +00:00
|
|
|
lic_files_paths.append(("generic_" + license_type,
|
2017-02-11 03:35:37 +00:00
|
|
|
os.path.join(srcdir, non_generic_lic), None, None))
|
2017-02-16 16:45:31 +00:00
|
|
|
non_generic_lics[non_generic_lic] = license_type
|
2011-12-03 23:16:15 +00:00
|
|
|
else:
|
2015-05-18 20:33:07 +00:00
|
|
|
# Add explicity avoid of CLOSED license because this isn't generic
|
|
|
|
if license_type != 'CLOSED':
|
|
|
|
# And here is where we warn people that their licenses are lousy
|
|
|
|
bb.warn("%s: No generic license file exists for: %s in any provider" % (pn, license_type))
|
2011-12-03 23:16:15 +00:00
|
|
|
pass
|
2011-12-05 01:03:37 +00:00
|
|
|
|
2011-01-27 19:25:12 +00:00
|
|
|
if not generic_directory:
|
2016-10-01 02:47:00 +00:00
|
|
|
bb.fatal("COMMON_LICENSE_DIR is unset. Please set this in your distro config")
|
2011-01-27 19:25:12 +00:00
|
|
|
|
|
|
|
for url in lic_files.split():
|
2013-11-12 13:29:24 +00:00
|
|
|
try:
|
|
|
|
(type, host, path, user, pswd, parm) = bb.fetch.decodeurl(url)
|
|
|
|
except bb.fetch.MalformedUrl:
|
2016-12-14 21:13:04 +00:00
|
|
|
bb.fatal("%s: LIC_FILES_CHKSUM contains an invalid URL: %s" % (d.getVar('PF'), url))
|
2013-01-17 11:49:43 +00:00
|
|
|
# We want the license filename and path
|
2017-08-30 23:46:22 +00:00
|
|
|
chksum = parm.get('md5', None)
|
2017-02-11 03:35:37 +00:00
|
|
|
beginline = parm.get('beginline')
|
|
|
|
endline = parm.get('endline')
|
|
|
|
lic_chksums[path] = (chksum, beginline, endline)
|
2011-12-05 01:03:37 +00:00
|
|
|
|
|
|
|
v = FindVisitor()
|
|
|
|
try:
|
2016-12-14 21:13:04 +00:00
|
|
|
v.visit_string(d.getVar('LICENSE'))
|
2011-12-05 01:03:37 +00:00
|
|
|
except oe.license.InvalidLicense as exc:
|
2016-12-14 21:13:04 +00:00
|
|
|
bb.fatal('%s: %s' % (d.getVar('PF'), exc))
|
2011-12-10 00:05:24 +00:00
|
|
|
except SyntaxError:
|
2016-12-14 21:13:04 +00:00
|
|
|
bb.warn("%s: Failed to parse it's LICENSE field." % (d.getVar('PF')))
|
2016-08-05 10:23:52 +00:00
|
|
|
# Add files from LIC_FILES_CHKSUM to list of license files
|
|
|
|
lic_chksum_paths = defaultdict(OrderedDict)
|
2017-04-05 21:51:31 +00:00
|
|
|
for path, data in sorted(lic_chksums.items()):
|
2017-02-11 03:35:37 +00:00
|
|
|
lic_chksum_paths[os.path.basename(path)][data] = (os.path.join(srcdir, path), data[1], data[2])
|
2016-08-05 10:23:52 +00:00
|
|
|
for basename, files in lic_chksum_paths.items():
|
|
|
|
if len(files) == 1:
|
2017-02-16 16:45:31 +00:00
|
|
|
# Don't copy again a LICENSE already handled as non-generic
|
|
|
|
if basename in non_generic_lics:
|
|
|
|
continue
|
2017-02-11 03:35:37 +00:00
|
|
|
data = list(files.values())[0]
|
|
|
|
lic_files_paths.append(tuple([basename] + list(data)))
|
2016-08-05 10:23:52 +00:00
|
|
|
else:
|
|
|
|
# If there are multiple different license files with identical
|
|
|
|
# basenames we rename them to <file>.0, <file>.1, ...
|
2017-02-11 03:35:37 +00:00
|
|
|
for i, data in enumerate(files.values()):
|
|
|
|
lic_files_paths.append(tuple(["%s.%d" % (basename, i)] + list(data)))
|
2016-08-05 10:23:52 +00:00
|
|
|
|
2013-01-17 11:49:43 +00:00
|
|
|
return lic_files_paths
|
2011-02-03 12:33:18 +00:00
|
|
|
|
2012-03-23 23:51:42 +00:00
|
|
|
def return_spdx(d, license):
|
|
|
|
"""
|
2012-11-29 19:08:47 +00:00
|
|
|
This function returns the spdx mapping of a license if it exists.
|
|
|
|
"""
|
2016-12-14 21:13:06 +00:00
|
|
|
return d.getVarFlag('SPDXLICENSEMAP', license)
|
2012-03-23 23:51:42 +00:00
|
|
|
|
2014-07-17 14:41:05 +00:00
|
|
|
def canonical_license(d, license):
|
|
|
|
"""
|
|
|
|
Return the canonical (SPDX) form of the license if available (so GPLv3
|
2014-10-27 07:37:41 +00:00
|
|
|
becomes GPL-3.0), for the license named 'X+', return canonical form of
|
|
|
|
'X' if availabel and the tailing '+' (so GPLv3+ becomes GPL-3.0+),
|
|
|
|
or the passed license if there is no canonical form.
|
2014-07-17 14:41:05 +00:00
|
|
|
"""
|
2016-12-14 21:13:06 +00:00
|
|
|
lic = d.getVarFlag('SPDXLICENSEMAP', license) or ""
|
2014-10-27 07:37:41 +00:00
|
|
|
if not lic and license.endswith('+'):
|
2017-01-05 21:15:08 +00:00
|
|
|
lic = d.getVarFlag('SPDXLICENSEMAP', license.rstrip('+'))
|
2014-10-27 07:37:41 +00:00
|
|
|
if lic:
|
|
|
|
lic += '+'
|
|
|
|
return lic or license
|
2014-07-17 14:41:05 +00:00
|
|
|
|
2014-12-15 08:55:10 +00:00
|
|
|
def expand_wildcard_licenses(d, wildcard_licenses):
|
|
|
|
"""
|
|
|
|
Return actual spdx format license names if wildcard used. We expand
|
|
|
|
wildcards from SPDXLICENSEMAP flags and SRC_DISTRIBUTE_LICENSES values.
|
|
|
|
"""
|
|
|
|
import fnmatch
|
|
|
|
licenses = []
|
|
|
|
spdxmapkeys = d.getVarFlags('SPDXLICENSEMAP').keys()
|
|
|
|
for wld_lic in wildcard_licenses:
|
|
|
|
spdxflags = fnmatch.filter(spdxmapkeys, wld_lic)
|
2016-12-14 21:13:06 +00:00
|
|
|
licenses += [d.getVarFlag('SPDXLICENSEMAP', flag) for flag in spdxflags]
|
2014-12-15 08:55:10 +00:00
|
|
|
|
2015-06-18 14:14:16 +00:00
|
|
|
spdx_lics = (d.getVar('SRC_DISTRIBUTE_LICENSES', False) or '').split()
|
2014-12-15 08:55:10 +00:00
|
|
|
for wld_lic in wildcard_licenses:
|
|
|
|
licenses += fnmatch.filter(spdx_lics, wld_lic)
|
|
|
|
|
|
|
|
licenses = list(set(licenses))
|
|
|
|
return licenses
|
|
|
|
|
|
|
|
def incompatible_license_contains(license, truevalue, falsevalue, d):
|
|
|
|
license = canonical_license(d, license)
|
2016-12-14 21:13:04 +00:00
|
|
|
bad_licenses = (d.getVar('INCOMPATIBLE_LICENSE') or "").split()
|
2014-12-15 08:55:10 +00:00
|
|
|
bad_licenses = expand_wildcard_licenses(d, bad_licenses)
|
|
|
|
return truevalue if license in bad_licenses else falsevalue
|
|
|
|
|
2012-11-29 19:08:47 +00:00
|
|
|
def incompatible_license(d, dont_want_licenses, package=None):
|
2012-03-23 23:51:42 +00:00
|
|
|
"""
|
2014-07-17 14:41:05 +00:00
|
|
|
This function checks if a recipe has only incompatible licenses. It also
|
|
|
|
take into consideration 'or' operand. dont_want_licenses should be passed
|
|
|
|
as canonical (SPDX) names.
|
2012-01-10 15:17:58 +00:00
|
|
|
"""
|
|
|
|
import oe.license
|
2016-12-14 21:13:04 +00:00
|
|
|
license = d.getVar("LICENSE_%s" % package) if package else None
|
2012-11-29 19:08:47 +00:00
|
|
|
if not license:
|
2016-12-14 21:13:04 +00:00
|
|
|
license = d.getVar('LICENSE')
|
2012-11-29 19:08:47 +00:00
|
|
|
|
|
|
|
# Handles an "or" or two license sets provided by
|
|
|
|
# flattened_licenses(), pick one that works if possible.
|
|
|
|
def choose_lic_set(a, b):
|
2015-07-30 21:40:13 +00:00
|
|
|
return a if all(oe.license.license_ok(canonical_license(d, lic),
|
|
|
|
dont_want_licenses) for lic in a) else b
|
2012-01-10 15:17:58 +00:00
|
|
|
|
2013-01-15 20:22:48 +00:00
|
|
|
try:
|
|
|
|
licenses = oe.license.flattened_licenses(license, choose_lic_set)
|
|
|
|
except oe.license.LicenseError as exc:
|
2016-12-14 21:13:04 +00:00
|
|
|
bb.fatal('%s: %s' % (d.getVar('P'), exc))
|
2015-05-08 20:41:29 +00:00
|
|
|
return any(not oe.license.license_ok(canonical_license(d, l), \
|
|
|
|
dont_want_licenses) for l in licenses)
|
2012-01-10 15:17:58 +00:00
|
|
|
|
license.bbclass: add support for LICENSE_FLAGS
LICENSE_FLAGS are a per-recipe replacement for the COMMERCIAL_LICENSE
mechanism.
In the COMMERCIAL_LICENSE mechanism, any package name mentioned in the
global COMMERCIAL_LICENSE list is 'blacklisted' from being included in
an image. To allow the blacklisted package into the image, the
corresponding packages need to be removed from the COMMERCIAL_LICENSE
list. This mechanism relies on a global list defined in
default-distrovars.inc.
The LICENSE_FLAGS mechanism essentially implements the same thing but
turns the global blacklist into a per-recipe whitelist. Any recipe
can optionally define one or more 'license flags'; if defined, each of
the license flags defined for a recipe must have matching entries in a
global LICENSE_FLAGS_WHITELIST variable.
The definition of 'matching' is simple, but there are a couple things
users need to know in order to correctly and effectively use it.
Before we test a flag against the whitelist, we append _${PN} to it,
thus automatically making each LICENSE_FLAG recipe-specific. We then
try to match that string against the whitelist. So if the user
specifies LICENSE_FLAGS = 'commercial' for recipe 'foo', the string
'commercial_foo' should be specified in the whitelist in order for it
to match.
However, the user can also broaden the match by putting any
'_'-separated beginning subset of a LICENSE_FLAG in the whitelist,
which will also match e.g. simply specifying 'commercial' in the
whitelist would match any expanded LICENSE_FLAG starting with
'commercial' such as 'commercial_foo' and 'commercial_bar' which are
the strings that would have been automatically generated if those
recipes had simply specified LICENSE_FLAGS = 'commercial'
This allows for a range of specificity for the items in the whitelist,
from more general to perfectly specific. So users have the choice of
exhaustively enumerating each license flag in the whitelist to allow
only those specific recipes into the image, or of using a more general
string to pick up anything matching just the first component(s).
Note that this scheme works even if the flag already has _pn appended
- the extra _pn is redundant, but doesn't affect the outcome e.g. a
license flag of 'commercial_1.2_foo' would turn into
'commercial_1.2_foo_foo' and would match both the general 'commercial'
and the specific 'commercial_1.2_foo' as expected (it would also match
commercial_1.2_foo_foo' and 'commercial_1.2', which don't make much
sense as far as something a user would think of specifying in the
whitelist). For a versioned string, the user could instead specify
'commercial_foo_1.2', which would turn into 'commercial_foo_1.2_foo',
but which would as expected allow the user to pick up this package
along with anything else 'commercial' by specifying 'commercial' in
the whitelist, or anything with a 'commercial_foo' license regardless
of version by using 'commercial_foo' in the whitelist, or
'commercial_foo_1.1' to be completely specific about package and
version.
The current behavior of COMMERCIAL_LICENSE is replicated as mentioned
above by having the current set of COMMERCIAL_LICENSE flags
implemented using LICENSE_FLAGS = "commercial".
That being the case, the current COMMERCIAL_LICENSE can equivalently
be specified in the new scheme by putting the below in local.conf:
# This is a list of packages that require a commercial license to ship
# product. If shipped as part of an image these packages may have
# implications so they are disabled by default. To enable them,
# un-comment the below as appropriate.
#LICENSE_FLAGS_WHITELIST = "commercial_gst-fluendo-mp3 \
# commercial_gst-openmax \
# commercial_gst-plugins-ugly \
# commercial_lame \
# commercial_libmad \
# commercial_libomxil \
# commercial_mpeg2dec \
# commercial_qmmp"
The above allows all of the current COMMERCIAL_LICENSE packages in -
to disallow a particular package from appearing in the image, simply
remove it from the whitelist. To allow them all in, you could also
specify LICENSE_FLAGS_WHITELIST = "commercial".
(From OE-Core rev: a2760661b8c7a4a1b6f2e556853b3a9ae38cbcb5)
Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-12-31 19:06:39 +00:00
|
|
|
def check_license_flags(d):
|
|
|
|
"""
|
2013-11-13 14:32:45 +00:00
|
|
|
This function checks if a recipe has any LICENSE_FLAGS that
|
license.bbclass: add support for LICENSE_FLAGS
LICENSE_FLAGS are a per-recipe replacement for the COMMERCIAL_LICENSE
mechanism.
In the COMMERCIAL_LICENSE mechanism, any package name mentioned in the
global COMMERCIAL_LICENSE list is 'blacklisted' from being included in
an image. To allow the blacklisted package into the image, the
corresponding packages need to be removed from the COMMERCIAL_LICENSE
list. This mechanism relies on a global list defined in
default-distrovars.inc.
The LICENSE_FLAGS mechanism essentially implements the same thing but
turns the global blacklist into a per-recipe whitelist. Any recipe
can optionally define one or more 'license flags'; if defined, each of
the license flags defined for a recipe must have matching entries in a
global LICENSE_FLAGS_WHITELIST variable.
The definition of 'matching' is simple, but there are a couple things
users need to know in order to correctly and effectively use it.
Before we test a flag against the whitelist, we append _${PN} to it,
thus automatically making each LICENSE_FLAG recipe-specific. We then
try to match that string against the whitelist. So if the user
specifies LICENSE_FLAGS = 'commercial' for recipe 'foo', the string
'commercial_foo' should be specified in the whitelist in order for it
to match.
However, the user can also broaden the match by putting any
'_'-separated beginning subset of a LICENSE_FLAG in the whitelist,
which will also match e.g. simply specifying 'commercial' in the
whitelist would match any expanded LICENSE_FLAG starting with
'commercial' such as 'commercial_foo' and 'commercial_bar' which are
the strings that would have been automatically generated if those
recipes had simply specified LICENSE_FLAGS = 'commercial'
This allows for a range of specificity for the items in the whitelist,
from more general to perfectly specific. So users have the choice of
exhaustively enumerating each license flag in the whitelist to allow
only those specific recipes into the image, or of using a more general
string to pick up anything matching just the first component(s).
Note that this scheme works even if the flag already has _pn appended
- the extra _pn is redundant, but doesn't affect the outcome e.g. a
license flag of 'commercial_1.2_foo' would turn into
'commercial_1.2_foo_foo' and would match both the general 'commercial'
and the specific 'commercial_1.2_foo' as expected (it would also match
commercial_1.2_foo_foo' and 'commercial_1.2', which don't make much
sense as far as something a user would think of specifying in the
whitelist). For a versioned string, the user could instead specify
'commercial_foo_1.2', which would turn into 'commercial_foo_1.2_foo',
but which would as expected allow the user to pick up this package
along with anything else 'commercial' by specifying 'commercial' in
the whitelist, or anything with a 'commercial_foo' license regardless
of version by using 'commercial_foo' in the whitelist, or
'commercial_foo_1.1' to be completely specific about package and
version.
The current behavior of COMMERCIAL_LICENSE is replicated as mentioned
above by having the current set of COMMERCIAL_LICENSE flags
implemented using LICENSE_FLAGS = "commercial".
That being the case, the current COMMERCIAL_LICENSE can equivalently
be specified in the new scheme by putting the below in local.conf:
# This is a list of packages that require a commercial license to ship
# product. If shipped as part of an image these packages may have
# implications so they are disabled by default. To enable them,
# un-comment the below as appropriate.
#LICENSE_FLAGS_WHITELIST = "commercial_gst-fluendo-mp3 \
# commercial_gst-openmax \
# commercial_gst-plugins-ugly \
# commercial_lame \
# commercial_libmad \
# commercial_libomxil \
# commercial_mpeg2dec \
# commercial_qmmp"
The above allows all of the current COMMERCIAL_LICENSE packages in -
to disallow a particular package from appearing in the image, simply
remove it from the whitelist. To allow them all in, you could also
specify LICENSE_FLAGS_WHITELIST = "commercial".
(From OE-Core rev: a2760661b8c7a4a1b6f2e556853b3a9ae38cbcb5)
Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-12-31 19:06:39 +00:00
|
|
|
aren't whitelisted.
|
|
|
|
|
2013-11-13 14:32:45 +00:00
|
|
|
If it does, it returns the first LICENSE_FLAGS item missing from the
|
|
|
|
whitelist, or all of the LICENSE_FLAGS if there is no whitelist.
|
license.bbclass: add support for LICENSE_FLAGS
LICENSE_FLAGS are a per-recipe replacement for the COMMERCIAL_LICENSE
mechanism.
In the COMMERCIAL_LICENSE mechanism, any package name mentioned in the
global COMMERCIAL_LICENSE list is 'blacklisted' from being included in
an image. To allow the blacklisted package into the image, the
corresponding packages need to be removed from the COMMERCIAL_LICENSE
list. This mechanism relies on a global list defined in
default-distrovars.inc.
The LICENSE_FLAGS mechanism essentially implements the same thing but
turns the global blacklist into a per-recipe whitelist. Any recipe
can optionally define one or more 'license flags'; if defined, each of
the license flags defined for a recipe must have matching entries in a
global LICENSE_FLAGS_WHITELIST variable.
The definition of 'matching' is simple, but there are a couple things
users need to know in order to correctly and effectively use it.
Before we test a flag against the whitelist, we append _${PN} to it,
thus automatically making each LICENSE_FLAG recipe-specific. We then
try to match that string against the whitelist. So if the user
specifies LICENSE_FLAGS = 'commercial' for recipe 'foo', the string
'commercial_foo' should be specified in the whitelist in order for it
to match.
However, the user can also broaden the match by putting any
'_'-separated beginning subset of a LICENSE_FLAG in the whitelist,
which will also match e.g. simply specifying 'commercial' in the
whitelist would match any expanded LICENSE_FLAG starting with
'commercial' such as 'commercial_foo' and 'commercial_bar' which are
the strings that would have been automatically generated if those
recipes had simply specified LICENSE_FLAGS = 'commercial'
This allows for a range of specificity for the items in the whitelist,
from more general to perfectly specific. So users have the choice of
exhaustively enumerating each license flag in the whitelist to allow
only those specific recipes into the image, or of using a more general
string to pick up anything matching just the first component(s).
Note that this scheme works even if the flag already has _pn appended
- the extra _pn is redundant, but doesn't affect the outcome e.g. a
license flag of 'commercial_1.2_foo' would turn into
'commercial_1.2_foo_foo' and would match both the general 'commercial'
and the specific 'commercial_1.2_foo' as expected (it would also match
commercial_1.2_foo_foo' and 'commercial_1.2', which don't make much
sense as far as something a user would think of specifying in the
whitelist). For a versioned string, the user could instead specify
'commercial_foo_1.2', which would turn into 'commercial_foo_1.2_foo',
but which would as expected allow the user to pick up this package
along with anything else 'commercial' by specifying 'commercial' in
the whitelist, or anything with a 'commercial_foo' license regardless
of version by using 'commercial_foo' in the whitelist, or
'commercial_foo_1.1' to be completely specific about package and
version.
The current behavior of COMMERCIAL_LICENSE is replicated as mentioned
above by having the current set of COMMERCIAL_LICENSE flags
implemented using LICENSE_FLAGS = "commercial".
That being the case, the current COMMERCIAL_LICENSE can equivalently
be specified in the new scheme by putting the below in local.conf:
# This is a list of packages that require a commercial license to ship
# product. If shipped as part of an image these packages may have
# implications so they are disabled by default. To enable them,
# un-comment the below as appropriate.
#LICENSE_FLAGS_WHITELIST = "commercial_gst-fluendo-mp3 \
# commercial_gst-openmax \
# commercial_gst-plugins-ugly \
# commercial_lame \
# commercial_libmad \
# commercial_libomxil \
# commercial_mpeg2dec \
# commercial_qmmp"
The above allows all of the current COMMERCIAL_LICENSE packages in -
to disallow a particular package from appearing in the image, simply
remove it from the whitelist. To allow them all in, you could also
specify LICENSE_FLAGS_WHITELIST = "commercial".
(From OE-Core rev: a2760661b8c7a4a1b6f2e556853b3a9ae38cbcb5)
Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-12-31 19:06:39 +00:00
|
|
|
|
|
|
|
If everything is is properly whitelisted, it returns None.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def license_flag_matches(flag, whitelist, pn):
|
|
|
|
"""
|
|
|
|
Return True if flag matches something in whitelist, None if not.
|
|
|
|
|
|
|
|
Before we test a flag against the whitelist, we append _${PN}
|
|
|
|
to it. We then try to match that string against the
|
|
|
|
whitelist. This covers the normal case, where we expect
|
|
|
|
LICENSE_FLAGS to be a simple string like 'commercial', which
|
|
|
|
the user typically matches exactly in the whitelist by
|
|
|
|
explicitly appending the package name e.g 'commercial_foo'.
|
|
|
|
If we fail the match however, we then split the flag across
|
|
|
|
'_' and append each fragment and test until we either match or
|
|
|
|
run out of fragments.
|
|
|
|
"""
|
|
|
|
flag_pn = ("%s_%s" % (flag, pn))
|
|
|
|
for candidate in whitelist:
|
|
|
|
if flag_pn == candidate:
|
|
|
|
return True
|
|
|
|
|
|
|
|
flag_cur = ""
|
|
|
|
flagments = flag_pn.split("_")
|
|
|
|
flagments.pop() # we've already tested the full string
|
|
|
|
for flagment in flagments:
|
|
|
|
if flag_cur:
|
|
|
|
flag_cur += "_"
|
|
|
|
flag_cur += flagment
|
|
|
|
for candidate in whitelist:
|
|
|
|
if flag_cur == candidate:
|
|
|
|
return True
|
|
|
|
return False
|
|
|
|
|
|
|
|
def all_license_flags_match(license_flags, whitelist):
|
|
|
|
""" Return first unmatched flag, None if all flags match """
|
2016-12-14 21:13:04 +00:00
|
|
|
pn = d.getVar('PN')
|
license.bbclass: add support for LICENSE_FLAGS
LICENSE_FLAGS are a per-recipe replacement for the COMMERCIAL_LICENSE
mechanism.
In the COMMERCIAL_LICENSE mechanism, any package name mentioned in the
global COMMERCIAL_LICENSE list is 'blacklisted' from being included in
an image. To allow the blacklisted package into the image, the
corresponding packages need to be removed from the COMMERCIAL_LICENSE
list. This mechanism relies on a global list defined in
default-distrovars.inc.
The LICENSE_FLAGS mechanism essentially implements the same thing but
turns the global blacklist into a per-recipe whitelist. Any recipe
can optionally define one or more 'license flags'; if defined, each of
the license flags defined for a recipe must have matching entries in a
global LICENSE_FLAGS_WHITELIST variable.
The definition of 'matching' is simple, but there are a couple things
users need to know in order to correctly and effectively use it.
Before we test a flag against the whitelist, we append _${PN} to it,
thus automatically making each LICENSE_FLAG recipe-specific. We then
try to match that string against the whitelist. So if the user
specifies LICENSE_FLAGS = 'commercial' for recipe 'foo', the string
'commercial_foo' should be specified in the whitelist in order for it
to match.
However, the user can also broaden the match by putting any
'_'-separated beginning subset of a LICENSE_FLAG in the whitelist,
which will also match e.g. simply specifying 'commercial' in the
whitelist would match any expanded LICENSE_FLAG starting with
'commercial' such as 'commercial_foo' and 'commercial_bar' which are
the strings that would have been automatically generated if those
recipes had simply specified LICENSE_FLAGS = 'commercial'
This allows for a range of specificity for the items in the whitelist,
from more general to perfectly specific. So users have the choice of
exhaustively enumerating each license flag in the whitelist to allow
only those specific recipes into the image, or of using a more general
string to pick up anything matching just the first component(s).
Note that this scheme works even if the flag already has _pn appended
- the extra _pn is redundant, but doesn't affect the outcome e.g. a
license flag of 'commercial_1.2_foo' would turn into
'commercial_1.2_foo_foo' and would match both the general 'commercial'
and the specific 'commercial_1.2_foo' as expected (it would also match
commercial_1.2_foo_foo' and 'commercial_1.2', which don't make much
sense as far as something a user would think of specifying in the
whitelist). For a versioned string, the user could instead specify
'commercial_foo_1.2', which would turn into 'commercial_foo_1.2_foo',
but which would as expected allow the user to pick up this package
along with anything else 'commercial' by specifying 'commercial' in
the whitelist, or anything with a 'commercial_foo' license regardless
of version by using 'commercial_foo' in the whitelist, or
'commercial_foo_1.1' to be completely specific about package and
version.
The current behavior of COMMERCIAL_LICENSE is replicated as mentioned
above by having the current set of COMMERCIAL_LICENSE flags
implemented using LICENSE_FLAGS = "commercial".
That being the case, the current COMMERCIAL_LICENSE can equivalently
be specified in the new scheme by putting the below in local.conf:
# This is a list of packages that require a commercial license to ship
# product. If shipped as part of an image these packages may have
# implications so they are disabled by default. To enable them,
# un-comment the below as appropriate.
#LICENSE_FLAGS_WHITELIST = "commercial_gst-fluendo-mp3 \
# commercial_gst-openmax \
# commercial_gst-plugins-ugly \
# commercial_lame \
# commercial_libmad \
# commercial_libomxil \
# commercial_mpeg2dec \
# commercial_qmmp"
The above allows all of the current COMMERCIAL_LICENSE packages in -
to disallow a particular package from appearing in the image, simply
remove it from the whitelist. To allow them all in, you could also
specify LICENSE_FLAGS_WHITELIST = "commercial".
(From OE-Core rev: a2760661b8c7a4a1b6f2e556853b3a9ae38cbcb5)
Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-12-31 19:06:39 +00:00
|
|
|
split_whitelist = whitelist.split()
|
|
|
|
for flag in license_flags.split():
|
|
|
|
if not license_flag_matches(flag, split_whitelist, pn):
|
|
|
|
return flag
|
|
|
|
return None
|
|
|
|
|
2016-12-14 21:13:04 +00:00
|
|
|
license_flags = d.getVar('LICENSE_FLAGS')
|
license.bbclass: add support for LICENSE_FLAGS
LICENSE_FLAGS are a per-recipe replacement for the COMMERCIAL_LICENSE
mechanism.
In the COMMERCIAL_LICENSE mechanism, any package name mentioned in the
global COMMERCIAL_LICENSE list is 'blacklisted' from being included in
an image. To allow the blacklisted package into the image, the
corresponding packages need to be removed from the COMMERCIAL_LICENSE
list. This mechanism relies on a global list defined in
default-distrovars.inc.
The LICENSE_FLAGS mechanism essentially implements the same thing but
turns the global blacklist into a per-recipe whitelist. Any recipe
can optionally define one or more 'license flags'; if defined, each of
the license flags defined for a recipe must have matching entries in a
global LICENSE_FLAGS_WHITELIST variable.
The definition of 'matching' is simple, but there are a couple things
users need to know in order to correctly and effectively use it.
Before we test a flag against the whitelist, we append _${PN} to it,
thus automatically making each LICENSE_FLAG recipe-specific. We then
try to match that string against the whitelist. So if the user
specifies LICENSE_FLAGS = 'commercial' for recipe 'foo', the string
'commercial_foo' should be specified in the whitelist in order for it
to match.
However, the user can also broaden the match by putting any
'_'-separated beginning subset of a LICENSE_FLAG in the whitelist,
which will also match e.g. simply specifying 'commercial' in the
whitelist would match any expanded LICENSE_FLAG starting with
'commercial' such as 'commercial_foo' and 'commercial_bar' which are
the strings that would have been automatically generated if those
recipes had simply specified LICENSE_FLAGS = 'commercial'
This allows for a range of specificity for the items in the whitelist,
from more general to perfectly specific. So users have the choice of
exhaustively enumerating each license flag in the whitelist to allow
only those specific recipes into the image, or of using a more general
string to pick up anything matching just the first component(s).
Note that this scheme works even if the flag already has _pn appended
- the extra _pn is redundant, but doesn't affect the outcome e.g. a
license flag of 'commercial_1.2_foo' would turn into
'commercial_1.2_foo_foo' and would match both the general 'commercial'
and the specific 'commercial_1.2_foo' as expected (it would also match
commercial_1.2_foo_foo' and 'commercial_1.2', which don't make much
sense as far as something a user would think of specifying in the
whitelist). For a versioned string, the user could instead specify
'commercial_foo_1.2', which would turn into 'commercial_foo_1.2_foo',
but which would as expected allow the user to pick up this package
along with anything else 'commercial' by specifying 'commercial' in
the whitelist, or anything with a 'commercial_foo' license regardless
of version by using 'commercial_foo' in the whitelist, or
'commercial_foo_1.1' to be completely specific about package and
version.
The current behavior of COMMERCIAL_LICENSE is replicated as mentioned
above by having the current set of COMMERCIAL_LICENSE flags
implemented using LICENSE_FLAGS = "commercial".
That being the case, the current COMMERCIAL_LICENSE can equivalently
be specified in the new scheme by putting the below in local.conf:
# This is a list of packages that require a commercial license to ship
# product. If shipped as part of an image these packages may have
# implications so they are disabled by default. To enable them,
# un-comment the below as appropriate.
#LICENSE_FLAGS_WHITELIST = "commercial_gst-fluendo-mp3 \
# commercial_gst-openmax \
# commercial_gst-plugins-ugly \
# commercial_lame \
# commercial_libmad \
# commercial_libomxil \
# commercial_mpeg2dec \
# commercial_qmmp"
The above allows all of the current COMMERCIAL_LICENSE packages in -
to disallow a particular package from appearing in the image, simply
remove it from the whitelist. To allow them all in, you could also
specify LICENSE_FLAGS_WHITELIST = "commercial".
(From OE-Core rev: a2760661b8c7a4a1b6f2e556853b3a9ae38cbcb5)
Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-12-31 19:06:39 +00:00
|
|
|
if license_flags:
|
2016-12-14 21:13:04 +00:00
|
|
|
whitelist = d.getVar('LICENSE_FLAGS_WHITELIST')
|
license.bbclass: add support for LICENSE_FLAGS
LICENSE_FLAGS are a per-recipe replacement for the COMMERCIAL_LICENSE
mechanism.
In the COMMERCIAL_LICENSE mechanism, any package name mentioned in the
global COMMERCIAL_LICENSE list is 'blacklisted' from being included in
an image. To allow the blacklisted package into the image, the
corresponding packages need to be removed from the COMMERCIAL_LICENSE
list. This mechanism relies on a global list defined in
default-distrovars.inc.
The LICENSE_FLAGS mechanism essentially implements the same thing but
turns the global blacklist into a per-recipe whitelist. Any recipe
can optionally define one or more 'license flags'; if defined, each of
the license flags defined for a recipe must have matching entries in a
global LICENSE_FLAGS_WHITELIST variable.
The definition of 'matching' is simple, but there are a couple things
users need to know in order to correctly and effectively use it.
Before we test a flag against the whitelist, we append _${PN} to it,
thus automatically making each LICENSE_FLAG recipe-specific. We then
try to match that string against the whitelist. So if the user
specifies LICENSE_FLAGS = 'commercial' for recipe 'foo', the string
'commercial_foo' should be specified in the whitelist in order for it
to match.
However, the user can also broaden the match by putting any
'_'-separated beginning subset of a LICENSE_FLAG in the whitelist,
which will also match e.g. simply specifying 'commercial' in the
whitelist would match any expanded LICENSE_FLAG starting with
'commercial' such as 'commercial_foo' and 'commercial_bar' which are
the strings that would have been automatically generated if those
recipes had simply specified LICENSE_FLAGS = 'commercial'
This allows for a range of specificity for the items in the whitelist,
from more general to perfectly specific. So users have the choice of
exhaustively enumerating each license flag in the whitelist to allow
only those specific recipes into the image, or of using a more general
string to pick up anything matching just the first component(s).
Note that this scheme works even if the flag already has _pn appended
- the extra _pn is redundant, but doesn't affect the outcome e.g. a
license flag of 'commercial_1.2_foo' would turn into
'commercial_1.2_foo_foo' and would match both the general 'commercial'
and the specific 'commercial_1.2_foo' as expected (it would also match
commercial_1.2_foo_foo' and 'commercial_1.2', which don't make much
sense as far as something a user would think of specifying in the
whitelist). For a versioned string, the user could instead specify
'commercial_foo_1.2', which would turn into 'commercial_foo_1.2_foo',
but which would as expected allow the user to pick up this package
along with anything else 'commercial' by specifying 'commercial' in
the whitelist, or anything with a 'commercial_foo' license regardless
of version by using 'commercial_foo' in the whitelist, or
'commercial_foo_1.1' to be completely specific about package and
version.
The current behavior of COMMERCIAL_LICENSE is replicated as mentioned
above by having the current set of COMMERCIAL_LICENSE flags
implemented using LICENSE_FLAGS = "commercial".
That being the case, the current COMMERCIAL_LICENSE can equivalently
be specified in the new scheme by putting the below in local.conf:
# This is a list of packages that require a commercial license to ship
# product. If shipped as part of an image these packages may have
# implications so they are disabled by default. To enable them,
# un-comment the below as appropriate.
#LICENSE_FLAGS_WHITELIST = "commercial_gst-fluendo-mp3 \
# commercial_gst-openmax \
# commercial_gst-plugins-ugly \
# commercial_lame \
# commercial_libmad \
# commercial_libomxil \
# commercial_mpeg2dec \
# commercial_qmmp"
The above allows all of the current COMMERCIAL_LICENSE packages in -
to disallow a particular package from appearing in the image, simply
remove it from the whitelist. To allow them all in, you could also
specify LICENSE_FLAGS_WHITELIST = "commercial".
(From OE-Core rev: a2760661b8c7a4a1b6f2e556853b3a9ae38cbcb5)
Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-12-31 19:06:39 +00:00
|
|
|
if not whitelist:
|
|
|
|
return license_flags
|
|
|
|
unmatched_flag = all_license_flags_match(license_flags, whitelist)
|
|
|
|
if unmatched_flag:
|
|
|
|
return unmatched_flag
|
|
|
|
return None
|
|
|
|
|
2014-12-22 23:30:46 +00:00
|
|
|
def check_license_format(d):
|
|
|
|
"""
|
|
|
|
This function checks if LICENSE is well defined,
|
|
|
|
Validate operators in LICENSES.
|
|
|
|
No spaces are allowed between LICENSES.
|
|
|
|
"""
|
2016-12-14 21:13:04 +00:00
|
|
|
pn = d.getVar('PN')
|
|
|
|
licenses = d.getVar('LICENSE')
|
2015-02-03 15:28:52 +00:00
|
|
|
from oe.license import license_operator, license_operator_chars, license_pattern
|
2014-12-22 23:30:46 +00:00
|
|
|
|
2016-05-20 10:53:11 +00:00
|
|
|
elements = list(filter(lambda x: x.strip(), license_operator.split(licenses)))
|
2014-12-22 23:30:46 +00:00
|
|
|
for pos, element in enumerate(elements):
|
|
|
|
if license_pattern.match(element):
|
|
|
|
if pos > 0 and license_pattern.match(elements[pos - 1]):
|
2015-02-03 15:28:52 +00:00
|
|
|
bb.warn('%s: LICENSE value "%s" has an invalid format - license names ' \
|
|
|
|
'must be separated by the following characters to indicate ' \
|
|
|
|
'the license selection: %s' %
|
|
|
|
(pn, licenses, license_operator_chars))
|
2014-12-22 23:30:46 +00:00
|
|
|
elif not license_operator.match(element):
|
2015-02-03 15:28:52 +00:00
|
|
|
bb.warn('%s: LICENSE value "%s" has an invalid separator "%s" that is not ' \
|
|
|
|
'in the valid list of separators (%s)' %
|
|
|
|
(pn, licenses, element, license_operator_chars))
|
2014-12-22 23:30:46 +00:00
|
|
|
|
2011-02-03 12:33:18 +00:00
|
|
|
SSTATETASKS += "do_populate_lic"
|
|
|
|
do_populate_lic[sstate-inputdirs] = "${LICSSTATEDIR}"
|
|
|
|
do_populate_lic[sstate-outputdirs] = "${LICENSE_DIRECTORY}/"
|
|
|
|
|
2016-04-19 11:17:04 +00:00
|
|
|
ROOTFS_POSTPROCESS_COMMAND_prepend = "write_package_manifest; license_create_manifest; "
|
2015-11-10 15:30:55 +00:00
|
|
|
do_rootfs[recrdeptask] += "do_populate_lic"
|
2011-12-03 23:16:15 +00:00
|
|
|
|
2016-04-19 11:17:04 +00:00
|
|
|
IMAGE_POSTPROCESS_COMMAND_prepend = "write_deploy_manifest; "
|
|
|
|
do_image[recrdeptask] += "do_populate_lic"
|
|
|
|
|
2011-02-03 12:33:18 +00:00
|
|
|
python do_populate_lic_setscene () {
|
2012-07-11 17:33:43 +00:00
|
|
|
sstate_setscene(d)
|
2011-02-03 12:33:18 +00:00
|
|
|
}
|
|
|
|
addtask do_populate_lic_setscene
|