summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2019-12-11 08:16:04 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-03-16 16:44:53 +0000
commit7d8d93cfb915cb4c9b855019dfc2bddc3918ebff (patch)
tree4a19ed0662b774baaceb679642122cd28479f10f /meta/classes
parent266e22f25f935001ea0f4a8b516f3b405ffcc16e (diff)
downloadpoky-7d8d93cfb915cb4c9b855019dfc2bddc3918ebff.tar.gz
cve-check: fail gracefully when file not found
With out these changes, a traceback displayed when a file is listed in the SRC_URI but the file does not exist. raise FileNotFoundError and print the patch then mark the task as failed. (From OE-Core rev: d313a5912d2ecbf7796e75ee7e7cd1d442b4fa40) Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> (cherry picked from commit d4926c11a4ab9148bdb640a9367c9e1891491a5b) Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/cve-check.bbclass9
1 files changed, 8 insertions, 1 deletions
diff --git a/meta/classes/cve-check.bbclass b/meta/classes/cve-check.bbclass
index 01b3637469..74124364b2 100644
--- a/meta/classes/cve-check.bbclass
+++ b/meta/classes/cve-check.bbclass
@@ -52,7 +52,10 @@ python do_cve_check () {
52 """ 52 """
53 53
54 if os.path.exists(d.getVar("CVE_CHECK_DB_FILE")): 54 if os.path.exists(d.getVar("CVE_CHECK_DB_FILE")):
55 patched_cves = get_patches_cves(d) 55 try:
56 patched_cves = get_patches_cves(d)
57 except FileNotFoundError:
58 bb.fatal("Failure in searching patches")
56 patched, unpatched = check_cves(d, patched_cves) 59 patched, unpatched = check_cves(d, patched_cves)
57 if patched or unpatched: 60 if patched or unpatched:
58 cve_data = get_cve_info(d, patched + unpatched) 61 cve_data = get_cve_info(d, patched + unpatched)
@@ -129,6 +132,10 @@ def get_patches_cves(d):
129 for url in src_patches(d): 132 for url in src_patches(d):
130 patch_file = bb.fetch.decodeurl(url)[2] 133 patch_file = bb.fetch.decodeurl(url)[2]
131 134
135 if not os.path.isfile(patch_file):
136 bb.error("File Not found: %s" % patch_file)
137 raise FileNotFoundError
138
132 # Check patch file name for CVE ID 139 # Check patch file name for CVE ID
133 fname_match = cve_file_name_match.search(patch_file) 140 fname_match = cve_file_name_match.search(patch_file)
134 if fname_match: 141 if fname_match: