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-11 10:06:09 +0100
commit6cf824520a23f7d0f78b37a6cffb033f31c87a36 (patch)
tree3f61e21666ed76a258bf82c12450d596d414cb6a /meta/lib
parent42bb9689a0a173fd0c526330b297957961cd1d5d (diff)
downloadpoky-6cf824520a23f7d0f78b37a6cffb033f31c87a36.tar.gz
cve-check: move update_symlinks to a library
Move the function to a library, it could be useful in other places. (From OE-Core rev: c8a0e7ecee15985f7eed10ce9c86c48a77c5b7c5) Signed-off-by: Marta Rybczynska <marta.rybczynska@huawei.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit debd37abcdde8788761ebdb4a05bc61f7394cbb8) Signed-off-by: Steve Sakoman <steve@sakoman.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 1d3c775bbe..b17390de90 100644
--- a/meta/lib/oe/cve_check.py
+++ b/meta/lib/oe/cve_check.py
@@ -79,3 +79,13 @@ def cve_check_merge_jsons(output, data):
79 return 79 return
80 80
81 output["package"].append(data["package"][0]) 81 output["package"].append(data["package"][0])
82
83def update_symlinks(target_path, link_path):
84 """
85 Update a symbolic link link_path to point to target_path.
86 Remove the link and recreate it if exist and is different.
87 """
88 if link_path != target_path and os.path.exists(target_path):
89 if os.path.exists(os.path.realpath(link_path)):
90 os.remove(link_path)
91 os.symlink(os.path.basename(target_path), link_path)