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-04 22:57:55 +0100 |
| commit | 333fbe63550d20b6a0ebb4835787a68e33bfaad9 (patch) | |
| tree | 0e677c080618f0dd37fc8b553d111c32526b203a | |
| parent | 3f318ade1c742c657b1ce88c577b8e4df8af4435 (diff) | |
| download | poky-333fbe63550d20b6a0ebb4835787a68e33bfaad9.tar.gz | |
license_image.bbclass: Detect broken symlinks
Find and report symlinks which point to a non-existing file.
(From OE-Core rev: 62ad9a56155453ea0a940679dd02bca9093fda65)
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: Steve Sakoman <steve@sakoman.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 a69cc5f065..cfb0606da9 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}') |
| @@ -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]) |
| @@ -256,3 +257,13 @@ python do_populate_lic_deploy() { | |||
| 256 | addtask populate_lic_deploy before do_build after do_image_complete | 257 | addtask populate_lic_deploy before do_build after do_image_complete |
| 257 | do_populate_lic_deploy[recrdeptask] += "do_populate_lic do_deploy" | 258 | do_populate_lic_deploy[recrdeptask] += "do_populate_lic do_deploy" |
| 258 | 259 | ||
| 260 | python license_qa_dead_symlink() { | ||
| 261 | import os | ||
| 262 | |||
| 263 | for root, dirs, files in os.walk(d.getVar('ROOTFS_LICENSE_DIR')): | ||
| 264 | for file in files: | ||
| 265 | full_path = root + "/" + file | ||
| 266 | if os.path.islink(full_path) and not os.path.exists(full_path): | ||
| 267 | bb.error("broken symlink: " + full_path) | ||
| 268 | } | ||
| 269 | IMAGE_QA_COMMANDS += "license_qa_dead_symlink" | ||
