diff options
-rw-r--r-- | meta/classes/cve-check.bbclass | 11 | ||||
-rw-r--r-- | meta/lib/oe/cve_check.py | 10 |
2 files changed, 13 insertions, 8 deletions
diff --git a/meta/classes/cve-check.bbclass b/meta/classes/cve-check.bbclass index 0111ec6ba8..2ab1720dc3 100644 --- a/meta/classes/cve-check.bbclass +++ b/meta/classes/cve-check.bbclass | |||
@@ -76,16 +76,10 @@ CVE_CHECK_LAYER_INCLUDELIST ??= "" | |||
76 | # set to "alphabetical" for version using single alphabetical character as increment release | 76 | # set to "alphabetical" for version using single alphabetical character as increment release |
77 | CVE_VERSION_SUFFIX ??= "" | 77 | CVE_VERSION_SUFFIX ??= "" |
78 | 78 | ||
79 | def update_symlinks(target_path, link_path): | ||
80 | if link_path != target_path and os.path.exists(target_path): | ||
81 | if os.path.exists(os.path.realpath(link_path)): | ||
82 | os.remove(link_path) | ||
83 | os.symlink(os.path.basename(target_path), link_path) | ||
84 | |||
85 | def generate_json_report(d, out_path, link_path): | 79 | def generate_json_report(d, out_path, link_path): |
86 | if os.path.exists(d.getVar("CVE_CHECK_SUMMARY_INDEX_PATH")): | 80 | if os.path.exists(d.getVar("CVE_CHECK_SUMMARY_INDEX_PATH")): |
87 | import json | 81 | import json |
88 | from oe.cve_check import cve_check_merge_jsons | 82 | from oe.cve_check import cve_check_merge_jsons, update_symlinks |
89 | 83 | ||
90 | bb.note("Generating JSON CVE summary") | 84 | bb.note("Generating JSON CVE summary") |
91 | index_file = d.getVar("CVE_CHECK_SUMMARY_INDEX_PATH") | 85 | index_file = d.getVar("CVE_CHECK_SUMMARY_INDEX_PATH") |
@@ -106,6 +100,7 @@ def generate_json_report(d, out_path, link_path): | |||
106 | python cve_save_summary_handler () { | 100 | python cve_save_summary_handler () { |
107 | import shutil | 101 | import shutil |
108 | import datetime | 102 | import datetime |
103 | from oe.cve_check import update_symlinks | ||
109 | 104 | ||
110 | cve_tmp_file = d.getVar("CVE_CHECK_TMP_FILE") | 105 | cve_tmp_file = d.getVar("CVE_CHECK_TMP_FILE") |
111 | 106 | ||
@@ -174,7 +169,7 @@ python cve_check_write_rootfs_manifest () { | |||
174 | import shutil | 169 | import shutil |
175 | import json | 170 | import json |
176 | from oe.rootfs import image_list_installed_packages | 171 | from oe.rootfs import image_list_installed_packages |
177 | from oe.cve_check import cve_check_merge_jsons | 172 | from oe.cve_check import cve_check_merge_jsons, update_symlinks |
178 | 173 | ||
179 | if d.getVar("CVE_CHECK_COPY_FILES") == "1": | 174 | if d.getVar("CVE_CHECK_COPY_FILES") == "1": |
180 | deploy_file = d.getVar("CVE_CHECK_RECIPE_FILE") | 175 | deploy_file = d.getVar("CVE_CHECK_RECIPE_FILE") |
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 | |||
83 | def 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) | ||