summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes')
-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() {
29 import re 29 import re
30 import oe.packagedata 30 import oe.packagedata
31 31
32 bad_licenses = (d.getVar("INCOMPATIBLE_LICENSE", True) or "").split()
33 bad_licenses = map(lambda l: canonical_license(d, l), bad_licenses)
34 bad_licenses = expand_wildcard_licenses(d, bad_licenses)
35
32 build_images_from_feeds = d.getVar('BUILD_IMAGES_FROM_FEEDS', True) 36 build_images_from_feeds = d.getVar('BUILD_IMAGES_FROM_FEEDS', True)
33 if build_images_from_feeds == "1": 37 if build_images_from_feeds == "1":
34 return 0 38 return 0
@@ -52,6 +56,18 @@ python license_create_manifest() {
52 d.getVar('IMAGE_NAME', True), 'license.manifest') 56 d.getVar('IMAGE_NAME', True), 'license.manifest')
53 with open(license_manifest, "w") as license_file: 57 with open(license_manifest, "w") as license_file:
54 for pkg in sorted(pkg_dic): 58 for pkg in sorted(pkg_dic):
59 if bad_licenses:
60 try:
61 (pkg_dic[pkg]["LICENSE"], pkg_dic[pkg]["LICENSES"]) = \
62 oe.license.manifest_licenses(pkg_dic[pkg]["LICENSE"],
63 bad_licenses, canonical_license, d)
64 except oe.license.LicenseError as exc:
65 bb.fatal('%s: %s' % (d.getVar('P', True), exc))
66 else:
67 pkg_dic[pkg]["LICENSES"] = re.sub('[|&()*]', '', pkg_dic[pkg]["LICENSE"])
68 pkg_dic[pkg]["LICENSES"] = re.sub(' *', ' ', pkg_dic[pkg]["LICENSES"])
69 pkg_dic[pkg]["LICENSES"] = pkg_dic[pkg]["LICENSES"].split()
70
55 license_file.write("PACKAGE NAME: %s\n" % pkg) 71 license_file.write("PACKAGE NAME: %s\n" % pkg)
56 license_file.write("PACKAGE VERSION: %s\n" % pkg_dic[pkg]["PV"]) 72 license_file.write("PACKAGE VERSION: %s\n" % pkg_dic[pkg]["PV"])
57 license_file.write("RECIPE NAME: %s\n" % pkg_dic[pkg]["PN"]) 73 license_file.write("RECIPE NAME: %s\n" % pkg_dic[pkg]["PN"])
@@ -63,9 +79,7 @@ python license_create_manifest() {
63 if pkg_dic[pkg]["PKGSIZE_%s" % pkg] == "0": 79 if pkg_dic[pkg]["PKGSIZE_%s" % pkg] == "0":
64 continue 80 continue
65 81
66 licenses = re.sub('[|&()*]', '', pkg_dic[pkg]["LICENSE"]) 82 for lic in pkg_dic[pkg]["LICENSES"]:
67 licenses = re.sub(' *', ' ', licenses)
68 for lic in licenses.split():
69 lic_file = os.path.join(d.getVar('LICENSE_DIRECTORY', True), 83 lic_file = os.path.join(d.getVar('LICENSE_DIRECTORY', True),
70 pkg_dic[pkg]["PN"], "generic_%s" % 84 pkg_dic[pkg]["PN"], "generic_%s" %
71 re.sub('\+', '', lic)) 85 re.sub('\+', '', lic))
@@ -101,11 +115,20 @@ python license_create_manifest() {
101 pkg_rootfs_license = os.path.join(pkg_rootfs_license_dir, lic) 115 pkg_rootfs_license = os.path.join(pkg_rootfs_license_dir, lic)
102 116
103 if re.match("^generic_.*$", lic): 117 if re.match("^generic_.*$", lic):
118 generic_lic = re.search("^generic_(.*)$", lic).group(1)
119 if oe.license.license_ok(canonical_license(d,
120 generic_lic), bad_licenses) == False:
121 continue
122
104 if not os.path.exists(rootfs_license): 123 if not os.path.exists(rootfs_license):
105 os.link(pkg_license, rootfs_license) 124 os.link(pkg_license, rootfs_license)
106 125
107 os.symlink(os.path.join('..', lic), pkg_rootfs_license) 126 os.symlink(os.path.join('..', lic), pkg_rootfs_license)
108 else: 127 else:
128 if oe.license.license_ok(canonical_license(d,
129 lic), bad_licenses) == False:
130 continue
131
109 os.link(pkg_license, pkg_rootfs_license) 132 os.link(pkg_license, pkg_rootfs_license)
110} 133}
111 134