diff options
author | Reto Schneider <reto.schneider@husqvarnagroup.com> | 2021-04-26 23:27:56 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-04-27 15:11:47 +0100 |
commit | 62eb8462327b06b0c8728f49f26f518a39fd373f (patch) | |
tree | 4573692134ee64dc1630c060ef747d2b813ea9c9 /meta/classes/license_image.bbclass | |
parent | f8b2e0f60089c563292a08cc140c8bfe0ff0b7cb (diff) | |
download | poky-62eb8462327b06b0c8728f49f26f518a39fd373f.tar.gz |
license_image.bbclass: Detect broken symlinks
Find and report symlinks which point to a non-existing file.
(From OE-Core rev: 81809a1ffe67aade1b2ed66fe95044ffbf7d3df8)
Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/license_image.bbclass')
-rw-r--r-- | meta/classes/license_image.bbclass | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/meta/classes/license_image.bbclass b/meta/classes/license_image.bbclass index c96b032ebd..b9a0f2359b 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}') |
@@ -104,8 +106,7 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True): | |||
104 | copy_lic_manifest = d.getVar('COPY_LIC_MANIFEST') | 106 | copy_lic_manifest = d.getVar('COPY_LIC_MANIFEST') |
105 | copy_lic_dirs = d.getVar('COPY_LIC_DIRS') | 107 | copy_lic_dirs = d.getVar('COPY_LIC_DIRS') |
106 | if rootfs and copy_lic_manifest == "1": | 108 | if rootfs and copy_lic_manifest == "1": |
107 | rootfs_license_dir = os.path.join(d.getVar('IMAGE_ROOTFS'), | 109 | rootfs_license_dir = d.getVar('ROOTFS_LICENSE_DIR') |
108 | 'usr', 'share', 'common-licenses') | ||
109 | bb.utils.mkdirhier(rootfs_license_dir) | 110 | bb.utils.mkdirhier(rootfs_license_dir) |
110 | rootfs_license_manifest = os.path.join(rootfs_license_dir, | 111 | rootfs_license_manifest = os.path.join(rootfs_license_dir, |
111 | os.path.split(license_manifest)[1]) | 112 | os.path.split(license_manifest)[1]) |
@@ -267,3 +268,13 @@ python do_populate_lic_deploy() { | |||
267 | addtask populate_lic_deploy before do_build after do_image_complete | 268 | addtask populate_lic_deploy before do_build after do_image_complete |
268 | do_populate_lic_deploy[recrdeptask] += "do_populate_lic do_deploy" | 269 | do_populate_lic_deploy[recrdeptask] += "do_populate_lic do_deploy" |
269 | 270 | ||
271 | python license_qa_dead_symlink() { | ||
272 | import os | ||
273 | |||
274 | for root, dirs, files in os.walk(d.getVar('ROOTFS_LICENSE_DIR')): | ||
275 | for file in files: | ||
276 | full_path = root + "/" + file | ||
277 | if os.path.islink(full_path) and not os.path.exists(full_path): | ||
278 | bb.error("broken symlink: " + full_path) | ||
279 | } | ||
280 | IMAGE_QA_COMMANDS += "license_qa_dead_symlink" | ||