diff options
author | Marta Rybczynska <rybczynska@gmail.com> | 2022-06-03 10:58:27 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-06-06 13:36:05 +0100 |
commit | 4417c376f692c58788739aeb1e1b15ad30fb780c (patch) | |
tree | 4e2277935b5606c1b006c4fc9879bed67439574e /meta/lib | |
parent | 11d38c099caf49fe81059afa123a7a799d896b51 (diff) | |
download | poky-4417c376f692c58788739aeb1e1b15ad30fb780c.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: debd37abcdde8788761ebdb4a05bc61f7394cbb8)
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.py | 10 |
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): | |||
163 | return | 163 | return |
164 | 164 | ||
165 | output["package"].append(data["package"][0]) | 165 | output["package"].append(data["package"][0]) |
166 | |||
167 | def update_symlinks(target_path, link_path): | ||
168 | """ | ||
169 | Update a symbolic link link_path to point to target_path. | ||
170 | Remove the link and recreate it if exist and is different. | ||
171 | """ | ||
172 | if link_path != target_path and os.path.exists(target_path): | ||
173 | if os.path.exists(os.path.realpath(link_path)): | ||
174 | os.remove(link_path) | ||
175 | os.symlink(os.path.basename(target_path), link_path) | ||