diff options
author | Chris Laplante <chris.laplante@agilent.com> | 2020-09-14 11:33:19 -0400 |
---|---|---|
committer | Steve Sakoman <steve@sakoman.com> | 2020-09-28 07:55:37 -1000 |
commit | 0e11c37e49272b967010df7dcebbe73a76f70edb (patch) | |
tree | 945e657aa858086abd53fa69cb0af8d41087ed7c | |
parent | ec2a17001a2a0180ecdb0b946ff8f7673e14ba24 (diff) | |
download | openembedded-core-contrib-0e11c37e49272b967010df7dcebbe73a76f70edb.tar.gz |
cve-update-db-native: move -journal checking into do_fetch
It was always questionable to do this in an anonymous function, but now
with multiconfig it is a critical mistake and leads to more strange
"Exception: sqlite3.OperationalError: disk I/O error" errors.
Signed-off-by: Chris Laplante <chris.laplante@agilent.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit fcbc9d0e8421a3a559db05005ba042337cd5d864)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r-- | meta/recipes-core/meta/cve-update-db-native.bb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/meta/recipes-core/meta/cve-update-db-native.bb b/meta/recipes-core/meta/cve-update-db-native.bb index 2c0e508e32..73da8ae6a2 100644 --- a/meta/recipes-core/meta/cve-update-db-native.bb +++ b/meta/recipes-core/meta/cve-update-db-native.bb @@ -15,12 +15,6 @@ deltask do_populate_sysroot python () { if not bb.data.inherits_class("cve-check", d): raise bb.parse.SkipRecipe("Skip recipe when cve-check class is not loaded.") - - if os.path.exists("%s-journal" % cve_check_db_file ): - os.remove("%s-journal" % cve_check_db_file) - - if os.path.exists(cve_check_db_file): - os.remove(cve_check_db_file) } python do_populate_cve_db() { @@ -41,6 +35,14 @@ python do_populate_cve_db() { db_dir = os.path.dirname(db_file) json_tmpfile = os.path.join(db_dir, 'nvd.json.gz') + if os.path.exists("{0}-journal".format(db_file)): + # If a journal is present the last update might have been interrupted. In that case, + # just wipe any leftovers and force the DB to be recreated. + os.remove("{0}-journal".format(db_file)) + + if os.path.exists(db_file): + os.remove(db_file) + # Don't refresh the database more than once an hour try: import time |