diff options
author | Ross Burton <ross@burtonini.com> | 2020-09-10 22:04:12 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-09-12 14:49:00 +0100 |
commit | f0d9c8926be8ef9f21e3707de4a449ed63ea9067 (patch) | |
tree | 3dad0ea24e95615694186b920e1e0d21303babf8 | |
parent | d6a3bbcff18d94e1ea0fece9480996d192ce0a01 (diff) | |
download | poky-f0d9c8926be8ef9f21e3707de4a449ed63ea9067.tar.gz |
cve-update-db-native: add more logging when fetching
Add some debug logging when fetching the CVE data.
(From OE-Core rev: 9b230584664873af2ab453b8153b1ad276d3b0af)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-core/meta/cve-update-db-native.bb | 6 |
1 files changed, 5 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 94367f9a94..27b4c58d4e 100644 --- a/meta/recipes-core/meta/cve-update-db-native.bb +++ b/meta/recipes-core/meta/cve-update-db-native.bb | |||
@@ -46,6 +46,7 @@ python do_populate_cve_db() { | |||
46 | try: | 46 | try: |
47 | import time | 47 | import time |
48 | if time.time() - os.path.getmtime(db_file) < (60*60): | 48 | if time.time() - os.path.getmtime(db_file) < (60*60): |
49 | bb.debug(2, "Recently updated, skipping") | ||
49 | return | 50 | return |
50 | except OSError: | 51 | except OSError: |
51 | pass | 52 | pass |
@@ -61,6 +62,7 @@ python do_populate_cve_db() { | |||
61 | with bb.progress.ProgressHandler(d) as ph, open(os.path.join(d.getVar("TMPDIR"), 'cve_check'), 'a') as cve_f: | 62 | with bb.progress.ProgressHandler(d) as ph, open(os.path.join(d.getVar("TMPDIR"), 'cve_check'), 'a') as cve_f: |
62 | total_years = date.today().year + 1 - YEAR_START | 63 | total_years = date.today().year + 1 - YEAR_START |
63 | for i, year in enumerate(range(YEAR_START, date.today().year + 1)): | 64 | for i, year in enumerate(range(YEAR_START, date.today().year + 1)): |
65 | bb.debug(2, "Updating %d" % year) | ||
64 | ph.update((float(i + 1) / total_years) * 100) | 66 | ph.update((float(i + 1) / total_years) * 100) |
65 | year_url = BASE_URL + str(year) | 67 | year_url = BASE_URL + str(year) |
66 | meta_url = year_url + ".meta" | 68 | meta_url = year_url + ".meta" |
@@ -88,6 +90,7 @@ python do_populate_cve_db() { | |||
88 | c.execute("select DATE from META where YEAR = ?", (year,)) | 90 | c.execute("select DATE from META where YEAR = ?", (year,)) |
89 | meta = c.fetchone() | 91 | meta = c.fetchone() |
90 | if not meta or meta[0] != last_modified: | 92 | if not meta or meta[0] != last_modified: |
93 | bb.debug(2, "Updating entries") | ||
91 | # Clear products table entries corresponding to current year | 94 | # Clear products table entries corresponding to current year |
92 | c.execute("delete from PRODUCTS where ID like ?", ('CVE-%d%%' % year,)) | 95 | c.execute("delete from PRODUCTS where ID like ?", ('CVE-%d%%' % year,)) |
93 | 96 | ||
@@ -101,7 +104,8 @@ python do_populate_cve_db() { | |||
101 | cve_f.write('Warning: CVE db update error, CVE data is outdated.\n\n') | 104 | cve_f.write('Warning: CVE db update error, CVE data is outdated.\n\n') |
102 | bb.warn("Cannot parse CVE data (%s), update failed" % e.reason) | 105 | bb.warn("Cannot parse CVE data (%s), update failed" % e.reason) |
103 | return | 106 | return |
104 | 107 | else: | |
108 | bb.debug(2, "Already up to date (last modified %s)" % last_modified) | ||
105 | # Update success, set the date to cve_check file. | 109 | # Update success, set the date to cve_check file. |
106 | if year == date.today().year: | 110 | if year == date.today().year: |
107 | cve_f.write('CVE database update : %s\n\n' % date.today()) | 111 | cve_f.write('CVE database update : %s\n\n' % date.today()) |