import os
import logging
import threading
-from daklib.dbconn import DBConn,get_knownchange
+from daklib.dbconn import DBConn, get_dbchange
from daklib.config import Config
import apt_pkg
from daklib.dak_exceptions import DBUpdateError, InvalidDscError, ChangesUnicodeError
keyrings = [
"/home/joerg/keyring/keyrings/debian-keyring.gpg",
- "/home/joerg/keyring/keyrings/debian-keyring.pgp",
"/home/joerg/keyring/keyrings/debian-maintainers.gpg",
"/home/joerg/keyring/keyrings/debian-role-keys.gpg",
"/home/joerg/keyring/keyrings/emeritus-keyring.pgp",
"""
def __init__(self):
self.next_in_line = None
- self.next_lock = threading.Condition()
+ self.read_lock = threading.Condition()
+ self.write_lock = threading.Condition()
self.die = False
def plsDie(self):
self.die = True
- self.next_lock.notify()
+ self.write_lock.acquire()
+ self.write_lock.notifyAll()
+ self.write_lock.release()
+
+ self.read_lock.acquire()
+ self.read_lock.notifyAll()
+ self.read_lock.release()
def enqueue(self, next):
- self.next_lock.acquire()
+ self.write_lock.acquire()
while self.next_in_line:
if self.die:
return
- self.next_lock.wait()
+ self.write_lock.wait()
assert( not self.next_in_line )
self.next_in_line = next
- self.next_lock.notify()
- self.next_lock.release()
+ self.write_lock.release()
+ self.read_lock.acquire()
+ self.read_lock.notify()
+ self.read_lock.release()
def dequeue(self):
- self.next_lock.acquire()
+ self.read_lock.acquire()
while not self.next_in_line:
if self.die:
return
- self.next_lock.wait()
+ self.read_lock.wait()
result = self.next_in_line
self.next_in_line = None
- self.next_lock.notify()
- self.next_lock.release()
+ self.read_lock.release()
+ self.write_lock.acquire()
+ self.write_lock.notify()
+ self.write_lock.release()
if isinstance(result, EndOfChanges):
return None
def run(self):
cnf = Config()
count = 1
- for directory in [ "Accepted", "Byhand", "Done", "New", "ProposedUpdates", "OldProposedUpdates" ]:
+ for directory in [ "Byhand", "Done", "New", "ProposedUpdates", "OldProposedUpdates" ]:
checkdir = cnf["Dir::Queue::%s" % (directory) ]
if os.path.exists(checkdir):
print "Looking into %s" % (checkdir)
continue
count += 1
- if not get_knownchange(changesfile, self.session):
+ if not get_dbchange(changesfile, self.session):
to_import = ChangesToImport(dirpath, changesfile, count)
if self.die:
return
changesfile = os.path.join(to_import.dirpath, to_import.changesfile)
changes.changes = parse_changes(changesfile, signing_rules=-1)
changes.changes["fingerprint"] = check_signature(changesfile)
- changes.add_known_changes(to_import.dirpath, self.session)
+ changes.add_known_changes(to_import.dirpath, session=self.session)
self.session.commit()
except InvalidDscError, line: