diff options
author | Ross Burton <ross@burtonini.com> | 2020-09-10 22:04:12 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-02-13 07:44:09 +0000 |
commit | 4d69f690821fa2256680c078d2b477e541f6a836 (patch) | |
tree | e12e4f86577e500bdf7205763fd346f4ec6c4223 | |
parent | accc5ad75030c99a964368ecab2f98c7915aa6ea (diff) | |
download | poky-4d69f690821fa2256680c078d2b477e541f6a836.tar.gz |
cve-update-db-native: add more logging when fetching
Add some debug logging when fetching the CVE data.
(From OE-Core rev: 60fa8135437ab1e2bc7cead5f838ac787c8dab26)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 9b230584664873af2ab453b8153b1ad276d3b0af)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-core/meta/cve-update-db-native.bb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/meta/recipes-core/meta/cve-update-db-native.bb b/meta/recipes-core/meta/cve-update-db-native.bb index 355ee2a2a3..e267671628 100644 --- a/meta/recipes-core/meta/cve-update-db-native.bb +++ b/meta/recipes-core/meta/cve-update-db-native.bb | |||
@@ -75,6 +75,7 @@ python do_fetch() { | |||
75 | with bb.progress.ProgressHandler(d) as ph, open(os.path.join(d.getVar("TMPDIR"), 'cve_check'), 'a') as cve_f: | 75 | with bb.progress.ProgressHandler(d) as ph, open(os.path.join(d.getVar("TMPDIR"), 'cve_check'), 'a') as cve_f: |
76 | total_years = date.today().year + 1 - YEAR_START | 76 | total_years = date.today().year + 1 - YEAR_START |
77 | for i, year in enumerate(range(YEAR_START, date.today().year + 1)): | 77 | for i, year in enumerate(range(YEAR_START, date.today().year + 1)): |
78 | bb.debug(2, "Updating %d" % year) | ||
78 | ph.update((float(i + 1) / total_years) * 100) | 79 | ph.update((float(i + 1) / total_years) * 100) |
79 | year_url = (d.getVar('NVDCVE_URL')) + str(year) | 80 | year_url = (d.getVar('NVDCVE_URL')) + str(year) |
80 | meta_url = year_url + ".meta" | 81 | meta_url = year_url + ".meta" |
@@ -104,6 +105,7 @@ python do_fetch() { | |||
104 | cursor.close() | 105 | cursor.close() |
105 | 106 | ||
106 | if not meta or meta[0] != last_modified: | 107 | if not meta or meta[0] != last_modified: |
108 | bb.debug(2, "Updating entries") | ||
107 | # Clear products table entries corresponding to current year | 109 | # Clear products table entries corresponding to current year |
108 | conn.execute("delete from PRODUCTS where ID like ?", ('CVE-%d%%' % year,)).close() | 110 | conn.execute("delete from PRODUCTS where ID like ?", ('CVE-%d%%' % year,)).close() |
109 | 111 | ||
@@ -117,7 +119,8 @@ python do_fetch() { | |||
117 | cve_f.write('Warning: CVE db update error, CVE data is outdated.\n\n') | 119 | cve_f.write('Warning: CVE db update error, CVE data is outdated.\n\n') |
118 | bb.warn("Cannot parse CVE data (%s), update failed" % e.reason) | 120 | bb.warn("Cannot parse CVE data (%s), update failed" % e.reason) |
119 | return | 121 | return |
120 | 122 | else: | |
123 | bb.debug(2, "Already up to date (last modified %s)" % last_modified) | ||
121 | # Update success, set the date to cve_check file. | 124 | # Update success, set the date to cve_check file. |
122 | if year == date.today().year: | 125 | if year == date.today().year: |
123 | cve_f.write('CVE database update : %s\n\n' % date.today()) | 126 | cve_f.write('CVE database update : %s\n\n' % date.today()) |