summaryrefslogtreecommitdiff
path: root/poky/meta/recipes-core/meta/cve-update-db-native.bb
diff options
context:
space:
mode:
Diffstat (limited to 'poky/meta/recipes-core/meta/cve-update-db-native.bb')
-rw-r--r--poky/meta/recipes-core/meta/cve-update-db-native.bb15
1 files changed, 13 insertions, 2 deletions
diff --git a/poky/meta/recipes-core/meta/cve-update-db-native.bb b/poky/meta/recipes-core/meta/cve-update-db-native.bb
index 50052f8532..a49f446a53 100644
--- a/poky/meta/recipes-core/meta/cve-update-db-native.bb
+++ b/poky/meta/recipes-core/meta/cve-update-db-native.bb
@@ -12,6 +12,11 @@ deltask do_compile
deltask do_install
deltask do_populate_sysroot
+# CVE database update interval, in seconds. By default: once a day (24*60*60).
+# Use 0 to force the update
+# Use a negative value to skip the update
+CVE_DB_UPDATE_INTERVAL ?= "86400"
+
python () {
if not bb.data.inherits_class("cve-check", d):
raise bb.parse.SkipRecipe("Skip recipe when cve-check class is not loaded.")
@@ -42,11 +47,17 @@ python do_fetch() {
if os.path.exists(db_file):
os.remove(db_file)
- # Don't refresh the database more than once an hour
+ # The NVD database changes once a day, so no need to update more frequently
+ # Allow the user to force-update
try:
import time
- if time.time() - os.path.getmtime(db_file) < (60*60):
+ update_interval = int(d.getVar("CVE_DB_UPDATE_INTERVAL"))
+ if update_interval < 0:
+ bb.note("CVE database update skipped")
+ return
+ if time.time() - os.path.getmtime(db_file) < update_interval:
return
+
except OSError:
pass