Author: fw
Date: 2005-09-15 15:00:32 +0000 (Thu, 15 Sep 2005)
New Revision: 2000
Modified:
bin/update-db
Log:
Commit early if we are creating a new file. This means that the work is
not wasted if an error occurs later.
Modified: bin/update-db
==================================================================---
bin/update-db 2005-09-15 14:51:30 UTC (rev 1999)
+++ bin/update-db 2005-09-15 15:00:32 UTC (rev 2000)
@@ -25,9 +25,11 @@
db_file = ''data/security.db''
try:
db = security_db.DB(db_file, verbose=True)
+ new_file = False
except security_db.SchemaMismatch:
os.unlink(db_file)
db = security_db.DB(db_file, verbose=True)
+ new_file = True
cursor = db.writeTxn()
@@ -51,6 +53,10 @@
db.readPackages(cursor, ''data/packages'')
+if new_file:
+ db.commit(cursor)
+ cursor = db.writeTxn()
+
# Calculate vulnerability information.
warnings = db.calculateVulnerabilities(cursor)