summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-core/meta/cve-update-db-native.bb6
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())