X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fprocess_upload.py;h=4d1cbc2f6677da8d5ae58fe4c05ea2beef6b97f6;hb=62edab0e5b8e6290e0cc0dd3186084142e5e0b82;hp=ab9a3197ddc199ebe34a1eed5d5e24b6897ce9ae;hpb=b7f4f39d244e3282303015c9ff4a116252a64613;p=dak.git diff --git a/dak/process_upload.py b/dak/process_upload.py index ab9a3197..4d1cbc2f 100755 --- a/dak/process_upload.py +++ b/dak/process_upload.py @@ -196,6 +196,15 @@ def usage (exit_code=0): ############################################################################### +def byebye(): + if not Options["No-Action"]: + # Clean out the queue files + session = DBConn().session() + session.execute("DELETE FROM changes_pending_files WHERE id NOT IN (SELECT file_id FROM changes_pending_files_map )") + session.commit() + + + def action(u, session): cnf = Config() holding = Holding() @@ -249,7 +258,7 @@ def action(u, session): for s in u.pkg.changes["distribution"].keys(): suite = get_suite(s, session) if suite.policy_queue: - if not chg or chg.approved_for_id != su.policy_queue.policy_queue_id: + if not chg or chg.approved_for_id != suite.policy_queue.policy_queue_id: # This routine will check whether the upload is a binary # upload when the source is already in the target suite. If # so, we skip the policy queue, otherwise we go there. @@ -284,6 +293,7 @@ def action(u, session): elif answer == 'A': if not chg: chg = u.pkg.add_known_changes(holding.holding_dir, session=session) + session.commit() u.accept(summary, short_summary, session) u.check_override() chg.clean_from_queue() @@ -293,17 +303,16 @@ def action(u, session): if not chg: chg = u.pkg.add_known_changes(holding.holding_dir, session=session) package_to_queue(u, summary, short_summary, policyqueue, chg, session) - chg.upload_into_db(u, holding.holding_dir) session.commit() u.remove() elif answer == queuekey: if not chg: chg = u.pkg.add_known_changes(holding.holding_dir, session=session) QueueInfo[qu]["process"](u, summary, short_summary, chg, session) - chg.upload_into_db(u, holding.holding_dir) session.commit() u.remove() elif answer == 'Q': + byebye() sys.exit(0) session.commit() @@ -484,14 +493,12 @@ def main(): utils.size_type(int(summarystats.accept_bytes))) Logger.log(["total", summarystats.accept_count, summarystats.accept_bytes]) - if not Options["No-Action"]: - # Clean out the queue files - session = DBConn().session() - session.execute("DELETE FROM changes_pending_files WHERE id NOT IN (SELECT file_id FROM changes_pending_files_map )") - session.commit() + byebye() + if not Options["No-Action"]: if log_urgency: UrgencyLog().close() + Logger.close() ###############################################################################