summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-core/meta/cve-update-db-native.bb10
1 files changed, 9 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 af39480dda..c8c1cbf115 100644
--- a/meta/recipes-core/meta/cve-update-db-native.bb
+++ b/meta/recipes-core/meta/cve-update-db-native.bb
@@ -13,6 +13,9 @@ deltask do_install
13deltask do_populate_sysroot 13deltask do_populate_sysroot
14 14
15NVDCVE_URL ?= "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-" 15NVDCVE_URL ?= "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-"
16# CVE database update interval, in seconds. By default: once a day (24*60*60).
17# Use 0 to force the update
18CVE_DB_UPDATE_INTERVAL ?= "86400"
16 19
17python () { 20python () {
18 if not bb.data.inherits_class("cve-check", d): 21 if not bb.data.inherits_class("cve-check", d):
@@ -44,11 +47,16 @@ python do_fetch() {
44 os.remove(db_file) 47 os.remove(db_file)
45 48
46 # The NVD database changes once a day, so no need to update more frequently 49 # The NVD database changes once a day, so no need to update more frequently
50 # Allow the user to force-update
47 try: 51 try:
48 import time 52 import time
49 if time.time() - os.path.getmtime(db_file) < (24*60*60): 53 update_interval = int(d.getVar("CVE_DB_UPDATE_INTERVAL"))
54 if (update_interval < 0):
55 update_interval = 0
56 if time.time() - os.path.getmtime(db_file) < update_interval:
50 bb.debug(2, "Recently updated, skipping") 57 bb.debug(2, "Recently updated, skipping")
51 return 58 return
59
52 except OSError: 60 except OSError:
53 pass 61 pass
54 62