diff options
author | Ross Burton <ross.burton@intel.com> | 2019-11-24 15:50:09 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-11-25 21:37:40 +0000 |
commit | 5dd9ef97d3d6a967e968dd47396d470bfb1815ff (patch) | |
tree | 3a15193750516de25cf07eb65d1da15677244443 /meta | |
parent | 9971e87cad577d06f573ce9793f3141c1420f690 (diff) | |
download | poky-5dd9ef97d3d6a967e968dd47396d470bfb1815ff.tar.gz |
cve-update-db-native: don't refresh more than once an hour
We already fetch the yearly CVE metadata and check that for updates before
downloading the full data, but we can speed up CVE checking further by only
checking the CVE metadata once an hour.
(From OE-Core rev: 50d898fd360c58fe85460517d965f62b7654771a)
(From OE-Core rev: f9e9107dbe23293eb96e049d7f821d2e33c23f06)
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/recipes-core/meta/cve-update-db-native.bb | 10 |
1 files changed, 9 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 2c427a5884..19875a49b1 100644 --- a/meta/recipes-core/meta/cve-update-db-native.bb +++ b/meta/recipes-core/meta/cve-update-db-native.bb | |||
@@ -31,8 +31,16 @@ python do_populate_cve_db() { | |||
31 | db_dir = os.path.join(d.getVar("DL_DIR"), 'CVE_CHECK') | 31 | db_dir = os.path.join(d.getVar("DL_DIR"), 'CVE_CHECK') |
32 | db_file = os.path.join(db_dir, 'nvdcve_1.0.db') | 32 | db_file = os.path.join(db_dir, 'nvdcve_1.0.db') |
33 | json_tmpfile = os.path.join(db_dir, 'nvd.json.gz') | 33 | json_tmpfile = os.path.join(db_dir, 'nvd.json.gz') |
34 | proxy = d.getVar("https_proxy") | ||
35 | 34 | ||
35 | # Don't refresh the database more than once an hour | ||
36 | try: | ||
37 | import time | ||
38 | if time.time() - os.path.getmtime(db_file) < (60*60): | ||
39 | return | ||
40 | except OSError: | ||
41 | pass | ||
42 | |||
43 | proxy = d.getVar("https_proxy") | ||
36 | if proxy: | 44 | if proxy: |
37 | # instantiate an opener but do not install it as the global | 45 | # instantiate an opener but do not install it as the global |
38 | # opener unless if we're really sure it's applicable for all | 46 | # opener unless if we're really sure it's applicable for all |