diff options
| -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 c2f713312f..242fbc2f30 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 | |||
| 15 | python () { | 15 | python () { |
| 16 | if not bb.data.inherits_class("cve-check", d): | 16 | if not bb.data.inherits_class("cve-check", d): |
| 17 | raise bb.parse.SkipRecipe("Skip recipe when cve-check class is not loaded.") | 17 | raise bb.parse.SkipRecipe("Skip recipe when cve-check class is not loaded.") |
| 18 | |||
| 19 | if os.path.exists("%s-journal" % cve_check_db_file ): | ||
| 20 | os.remove("%s-journal" % cve_check_db_file) | ||
| 21 | |||
| 22 | if os.path.exists(cve_check_db_file): | ||
| 23 | os.remove(cve_check_db_file) | ||
| 24 | } | 18 | } |
| 25 | 19 | ||
| 26 | python do_fetch() { | 20 | python do_fetch() { |
| @@ -41,6 +35,14 @@ python do_fetch() { | |||
| 41 | db_dir = os.path.dirname(db_file) | 35 | db_dir = os.path.dirname(db_file) |
| 42 | json_tmpfile = os.path.join(db_dir, 'nvd.json.gz') | 36 | json_tmpfile = os.path.join(db_dir, 'nvd.json.gz') |
| 43 | 37 | ||
| 38 | if os.path.exists("{0}-journal".format(db_file)): | ||
| 39 | # If a journal is present the last update might have been interrupted. In that case, | ||
| 40 | # just wipe any leftovers and force the DB to be recreated. | ||
| 41 | os.remove("{0}-journal".format(db_file)) | ||
| 42 | |||
| 43 | if os.path.exists(db_file): | ||
| 44 | os.remove(db_file) | ||
| 45 | |||
| 44 | # Don't refresh the database more than once an hour | 46 | # Don't refresh the database more than once an hour |
| 45 | try: | 47 | try: |
| 46 | import time | 48 | import time |
