summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/cve-check.bbclass18
1 files changed, 10 insertions, 8 deletions
diff --git a/meta/classes/cve-check.bbclass b/meta/classes/cve-check.bbclass
index 24ddb865ea..7cd98ae462 100644
--- a/meta/classes/cve-check.bbclass
+++ b/meta/classes/cve-check.bbclass
@@ -79,7 +79,7 @@ CVE_CHECK_LAYER_INCLUDELIST ??= ""
79# set to "alphabetical" for version using single alphabetical character as increment release 79# set to "alphabetical" for version using single alphabetical character as increment release
80CVE_VERSION_SUFFIX ??= "" 80CVE_VERSION_SUFFIX ??= ""
81 81
82def generate_json_report(out_path, link_path): 82def generate_json_report(d, out_path, link_path):
83 if os.path.exists(d.getVar("CVE_CHECK_SUMMARY_INDEX_PATH")): 83 if os.path.exists(d.getVar("CVE_CHECK_SUMMARY_INDEX_PATH")):
84 import json 84 import json
85 from oe.cve_check import cve_check_merge_jsons 85 from oe.cve_check import cve_check_merge_jsons
@@ -127,10 +127,11 @@ python cve_save_summary_handler () {
127 os.remove(cvefile_link) 127 os.remove(cvefile_link)
128 os.symlink(os.path.basename(cve_summary_file), cvefile_link) 128 os.symlink(os.path.basename(cve_summary_file), cvefile_link)
129 129
130 if d.getVar("CVE_CHECK_FORMAT_JSON") == "1":
130 json_summary_link_name = os.path.join(cvelogpath, d.getVar("CVE_CHECK_SUMMARY_FILE_NAME_JSON")) 131 json_summary_link_name = os.path.join(cvelogpath, d.getVar("CVE_CHECK_SUMMARY_FILE_NAME_JSON"))
131 json_summary_name = os.path.join(cvelogpath, "%s-%s.json" % (cve_summary_name, timestamp)) 132 json_summary_name = os.path.join(cvelogpath, "%s-%s.json" % (cve_summary_name, timestamp))
132 generate_json_report(json_summary_name, json_summary_link_name) 133 generate_json_report(d, json_summary_name, json_summary_link_name)
133 bb.plain("CVE report summary created at: %s" % json_summary_link_name) 134 bb.plain("Complete CVE JSON report summary created at: %s" % json_summary_link_name)
134} 135}
135 136
136addhandler cve_save_summary_handler 137addhandler cve_save_summary_handler
@@ -207,11 +208,12 @@ python cve_check_write_rootfs_manifest () {
207 os.symlink(os.path.basename(manifest_name), manifest_link) 208 os.symlink(os.path.basename(manifest_name), manifest_link)
208 bb.plain("Image CVE report stored in: %s" % manifest_name) 209 bb.plain("Image CVE report stored in: %s" % manifest_name)
209 210
210 link_path = os.path.join(deploy_dir, "%s.json" % link_name) 211 if d.getVar("CVE_CHECK_FORMAT_JSON") == "1":
211 manifest_path = d.getVar("CVE_CHECK_MANIFEST_JSON") 212 link_path = os.path.join(deploy_dir, "%s.json" % link_name)
212 bb.note("Generating JSON CVE manifest") 213 manifest_path = d.getVar("CVE_CHECK_MANIFEST_JSON")
213 generate_json_report(json_summary_name, json_summary_link_name) 214 bb.note("Generating JSON CVE manifest")
214 bb.plain("Image CVE JSON report stored in: %s" % link_path) 215 generate_json_report(d, manifest_path, link_path)
216 bb.plain("Image CVE JSON report stored in: %s" % link_path)
215} 217}
216 218
217ROOTFS_POSTPROCESS_COMMAND:prepend = "${@'cve_check_write_rootfs_manifest; ' if d.getVar('CVE_CHECK_CREATE_MANIFEST') == '1' else ''}" 219ROOTFS_POSTPROCESS_COMMAND:prepend = "${@'cve_check_write_rootfs_manifest; ' if d.getVar('CVE_CHECK_CREATE_MANIFEST') == '1' else ''}"