From 7e85e7beb8ed2bb5cab8707054554cec5cf05d4d Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Thu, 15 Sep 2005 15:00:32 +0000 Subject: Commit early if we are creating a new file. This means that the work is not wasted if an error occurs later. git-svn-id: svn+ssh://svn.debian.org/svn/secure-testing@2000 e39458fd-73e7-0310-bf30-c45bca0a0e42 --- bin/update-db | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'bin/update-db') diff --git a/bin/update-db b/bin/update-db index 273d9fa7e0..0c732cd4cb 100755 --- a/bin/update-db +++ b/bin/update-db @@ -25,9 +25,11 @@ import security_db 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 @@ if warnings: db.readPackages(cursor, 'data/packages') +if new_file: + db.commit(cursor) + cursor = db.writeTxn() + # Calculate vulnerability information. warnings = db.calculateVulnerabilities(cursor) -- cgit v1.2.3