summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReto Schneider <reto.schneider@husqvarnagroup.com>2021-04-26 23:27:56 +0200
committerAnuj Mittal <anuj.mittal@intel.com>2021-05-06 10:09:37 +0800
commitafeefde357e468ba79570208bd67d097b9cb9ee1 (patch)
tree16cef0fb9605818fc95f7bbac6e68bcb89acba3a
parent940111cefa459bc7a5fd9de1cf70b2040ffb5229 (diff)
downloadopenembedded-core-contrib-afeefde357e468ba79570208bd67d097b9cb9ee1.tar.gz
license_image.bbclass: Detect broken symlinks
Find and report symlinks which point to a non-existing file. 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>
-rw-r--r--meta/classes/license_image.bbclass15
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 @@
+ROOTFS_LICENSE_DIR = "${IMAGE_ROOTFS}/usr/share/common-licenses"
+
python write_package_manifest() {
# Get list of installed packages
license_image_dir = d.expand('${LICENSE_DIRECTORY}/${IMAGE_NAME}')
@@ -104,8 +106,7 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True):
copy_lic_manifest = d.getVar('COPY_LIC_MANIFEST')
copy_lic_dirs = d.getVar('COPY_LIC_DIRS')
if rootfs and copy_lic_manifest == "1":
- rootfs_license_dir = os.path.join(d.getVar('IMAGE_ROOTFS'),
- 'usr', 'share', 'common-licenses')
+ rootfs_license_dir = d.getVar('ROOTFS_LICENSE_DIR')
bb.utils.mkdirhier(rootfs_license_dir)
rootfs_license_manifest = os.path.join(rootfs_license_dir,
os.path.split(license_manifest)[1])
@@ -267,3 +268,13 @@ python do_populate_lic_deploy() {
addtask populate_lic_deploy before do_build after do_image_complete
do_populate_lic_deploy[recrdeptask] += "do_populate_lic do_deploy"
+python license_qa_dead_symlink() {
+ import os
+
+ for root, dirs, files in os.walk(d.getVar('ROOTFS_LICENSE_DIR')):
+ for file in files:
+ full_path = root + "/" + file
+ if os.path.islink(full_path) and not os.path.exists(full_path):
+ bb.error("broken symlink: " + full_path)
+}
+IMAGE_QA_COMMANDS += "license_qa_dead_symlink"