aboutsummaryrefslogtreecommitdiffstats
path: root/meta/classes/license.bbclass
diff options
context:
space:
mode:
authorAníbal Limón <anibal.limon@linux.intel.com>2015-05-08 20:41:31 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-05-09 22:28:14 +0100
commitb394cd4c7e1997f3df4a0c796446b48dd7fe2c07 (patch)
treed2a264a4c4ce5757e4f981153a7667caaa0089d1 /meta/classes/license.bbclass
parentbb3469f9d32ff18cf308a308869c0ae3500b5a15 (diff)
downloadopenembedded-core-contrib-b394cd4c7e1997f3df4a0c796446b48dd7fe2c07.tar.gz
license: Add support for handle INCOMPATIBLE_LICENSE in manifest creation
When INCOMPATIBLE_LICENSE's is specified it need to be removed from license.manifest and also avoid copy to target image. Add ManifestVisitor that walk the license string searching for INCOMPATIBLE_LICENSE's if found remove it. [YOCTO #6765] (From OE-Core rev: d1278570041029d7c9fc6ce657e9a1701a421841) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/license.bbclass')
-rw-r--r--meta/classes/license.bbclass29
1 files changed, 26 insertions, 3 deletions
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index 780b9d5863..54ab123840 100644
--- a/meta/classes/license.bbclass
+++ b/meta/classes/license.bbclass
@@ -29,6 +29,10 @@ python license_create_manifest() {
import re
import oe.packagedata
+ bad_licenses = (d.getVar("INCOMPATIBLE_LICENSE", True) or "").split()
+ bad_licenses = map(lambda l: canonical_license(d, l), bad_licenses)
+ bad_licenses = expand_wildcard_licenses(d, bad_licenses)
+
build_images_from_feeds = d.getVar('BUILD_IMAGES_FROM_FEEDS', True)
if build_images_from_feeds == "1":
return 0
@@ -52,6 +56,18 @@ python license_create_manifest() {
d.getVar('IMAGE_NAME', True), 'license.manifest')
with open(license_manifest, "w") as license_file:
for pkg in sorted(pkg_dic):
+ 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:
+ bb.fatal('%s: %s' % (d.getVar('P', True), exc))
+ else:
+ pkg_dic[pkg]["LICENSES"] = re.sub('[|&()*]', '', pkg_dic[pkg]["LICENSE"])
+ pkg_dic[pkg]["LICENSES"] = re.sub(' *', ' ', pkg_dic[pkg]["LICENSES"])
+ pkg_dic[pkg]["LICENSES"] = pkg_dic[pkg]["LICENSES"].split()
+
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"])
@@ -63,9 +79,7 @@ python license_create_manifest() {
if pkg_dic[pkg]["PKGSIZE_%s" % pkg] == "0":
continue
- licenses = re.sub('[|&()*]', '', pkg_dic[pkg]["LICENSE"])
- licenses = re.sub(' *', ' ', licenses)
- for lic in licenses.split():
+ for lic in pkg_dic[pkg]["LICENSES"]:
lic_file = os.path.join(d.getVar('LICENSE_DIRECTORY', True),
pkg_dic[pkg]["PN"], "generic_%s" %
re.sub('\+', '', lic))
@@ -101,11 +115,20 @@ python license_create_manifest() {
pkg_rootfs_license = os.path.join(pkg_rootfs_license_dir, lic)
if re.match("^generic_.*$", lic):
+ generic_lic = re.search("^generic_(.*)$", lic).group(1)
+ if oe.license.license_ok(canonical_license(d,
+ generic_lic), bad_licenses) == False:
+ continue
+
if not os.path.exists(rootfs_license):
os.link(pkg_license, rootfs_license)
os.symlink(os.path.join('..', lic), pkg_rootfs_license)
else:
+ if oe.license.license_ok(canonical_license(d,
+ lic), bad_licenses) == False:
+ continue
+
os.link(pkg_license, pkg_rootfs_license)
}