summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Marko <peter.marko@siemens.com>2025-08-24 16:57:40 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-08-28 10:47:08 +0100
commit42b14b33d0a2354de6efe0b60328886bb353ded0 (patch)
tree2a2e5b8b40bf0876399d7cabe19031ba0a1a136a
parent892b934e5548706abd76bec31bc037b7b929322e (diff)
downloadpoky-42b14b33d0a2354de6efe0b60328886bb353ded0.tar.gz
cve-update-db-native: Handle BB_NO_NETWORK and missing db
OE-Core rev: 337c0806d2784d74bee8d6420fb8b4d48795d5fa This commit was not applied on nvd1/fkie fetcher. (From OE-Core rev: 749c8e266ded2fa81e0e0ebbfa8f1ba164a062f2) Signed-off-by: Peter Marko <peter.marko@siemens.com> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-core/meta/cve-update-db-native.bb5
1 files changed, 5 insertions, 0 deletions
diff --git a/meta/recipes-core/meta/cve-update-db-native.bb b/meta/recipes-core/meta/cve-update-db-native.bb
index 70bef2179f..fe7b8a017f 100644
--- a/meta/recipes-core/meta/cve-update-db-native.bb
+++ b/meta/recipes-core/meta/cve-update-db-native.bb
@@ -54,6 +54,8 @@ python do_fetch() {
54 update_interval = int(d.getVar("CVE_DB_UPDATE_INTERVAL")) 54 update_interval = int(d.getVar("CVE_DB_UPDATE_INTERVAL"))
55 if update_interval < 0: 55 if update_interval < 0:
56 bb.note("CVE database update skipped") 56 bb.note("CVE database update skipped")
57 if not os.path.exists(db_file):
58 bb.error("CVE database %s not present, database fetch/update skipped" % db_file)
57 return 59 return
58 if time.time() - os.path.getmtime(db_file) < update_interval: 60 if time.time() - os.path.getmtime(db_file) < update_interval:
59 bb.debug(2, "Recently updated, skipping") 61 bb.debug(2, "Recently updated, skipping")
@@ -62,6 +64,9 @@ python do_fetch() {
62 except OSError: 64 except OSError:
63 pass 65 pass
64 66
67 if bb.utils.to_boolean(d.getVar("BB_NO_NETWORK")):
68 bb.error("BB_NO_NETWORK attempted to disable fetch, this recipe uses CVE_DB_UPDATE_INTERVAL to control download, set to '-1' to disable fetch or update")
69
65 bb.utils.mkdirhier(db_dir) 70 bb.utils.mkdirhier(db_dir)
66 bb.utils.mkdirhier(os.path.dirname(db_tmp_file)) 71 bb.utils.mkdirhier(os.path.dirname(db_tmp_file))
67 if os.path.exists(db_file): 72 if os.path.exists(db_file):