diff options
author | Marta Rybczynska <rybczynska@gmail.com> | 2022-06-03 11:09:56 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-06-11 10:06:13 +0100 |
commit | 9661c7eb07663007fe044ad7bacca17aad4a3242 (patch) | |
tree | 979da7d246ba86c14371d0dcf95a73163dbde5ef /meta/recipes-core | |
parent | 50ee11d88fb02cc246c2034890210d7b940844bb (diff) | |
download | poky-9661c7eb07663007fe044ad7bacca17aad4a3242.tar.gz |
cve-update-db-native: make it possible to disable database updates
Make it possible to disable the database update completely by using
a negative update interval CVE_DB_UPDATE_INTERVAL.
Disabling the update is useful when running multiple parallel builds
when we want to have a control on the database version. This allows
coherent cve-check results without an database update for only
some of the builds.
(From OE-Core rev: ac6b4900bc0d8b4554f666de8d9d041653935a03)
Signed-off-by: Marta Rybczynska <marta.rybczynska@huawei.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit b5c2269240327c2a8f93b9e55354698f52c976f3)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
-rw-r--r-- | meta/recipes-core/meta/cve-update-db-native.bb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/meta/recipes-core/meta/cve-update-db-native.bb b/meta/recipes-core/meta/cve-update-db-native.bb index c8c1cbf115..18af89b53e 100644 --- a/meta/recipes-core/meta/cve-update-db-native.bb +++ b/meta/recipes-core/meta/cve-update-db-native.bb | |||
@@ -15,6 +15,7 @@ deltask do_populate_sysroot | |||
15 | NVDCVE_URL ?= "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-" | 15 | NVDCVE_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). | 16 | # CVE database update interval, in seconds. By default: once a day (24*60*60). |
17 | # Use 0 to force the update | 17 | # Use 0 to force the update |
18 | # Use a negative value to skip the update | ||
18 | CVE_DB_UPDATE_INTERVAL ?= "86400" | 19 | CVE_DB_UPDATE_INTERVAL ?= "86400" |
19 | 20 | ||
20 | python () { | 21 | python () { |
@@ -51,8 +52,9 @@ python do_fetch() { | |||
51 | try: | 52 | try: |
52 | import time | 53 | import time |
53 | update_interval = int(d.getVar("CVE_DB_UPDATE_INTERVAL")) | 54 | update_interval = int(d.getVar("CVE_DB_UPDATE_INTERVAL")) |
54 | if (update_interval < 0): | 55 | if update_interval < 0: |
55 | update_interval = 0 | 56 | bb.note("CVE database update skipped") |
57 | return | ||
56 | if time.time() - os.path.getmtime(db_file) < update_interval: | 58 | if time.time() - os.path.getmtime(db_file) < update_interval: |
57 | bb.debug(2, "Recently updated, skipping") | 59 | bb.debug(2, "Recently updated, skipping") |
58 | return | 60 | return |