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-14 20:26:34 +0100
commit49cd9f898f6c7ab8e4a7620ef11de61560562773 (patch)
tree190714ea75aa5e86db410a3537df9306350de220
parent46e00399e5ceded87d1369c22ee8d4c1cdcbbd58 (diff)
downloadpoky-49cd9f898f6c7ab8e4a7620ef11de61560562773.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: 62965ca8ca7077c12d75dac37efe204d7159cddd) 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 350ed8ec39..ac9f0fb22c 100644
--- a/meta/classes/cve-check.bbclass
+++ b/meta/classes/cve-check.bbclass
@@ -117,10 +117,11 @@ python cve_save_summary_handler () {
117 117
118 if cve_summary_file and os.path.exists(cve_summary_file): 118 if cve_summary_file and os.path.exists(cve_summary_file):
119 cvefile_link = os.path.join(cvelogpath, cve_summary_name) 119 cvefile_link = os.path.join(cvelogpath, cve_summary_name)
120 120 # if the paths are the same don't create the link
121 if os.path.exists(os.path.realpath(cvefile_link)): 121 if cvefile_link != cve_summary_file:
122 os.remove(cvefile_link) 122 if os.path.exists(os.path.realpath(cvefile_link)):
123 os.symlink(os.path.basename(cve_summary_file), cvefile_link) 123 os.remove(cvefile_link)
124 os.symlink(os.path.basename(cve_summary_file), cvefile_link)
124 125
125 json_summary_link_name = os.path.join(cvelogpath, d.getVar("CVE_CHECK_SUMMARY_FILE_NAME_JSON")) 126 json_summary_link_name = os.path.join(cvelogpath, d.getVar("CVE_CHECK_SUMMARY_FILE_NAME_JSON"))
126 json_summary_name = os.path.join(cvelogpath, "%s-%s.json" % (cve_summary_name, timestamp)) 127 json_summary_name = os.path.join(cvelogpath, "%s-%s.json" % (cve_summary_name, timestamp))
@@ -193,10 +194,12 @@ python cve_check_write_rootfs_manifest () {
193 194
194 if manifest_name and os.path.exists(manifest_name): 195 if manifest_name and os.path.exists(manifest_name):
195 manifest_link = os.path.join(deploy_dir, "%s.cve" % link_name) 196 manifest_link = os.path.join(deploy_dir, "%s.cve" % link_name)
196 # If we already have another manifest, update symlinks 197 # if they are the same don't create the link
197 if os.path.exists(os.path.realpath(manifest_link)): 198 if manifest_link != manifest_name:
198 os.remove(manifest_link) 199 # If we already have another manifest, update symlinks
199 os.symlink(os.path.basename(manifest_name), manifest_link) 200 if os.path.exists(os.path.realpath(manifest_link)):
201 os.remove(manifest_link)
202 os.symlink(os.path.basename(manifest_name), manifest_link)
200 bb.plain("Image CVE report stored in: %s" % manifest_name) 203 bb.plain("Image CVE report stored in: %s" % manifest_name)
201 204
202 link_path = os.path.join(deploy_dir, "%s.json" % link_name) 205 link_path = os.path.join(deploy_dir, "%s.json" % link_name)