summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2019-12-11 08:16:04 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-12-28 23:25:41 +0000
commit8fb7fbcb986400c5c7cba2818ffc33b1e9bddb0c (patch)
tree348a53bfdba56b555cb03cc6ab8c681648ef9775 /meta
parent56fa7845a4d7c0f0b21435457775e83e9c6314f9 (diff)
downloadpoky-8fb7fbcb986400c5c7cba2818ffc33b1e9bddb0c.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: d4926c11a4ab9148bdb640a9367c9e1891491a5b) Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-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: