summaryrefslogtreecommitdiffstats
path: root/meta/classes/cve-check.bbclass
diff options
context:
space:
mode:
authorDavide Gardenal <davidegarde2000@gmail.com>2022-05-03 09:52:44 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-05-04 21:13:29 +0100
commit831f237175eeafa0631c5687e0b90ba84c1a3694 (patch)
tree5efbe202598636af36de56f5898f0034023488f7 /meta/classes/cve-check.bbclass
parent630fb072192b345c42952dd0f274c66aedc67cff (diff)
downloadpoky-831f237175eeafa0631c5687e0b90ba84c1a3694.tar.gz
cve-check: fix symlinks where link and output path are equal
An if statement now checks if the link and output path are the same, if they are then the link is not created, otherwise it is. (From OE-Core rev: 2f024c0236c4806f0e59e4ce51a42f6b80fdf1b3) Signed-off-by: Davide Gardenal <davide.gardenal@huawei.com> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/cve-check.bbclass')
-rw-r--r--meta/classes/cve-check.bbclass19
1 files changed, 11 insertions, 8 deletions
diff --git a/meta/classes/cve-check.bbclass b/meta/classes/cve-check.bbclass
index c74c717235..24ddb865ea 100644
--- a/meta/classes/cve-check.bbclass
+++ b/meta/classes/cve-check.bbclass
@@ -121,10 +121,11 @@ python cve_save_summary_handler () {
121 121
122 if cve_summary_file and os.path.exists(cve_summary_file): 122 if cve_summary_file and os.path.exists(cve_summary_file):
123 cvefile_link = os.path.join(cvelogpath, cve_summary_name) 123 cvefile_link = os.path.join(cvelogpath, cve_summary_name)
124 124 # if the paths are the same don't create the link
125 if os.path.exists(os.path.realpath(cvefile_link)): 125 if cvefile_link != cve_summary_file:
126 os.remove(cvefile_link) 126 if os.path.exists(os.path.realpath(cvefile_link)):
127 os.symlink(os.path.basename(cve_summary_file), cvefile_link) 127 os.remove(cvefile_link)
128 os.symlink(os.path.basename(cve_summary_file), cvefile_link)
128 129
129 json_summary_link_name = os.path.join(cvelogpath, d.getVar("CVE_CHECK_SUMMARY_FILE_NAME_JSON")) 130 json_summary_link_name = os.path.join(cvelogpath, d.getVar("CVE_CHECK_SUMMARY_FILE_NAME_JSON"))
130 json_summary_name = os.path.join(cvelogpath, "%s-%s.json" % (cve_summary_name, timestamp)) 131 json_summary_name = os.path.join(cvelogpath, "%s-%s.json" % (cve_summary_name, timestamp))
@@ -198,10 +199,12 @@ python cve_check_write_rootfs_manifest () {
198 199
199 if manifest_name and os.path.exists(manifest_name): 200 if manifest_name and os.path.exists(manifest_name):
200 manifest_link = os.path.join(deploy_dir, "%s.cve" % link_name) 201 manifest_link = os.path.join(deploy_dir, "%s.cve" % link_name)
201 # If we already have another manifest, update symlinks 202 # if they are the same don't create the link
202 if os.path.exists(os.path.realpath(manifest_link)): 203 if manifest_link != manifest_name:
203 os.remove(manifest_link) 204 # If we already have another manifest, update symlinks
204 os.symlink(os.path.basename(manifest_name), manifest_link) 205 if os.path.exists(os.path.realpath(manifest_link)):
206 os.remove(manifest_link)
207 os.symlink(os.path.basename(manifest_name), manifest_link)
205 bb.plain("Image CVE report stored in: %s" % manifest_name) 208 bb.plain("Image CVE report stored in: %s" % manifest_name)
206 209
207 link_path = os.path.join(deploy_dir, "%s.json" % link_name) 210 link_path = os.path.join(deploy_dir, "%s.json" % link_name)