diff options
| author | Reto Schneider <reto.schneider@husqvarnagroup.com> | 2021-04-26 23:27:56 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-05-11 12:02:28 +0100 |
| commit | ba3ea82f68993f00dfc9baa38b750fc7d3beee7c (patch) | |
| tree | 3ec05898599a1074cd7309724d763586b935a686 | |
| parent | 58cbdaecf75b0248f96780b6882e8d4f232d038a (diff) | |
| download | poky-ba3ea82f68993f00dfc9baa38b750fc7d3beee7c.tar.gz | |
license_image.bbclass: Detect broken symlinks
Find and report symlinks which point to a non-existing file.
(From OE-Core rev: afeefde357e468ba79570208bd67d097b9cb9ee1)
Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 81809a1ffe67aade1b2ed66fe95044ffbf7d3df8)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -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" | ||
