diff options
Diffstat (limited to 'meta/recipes-core/meta/cve-update-db-native.bb')
-rw-r--r-- | meta/recipes-core/meta/cve-update-db-native.bb | 11 |
1 files changed, 10 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 a6144979f0..594bf947c8 100644 --- a/meta/recipes-core/meta/cve-update-db-native.bb +++ b/meta/recipes-core/meta/cve-update-db-native.bb | |||
@@ -12,6 +12,10 @@ deltask do_compile | |||
12 | deltask do_install | 12 | deltask do_install |
13 | deltask do_populate_sysroot | 13 | deltask do_populate_sysroot |
14 | 14 | ||
15 | # CVE database update interval, in seconds. By default: once a day (24*60*60). | ||
16 | # Use 0 to force the update | ||
17 | CVE_DB_UPDATE_INTERVAL ?= "86400" | ||
18 | |||
15 | python () { | 19 | python () { |
16 | if not bb.data.inherits_class("cve-check", d): | 20 | if not bb.data.inherits_class("cve-check", d): |
17 | raise bb.parse.SkipRecipe("Skip recipe when cve-check class is not loaded.") | 21 | raise bb.parse.SkipRecipe("Skip recipe when cve-check class is not loaded.") |
@@ -43,10 +47,15 @@ python do_fetch() { | |||
43 | os.remove(db_file) | 47 | os.remove(db_file) |
44 | 48 | ||
45 | # 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 | ||
46 | try: | 51 | try: |
47 | import time | 52 | import time |
48 | 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: | ||
49 | return | 57 | return |
58 | |||
50 | except OSError: | 59 | except OSError: |
51 | pass | 60 | pass |
52 | 61 | ||