summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorMariano Lopez <mariano.lopez@linux.intel.com>2015-10-01 11:25:08 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-12-01 21:32:00 +0000
commit8b1e7bcef2126b0b7f8070c277d04e3b22c5b961 (patch)
treedbbc4e4e2971da20ad75c5b5947448b3e4f8e2ea /meta/classes
parent1a210e6374b2e8140373fcb715b19d1d8c6b4b3e (diff)
downloadpoky-8b1e7bcef2126b0b7f8070c277d04e3b22c5b961.tar.gz
license.bbclass: Split license create manifest
This changes moves the writing of the licenses to a separated function that could be called for other packages. With these change it will be easier to reuse the writing of the license for the packages deployed but not installed in the rootfs. [YOCTO #6772] (From OE-Core rev: 71fb5da7a3a8e61b15be4efc05b968c0c9920d2f) Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/license.bbclass36
1 files changed, 22 insertions, 14 deletions
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index 17ae82d2c5..0d91dc6a95 100644
--- a/meta/classes/license.bbclass
+++ b/meta/classes/license.bbclass
@@ -26,14 +26,9 @@ python write_package_manifest() {
26} 26}
27 27
28python license_create_manifest() { 28python license_create_manifest() {
29 import re
30 import oe.packagedata 29 import oe.packagedata
31 from oe.rootfs import image_list_installed_packages 30 from oe.rootfs import image_list_installed_packages
32 31
33 bad_licenses = (d.getVar("INCOMPATIBLE_LICENSE", True) or "").split()
34 bad_licenses = map(lambda l: canonical_license(d, l), bad_licenses)
35 bad_licenses = expand_wildcard_licenses(d, bad_licenses)
36
37 build_images_from_feeds = d.getVar('BUILD_IMAGES_FROM_FEEDS', True) 32 build_images_from_feeds = d.getVar('BUILD_IMAGES_FROM_FEEDS', True)
38 if build_images_from_feeds == "1": 33 if build_images_from_feeds == "1":
39 return 0 34 return 0
@@ -49,8 +44,18 @@ python license_create_manifest() {
49 pkg_lic_name = "LICENSE_" + pkg_name 44 pkg_lic_name = "LICENSE_" + pkg_name
50 pkg_dic[pkg_name]["LICENSE"] = pkg_dic[pkg_name][pkg_lic_name] 45 pkg_dic[pkg_name]["LICENSE"] = pkg_dic[pkg_name][pkg_lic_name]
51 46
52 license_manifest = os.path.join(d.getVar('LICENSE_DIRECTORY', True), 47 rootfs_license_manifest = os.path.join(d.getVar('LICENSE_DIRECTORY', True),
53 d.getVar('IMAGE_NAME', True), 'license.manifest') 48 d.getVar('IMAGE_NAME', True), 'license.manifest')
49 write_license_files(d, rootfs_license_manifest, pkg_dic)
50}
51
52def write_license_files(d, license_manifest, pkg_dic):
53 import re
54
55 bad_licenses = (d.getVar("INCOMPATIBLE_LICENSE", True) or "").split()
56 bad_licenses = map(lambda l: canonical_license(d, l), bad_licenses)
57 bad_licenses = expand_wildcard_licenses(d, bad_licenses)
58
54 with open(license_manifest, "w") as license_file: 59 with open(license_manifest, "w") as license_file:
55 for pkg in sorted(pkg_dic): 60 for pkg in sorted(pkg_dic):
56 if bad_licenses: 61 if bad_licenses:
@@ -98,15 +103,16 @@ python license_create_manifest() {
98 if copy_lic_manifest == "1": 103 if copy_lic_manifest == "1":
99 rootfs_license_dir = os.path.join(d.getVar('IMAGE_ROOTFS', 'True'), 104 rootfs_license_dir = os.path.join(d.getVar('IMAGE_ROOTFS', 'True'),
100 'usr', 'share', 'common-licenses') 105 'usr', 'share', 'common-licenses')
101 os.makedirs(rootfs_license_dir) 106 bb.utils.mkdirhier(rootfs_license_dir)
102 rootfs_license_manifest = os.path.join(rootfs_license_dir, 107 rootfs_license_manifest = os.path.join(rootfs_license_dir,
103 'license.manifest') 108 os.path.split(license_manifest)[1])
104 os.link(license_manifest, rootfs_license_manifest) 109 if not os.path.exists(rootfs_license_manifest):
110 os.link(license_manifest, rootfs_license_manifest)
105 111
106 if copy_lic_dirs == "1": 112 if copy_lic_dirs == "1":
107 for pkg in sorted(pkg_dic): 113 for pkg in sorted(pkg_dic):
108 pkg_rootfs_license_dir = os.path.join(rootfs_license_dir, pkg) 114 pkg_rootfs_license_dir = os.path.join(rootfs_license_dir, pkg)
109 os.makedirs(pkg_rootfs_license_dir) 115 bb.utils.mkdirhier(pkg_rootfs_license_dir)
110 pkg_license_dir = os.path.join(d.getVar('LICENSE_DIRECTORY', True), 116 pkg_license_dir = os.path.join(d.getVar('LICENSE_DIRECTORY', True),
111 pkg_dic[pkg]["PN"]) 117 pkg_dic[pkg]["PN"])
112 licenses = os.listdir(pkg_license_dir) 118 licenses = os.listdir(pkg_license_dir)
@@ -124,14 +130,16 @@ python license_create_manifest() {
124 if not os.path.exists(rootfs_license): 130 if not os.path.exists(rootfs_license):
125 os.link(pkg_license, rootfs_license) 131 os.link(pkg_license, rootfs_license)
126 132
127 os.symlink(os.path.join('..', lic), pkg_rootfs_license) 133 if not os.path.exists(pkg_rootfs_license):
134 os.symlink(os.path.join('..', lic), pkg_rootfs_license)
128 else: 135 else:
129 if oe.license.license_ok(canonical_license(d, 136 if (oe.license.license_ok(canonical_license(d,
130 lic), bad_licenses) == False: 137 lic), bad_licenses) == False or
138 os.path.exists(pkg_rootfs_license)):
131 continue 139 continue
132 140
133 os.link(pkg_license, pkg_rootfs_license) 141 os.link(pkg_license, pkg_rootfs_license)
134} 142
135 143
136python do_populate_lic() { 144python do_populate_lic() {
137 """ 145 """