diff options
Diffstat (limited to 'meta/recipes-devtools/cve-check-tool/cve-check-tool_5.6.4.bb')
-rw-r--r-- | meta/recipes-devtools/cve-check-tool/cve-check-tool_5.6.4.bb | 45 |
1 files changed, 19 insertions, 26 deletions
diff --git a/meta/recipes-devtools/cve-check-tool/cve-check-tool_5.6.4.bb b/meta/recipes-devtools/cve-check-tool/cve-check-tool_5.6.4.bb index 116555962c..5bb22d16db 100644 --- a/meta/recipes-devtools/cve-check-tool/cve-check-tool_5.6.4.bb +++ b/meta/recipes-devtools/cve-check-tool/cve-check-tool_5.6.4.bb | |||
@@ -22,35 +22,28 @@ inherit pkgconfig autotools | |||
22 | EXTRA_OECONF = "--disable-coverage" | 22 | EXTRA_OECONF = "--disable-coverage" |
23 | CFLAGS_append = " -Wno-error=pedantic" | 23 | CFLAGS_append = " -Wno-error=pedantic" |
24 | 24 | ||
25 | python do_populate_cve_db () { | 25 | do_populate_cve_db() { |
26 | import subprocess | 26 | if [ "${BB_NO_NETWORK}" = "1" ] ; then |
27 | import time | 27 | bberror "BB_NO_NETWORK is set; Can't update cve-check-tool database, CVEs won't be checked" |
28 | |||
29 | if d.getVar("BB_NO_NETWORK", True) == "1": | ||
30 | bb.error("BB_NO_NETWORK is set; Can't update cve-check-tool database, " | ||
31 | "CVEs won't be checked") | ||
32 | return | 28 | return |
29 | fi | ||
33 | 30 | ||
34 | bb.utils.export_proxies(d) | ||
35 | # In case we don't inherit cve-check class, use default values defined in the class. | 31 | # In case we don't inherit cve-check class, use default values defined in the class. |
36 | cve_dir = d.getVar("CVE_CHECK_DB_DIR", True) or d.expand("${DL_DIR}/CVE_CHECK") | 32 | cve_dir="${CVE_CHECK_DB_DIR}" |
37 | cve_file = d.getVar("CVE_CHECK_TMP_FILE", True) or d.expand("${TMPDIR}/cve_check") | 33 | cve_file="${CVE_CHECK_TMP_FILE}" |
38 | cve_cmd = "cve-check-update" | 34 | |
39 | cmd = [cve_cmd, "-d", cve_dir] | 35 | [ -z "${cve_dir}" ] && cve_dir="${DL_DIR}/CVE_CHECK" |
40 | bb.debug(1, "Updating cve-check-tool database located in %s" % cve_dir) | 36 | [ -z "${cve_file}" ] && cve_file="${TMPDIR}/cve_check" |
41 | try: | 37 | |
42 | output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) | 38 | bbdebug 2 "Updating cve-check-tool database located in $cve_dir" |
43 | bb.debug(2, "Command '%s' returned:\n%s" % ("\n".join(cmd), output)) | 39 | if cve-check-update -d "$cve_dir" ; then |
44 | time_utc = time.gmtime(time.time()) | 40 | printf "CVE database was updated on %s UTC\n\n" "$(LANG=C date --utc +'%F %T')" > "$cve_file" |
45 | time_format = "%Y-%m-%d %H:%M:%S" | 41 | else |
46 | with open(cve_file, "w") as f: | 42 | bbwarn "Error in executing cve-check-update" |
47 | f.write("CVE database was updated on %s UTC\n\n" | 43 | if [ "${@'1' if bb.data.inherits_class('cve-check', d) else '0'}" -ne 0 ] ; then |
48 | % time.strftime(time_format, time_utc)) | 44 | bbwarn "Failed to update cve-check-tool database, CVEs won't be checked" |
49 | 45 | fi | |
50 | except subprocess.CalledProcessError as e: | 46 | fi |
51 | bb.warn("Error in executing cve-check-update: %s (output %s)" % (e, e.output)) | ||
52 | if bb.data.inherits_class('cve-check', d): | ||
53 | bb.warn("Failed to update cve-check-tool database, CVEs won't be checked") | ||
54 | } | 47 | } |
55 | 48 | ||
56 | addtask populate_cve_db after do_populate_sysroot | 49 | addtask populate_cve_db after do_populate_sysroot |