]> code.ossystems Code Review - openembedded-core.git/commitdiff
cve-update-db-native: clean DB if temporary file exist
authorLee Chee Yang <chee.yang.lee@intel.com>
Fri, 27 Mar 2020 03:57:43 +0000 (11:57 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 29 Mar 2020 19:03:30 +0000 (20:03 +0100)
when do_populate_cve_db forced stop at certain point, the
DB execution are stoped however the temporary database
file (DB-JOURNAL) are not removed. This db-journal file
indicates that DB is incomplete and set DB in readonly
mode. So when db-journal exist, remove both DB and the
db-journal and build the DB again from scratch.

[YOCTO #13682]

Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/meta/cve-update-db-native.bb

index 95a0dfcc9097f1ca0ed724faef5f24cadd504940..6afe09140b690de98143c3d5c472f824336ca9af 100644 (file)
@@ -13,8 +13,15 @@ deltask do_install
 deltask do_populate_sysroot
 
 python () {
-    if not d.getVar("CVE_CHECK_DB_FILE"):
+    cve_check_db_file = d.getVar("CVE_CHECK_DB_FILE")
+    if not cve_check_db_file:
         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() {