diff mbox series

[dunfell,02/16] cve-update-db-native: add more logging when fetching

Message ID 60fa8135437ab1e2bc7cead5f838ac787c8dab26.1674657501.git.steve@sakoman.com
State New, archived
Headers show
Series [dunfell,01/16] cve-update-db-native: Allow to overrule the URL in a bbappend. | expand

Commit Message

Steve Sakoman Jan. 25, 2023, 2:41 p.m. UTC
From: Ross Burton <ross@burtonini.com>

Add some debug logging when fetching the CVE data.

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>
---
 meta/recipes-core/meta/cve-update-db-native.bb | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

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() {
     with bb.progress.ProgressHandler(d) as ph, open(os.path.join(d.getVar("TMPDIR"), 'cve_check'), 'a') as cve_f:
         total_years = date.today().year + 1 - YEAR_START
         for i, year in enumerate(range(YEAR_START, date.today().year + 1)):
+            bb.debug(2, "Updating %d" % year)
             ph.update((float(i + 1) / total_years) * 100)
             year_url = (d.getVar('NVDCVE_URL')) + str(year)
             meta_url = year_url + ".meta"
@@ -104,6 +105,7 @@  python do_fetch() {
             cursor.close()
 
             if not meta or meta[0] != last_modified:
+                bb.debug(2, "Updating entries")
                 # Clear products table entries corresponding to current year
                 conn.execute("delete from PRODUCTS where ID like ?", ('CVE-%d%%' % year,)).close()
 
@@ -117,7 +119,8 @@  python do_fetch() {
                     cve_f.write('Warning: CVE db update error, CVE data is outdated.\n\n')
                     bb.warn("Cannot parse CVE data (%s), update failed" % e.reason)
                     return
-
+            else:
+                bb.debug(2, "Already up to date (last modified %s)" % last_modified)
             # Update success, set the date to cve_check file.
             if year == date.today().year:
                 cve_f.write('CVE database update : %s\n\n' % date.today())