from daklib import utils
from daklib import daklog
from daklib.config import Config
+from daklib.dbconn import get_policy_queue
################################################################################
# Move to the directory to clean
incoming = Options["Incoming"]
if incoming == "":
- incoming = cnf["Dir::Queue::Unchecked"]
- os.chdir(incoming)
+ incoming_queue = get_policy_queue('unchecked')
+ if not incoming_queue:
+ utils.fubar("Cannot find 'unchecked' queue")
+ incoming = incoming_queue.path
+
+ try:
+ os.chdir(incoming)
+ except OSError, e:
+ utils.fubar("Cannot chdir to %s" % incoming)
# Remove a file to the morgue
def remove (from_dir, f):
for f in files.keys():
if f.endswith(".dsc"):
try:
- dsc = utils.parse_changes(f)
+ dsc = utils.parse_changes(f, dsc_file=1)
dsc_files = utils.build_file_list(dsc, is_a_dsc=1)
except:
utils.warn("error processing '%s'; skipping it. [Got %s]" % (f, sys.exc_type))
if Options["Help"]:
usage()
- Logger = daklog.Logger(cnf, 'clean-queues', Options['No-Action'])
+ Logger = daklog.Logger('clean-queues', Options['No-Action'])
init(cnf)
print "Processing incoming..."
flush_orphans()
- reject = cnf["Dir::Queue::Reject"]
+ reject = cnf["Dir::Reject"]
if os.path.exists(reject) and os.path.isdir(reject):
if Options["Verbose"]:
- print "Processing incoming/REJECT..."
+ print "Processing reject directory..."
os.chdir(reject)
flush_old()