diff options
Diffstat (limited to 'meta/classes/license_image.bbclass')
-rw-r--r-- | meta/classes/license_image.bbclass | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/meta/classes/license_image.bbclass b/meta/classes/license_image.bbclass index a69cc5f065..325b3cbba7 100644 --- a/meta/classes/license_image.bbclass +++ b/meta/classes/license_image.bbclass | |||
@@ -1,3 +1,5 @@ | |||
1 | ROOTFS_LICENSE_DIR = "${IMAGE_ROOTFS}/usr/share/common-licenses" | ||
2 | |||
1 | python write_package_manifest() { | 3 | python write_package_manifest() { |
2 | # Get list of installed packages | 4 | # Get list of installed packages |
3 | license_image_dir = d.expand('${LICENSE_DIRECTORY}/${IMAGE_NAME}') | 5 | license_image_dir = d.expand('${LICENSE_DIRECTORY}/${IMAGE_NAME}') |
@@ -7,8 +9,8 @@ python write_package_manifest() { | |||
7 | 9 | ||
8 | pkgs = image_list_installed_packages(d) | 10 | pkgs = image_list_installed_packages(d) |
9 | output = format_pkg_list(pkgs) | 11 | output = format_pkg_list(pkgs) |
10 | open(os.path.join(license_image_dir, 'package.manifest'), | 12 | with open(os.path.join(license_image_dir, 'package.manifest'), "w+") as package_manifest: |
11 | 'w+').write(output) | 13 | package_manifest.write(output) |
12 | } | 14 | } |
13 | 15 | ||
14 | python license_create_manifest() { | 16 | python license_create_manifest() { |
@@ -105,8 +107,7 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True): | |||
105 | copy_lic_manifest = d.getVar('COPY_LIC_MANIFEST') | 107 | copy_lic_manifest = d.getVar('COPY_LIC_MANIFEST') |
106 | copy_lic_dirs = d.getVar('COPY_LIC_DIRS') | 108 | copy_lic_dirs = d.getVar('COPY_LIC_DIRS') |
107 | if rootfs and copy_lic_manifest == "1": | 109 | if rootfs and copy_lic_manifest == "1": |
108 | rootfs_license_dir = os.path.join(d.getVar('IMAGE_ROOTFS'), | 110 | rootfs_license_dir = d.getVar('ROOTFS_LICENSE_DIR') |
109 | 'usr', 'share', 'common-licenses') | ||
110 | bb.utils.mkdirhier(rootfs_license_dir) | 111 | bb.utils.mkdirhier(rootfs_license_dir) |
111 | rootfs_license_manifest = os.path.join(rootfs_license_dir, | 112 | rootfs_license_manifest = os.path.join(rootfs_license_dir, |
112 | os.path.split(license_manifest)[1]) | 113 | os.path.split(license_manifest)[1]) |
@@ -144,12 +145,13 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True): | |||
144 | continue | 145 | continue |
145 | 146 | ||
146 | # Make sure we use only canonical name for the license file | 147 | # Make sure we use only canonical name for the license file |
147 | rootfs_license = os.path.join(rootfs_license_dir, "generic_%s" % generic_lic) | 148 | generic_lic_file = "generic_%s" % generic_lic |
149 | rootfs_license = os.path.join(rootfs_license_dir, generic_lic_file) | ||
148 | if not os.path.exists(rootfs_license): | 150 | if not os.path.exists(rootfs_license): |
149 | oe.path.copyhardlink(pkg_license, rootfs_license) | 151 | oe.path.copyhardlink(pkg_license, rootfs_license) |
150 | 152 | ||
151 | if not os.path.exists(pkg_rootfs_license): | 153 | if not os.path.exists(pkg_rootfs_license): |
152 | os.symlink(os.path.join('..', lic), pkg_rootfs_license) | 154 | os.symlink(os.path.join('..', generic_lic_file), pkg_rootfs_license) |
153 | else: | 155 | else: |
154 | if (oe.license.license_ok(canonical_license(d, | 156 | if (oe.license.license_ok(canonical_license(d, |
155 | lic), bad_licenses) == False or | 157 | lic), bad_licenses) == False or |
@@ -209,7 +211,7 @@ def get_deployed_dependencies(d): | |||
209 | deploy = {} | 211 | deploy = {} |
210 | # Get all the dependencies for the current task (rootfs). | 212 | # Get all the dependencies for the current task (rootfs). |
211 | taskdata = d.getVar("BB_TASKDEPDATA", False) | 213 | taskdata = d.getVar("BB_TASKDEPDATA", False) |
212 | pn = d.getVar("PN", True) | 214 | pn = d.getVar("PN") |
213 | depends = list(set([dep[0] for dep | 215 | depends = list(set([dep[0] for dep |
214 | in list(taskdata.values()) | 216 | in list(taskdata.values()) |
215 | if not dep[0].endswith("-native") and not dep[0] == pn])) | 217 | if not dep[0].endswith("-native") and not dep[0] == pn])) |
@@ -256,3 +258,13 @@ python do_populate_lic_deploy() { | |||
256 | addtask populate_lic_deploy before do_build after do_image_complete | 258 | addtask populate_lic_deploy before do_build after do_image_complete |
257 | do_populate_lic_deploy[recrdeptask] += "do_populate_lic do_deploy" | 259 | do_populate_lic_deploy[recrdeptask] += "do_populate_lic do_deploy" |
258 | 260 | ||
261 | python license_qa_dead_symlink() { | ||
262 | import os | ||
263 | |||
264 | for root, dirs, files in os.walk(d.getVar('ROOTFS_LICENSE_DIR')): | ||
265 | for file in files: | ||
266 | full_path = root + "/" + file | ||
267 | if os.path.islink(full_path) and not os.path.exists(full_path): | ||
268 | bb.error("broken symlink: " + full_path) | ||
269 | } | ||
270 | IMAGE_QA_COMMANDS += "license_qa_dead_symlink" | ||