+2008-12-29 Michael Casadevall <sonicmctails@gmail.com>
+
+ * dak/update_db.py - Modified to use the lockfile and uncommented sleep() call
+
2008-12-28 Michael Casadevall <sonicmctails@gmail.com>
* dak/process_unchecked.py - Modified DM to comply strictly with the DM GR
################################################################################
-import psycopg2, sys
+import psycopg2, sys, fcntl, os
import apt_pkg
import time
from daklib import database
utils.warn("dak update-db takes no arguments.")
usage(exit_code=1)
+
self.update_db()
+ try:
+ lock_fd = os.open(Cnf["Dinstall::LockFile"], os.O_RDWR | os.O_CREAT)
+ fcntl.lockf(lock_fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
+ except IOError, e:
+ if errno.errorcode[e.errno] == 'EACCES' or errno.errorcode[e.errno] == 'EAGAIN':
+ utils.fubar("Couldn't obtain lock; assuming another 'dak process-unchecked' is already running.")
+
+
################################################################################
if __name__ == '__main__':