summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorChris Laplante <chris.laplante@agilent.com>2020-09-09 20:51:09 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-09-17 11:51:24 (GMT)
commitcf0d81d6bf0774cec846a8d570736f858f117d48 (patch)
tree1e248f3953ee9311856a4add49bdb80258dbd8cc /meta/classes
parent738fe904c7d2ed0c4f1c57fa0b153c173d80c4cd (diff)
downloadpoky-cf0d81d6bf0774cec846a8d570736f858f117d48.tar.gz
cve-check: avoid FileNotFoundError if no do_cve_check task has run
For example, if you just run 'bitbake cve-update-db-native' in a clean build system, |cve_tmp_file| won't exist yet. (From OE-Core rev: b98e50f08b2bcf61fbc75ea1b0ad83a17c0a736a) Signed-off-by: Chris Laplante <chris.laplante@agilent.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit dd4473f3d8e1c1a587b6de660775e4b46ddc5fad) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/cve-check.bbclass13
1 files changed, 7 insertions, 6 deletions
diff --git a/meta/classes/cve-check.bbclass b/meta/classes/cve-check.bbclass
index 35b7d0f..17f64a8 100644
--- a/meta/classes/cve-check.bbclass
+++ b/meta/classes/cve-check.bbclass
@@ -63,14 +63,15 @@ python cve_save_summary_handler () {
63 timestamp = datetime.datetime.now().strftime('%Y%m%d%H%M%S') 63 timestamp = datetime.datetime.now().strftime('%Y%m%d%H%M%S')
64 cve_summary_file = os.path.join(cvelogpath, "%s-%s.txt" % (cve_summary_name, timestamp)) 64 cve_summary_file = os.path.join(cvelogpath, "%s-%s.txt" % (cve_summary_name, timestamp))
65 65
66 shutil.copyfile(cve_tmp_file, cve_summary_file) 66 if os.path.exists(cve_tmp_file):
67 shutil.copyfile(cve_tmp_file, cve_summary_file)
67 68
68 if cve_summary_file and os.path.exists(cve_summary_file): 69 if cve_summary_file and os.path.exists(cve_summary_file):
69 cvefile_link = os.path.join(cvelogpath, cve_summary_name) 70 cvefile_link = os.path.join(cvelogpath, cve_summary_name)
70 71
71 if os.path.exists(os.path.realpath(cvefile_link)): 72 if os.path.exists(os.path.realpath(cvefile_link)):
72 os.remove(cvefile_link) 73 os.remove(cvefile_link)
73 os.symlink(os.path.basename(cve_summary_file), cvefile_link) 74 os.symlink(os.path.basename(cve_summary_file), cvefile_link)
74} 75}
75 76
76addhandler cve_save_summary_handler 77addhandler cve_save_summary_handler