diff options
author | Marta Rybczynska <rybczynska@gmail.com> | 2022-06-03 10:58:27 +0200 |
---|---|---|
committer | Steve Sakoman <steve@sakoman.com> | 2022-06-07 08:56:30 -1000 |
commit | c8a0e7ecee15985f7eed10ce9c86c48a77c5b7c5 (patch) | |
tree | 12d39d966f48012002511bb716c89be228a5d945 /meta/lib | |
parent | 7b2a1d908d3b63da5e9f072b61dd3c5fa91c7b8f (diff) | |
download | openembedded-core-contrib-c8a0e7ecee15985f7eed10ce9c86c48a77c5b7c5.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>
(cherry picked from commit debd37abcdde8788761ebdb4a05bc61f7394cbb8)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
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 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): 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) |