diff options
author | Chris Laplante <chris.laplante@agilent.com> | 2020-09-09 16:51:09 -0400 |
---|---|---|
committer | Steve Sakoman <steve@sakoman.com> | 2020-09-14 04:26:37 -1000 |
commit | b98e50f08b2bcf61fbc75ea1b0ad83a17c0a736a (patch) | |
tree | ba82b01840e5a9132aae0ee984ba1b8960e6f57c | |
parent | c8c307c4b28d93938887ecb1d87f6024e916c0f9 (diff) | |
download | openembedded-core-contrib-b98e50f08b2bcf61fbc75ea1b0ad83a17c0a736a.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.
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>
-rw-r--r-- | meta/classes/cve-check.bbclass | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/meta/classes/cve-check.bbclass b/meta/classes/cve-check.bbclass index 35b7d0f298..17f64a8a9c 100644 --- a/meta/classes/cve-check.bbclass +++ b/meta/classes/cve-check.bbclass @@ -63,14 +63,15 @@ python cve_save_summary_handler () { timestamp = datetime.datetime.now().strftime('%Y%m%d%H%M%S') cve_summary_file = os.path.join(cvelogpath, "%s-%s.txt" % (cve_summary_name, timestamp)) - shutil.copyfile(cve_tmp_file, cve_summary_file) + if os.path.exists(cve_tmp_file): + shutil.copyfile(cve_tmp_file, cve_summary_file) - if cve_summary_file and os.path.exists(cve_summary_file): - cvefile_link = os.path.join(cvelogpath, cve_summary_name) + if cve_summary_file and os.path.exists(cve_summary_file): + cvefile_link = os.path.join(cvelogpath, cve_summary_name) - if os.path.exists(os.path.realpath(cvefile_link)): - os.remove(cvefile_link) - os.symlink(os.path.basename(cve_summary_file), cvefile_link) + if os.path.exists(os.path.realpath(cvefile_link)): + os.remove(cvefile_link) + os.symlink(os.path.basename(cve_summary_file), cvefile_link) } addhandler cve_save_summary_handler |