summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorMarta Rybczynska <rybczynska@gmail.com>2022-06-03 10:58:27 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-06-06 13:35:29 +0100
commitdebd37abcdde8788761ebdb4a05bc61f7394cbb8 (patch)
tree0c555292b4a6a948dec03c659ae2dfd79408ffe2 /meta/lib
parent1e08da6a43876677ae4481156ce1d7177b77264d (diff)
downloadopenembedded-core-contrib-debd37abcdde8788761ebdb4a05bc61f7394cbb8.tar.gz
cve-check: move update_symlinks to a library
Move the function to a library, it could be useful in other places. Signed-off-by: Marta Rybczynska <marta.rybczynska@huawei.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oe/cve_check.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/meta/lib/oe/cve_check.py b/meta/lib/oe/cve_check.py
index dc7d2e2826..aa06497727 100644
--- a/meta/lib/oe/cve_check.py
+++ b/meta/lib/oe/cve_check.py
@@ -163,3 +163,13 @@ def cve_check_merge_jsons(output, data):
return
output["package"].append(data["package"][0])
+
+def update_symlinks(target_path, link_path):
+ """
+ Update a symbolic link link_path to point to target_path.
+ Remove the link and recreate it if exist and is different.
+ """
+ if link_path != target_path and os.path.exists(target_path):
+ if os.path.exists(os.path.realpath(link_path)):
+ os.remove(link_path)
+ os.symlink(os.path.basename(target_path), link_path)