summaryrefslogtreecommitdiffstats
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-12 16:44:06 +0100
commitdd08692cac01ca397864342f1bddedf1cac61b42 (patch)
tree77ffa23893dc2679264709f8b24c947c3209625e
parent645c157befa8eb91dfb81cecff4d70ddcd2c9f25 (diff)
downloadpoky-dd08692cac01ca397864342f1bddedf1cac61b42.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: 2fd7f3b7dc964b59b268dd4a34761f9f71f61c25) Signed-off-by: Davide Gardenal <davide.gardenal@huawei.com> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> (cherry picked from commit 2f024c0236c4806f0e59e4ce51a42f6b80fdf1b3) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-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)