Add a new variable FORCE_CVE_DB_UPDATE allowing the user to force
the database update, if the default update frequency is too low.

Signed-off-by: Marta Rybczynska <marta.rybczyn...@huawei.com>
---
 meta/recipes-core/meta/cve-update-db-native.bb | 10 +++++++---
 1 file changed, 7 insertions(+), 3 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..d89f79f310 100644
--- a/meta/recipes-core/meta/cve-update-db-native.bb
+++ b/meta/recipes-core/meta/cve-update-db-native.bb
@@ -13,6 +13,7 @@ deltask do_install
 deltask do_populate_sysroot
 
 NVDCVE_URL ?= "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-";
+FORCE_CVE_DB_UPDATE ?= "0"
 
 python () {
     if not bb.data.inherits_class("cve-check", d):
@@ -44,11 +45,14 @@ python do_fetch() {
             os.remove(db_file)
 
     # 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) < (24*60*60):
-            bb.debug(2, "Recently updated, skipping")
-            return
+        if d.getVar("FORCE_CVE_DB_UPDATE") == "0":
+            if time.time() - os.path.getmtime(db_file) < (24*60*60):
+                bb.debug(2, "Recently updated, skipping")
+                return
+
     except OSError:
         pass
 
-- 
2.33.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#164993): 
https://lists.openembedded.org/g/openembedded-core/message/164993
Mute This Topic: https://lists.openembedded.org/mt/90771095/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to