From: Mark Hymers Date: Sun, 15 Nov 2009 18:27:46 +0000 (+0000) Subject: make p-u clear out queue information from the tables X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=92aa9900e274b4c0ca24d1ae3a7cbabca0d21c5f;p=dak make p-u clear out queue information from the tables Signed-off-by: Mark Hymers --- diff --git a/dak/process_upload.py b/dak/process_upload.py index ec7fbd35..33fff0dc 100755 --- a/dak/process_upload.py +++ b/dak/process_upload.py @@ -286,6 +286,7 @@ def action(u, session): chg = u.pkg.add_known_changes(holding.holding_dir, session=session) u.accept(summary, short_summary, session) u.check_override() + chg.clean_from_queue() session.commit() u.remove() elif answer == 'P': @@ -482,6 +483,11 @@ def main(): 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() + if log_urgency: UrgencyLog().close() Logger.close() diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 7388208e..7047f59b 100644 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -1437,6 +1437,21 @@ class DBChange(object): def __repr__(self): return '' % self.changesname + def clean_from_queue(self): + session = DBConn().session().object_session(self) + + # Remove changes_pool_files entries + for pf in self.poolfiles: + self.poolfiles.remove(pf) + + # Remove change + for cf in self.files: + self.files.remove(cf) + + # Clear out of queue + self.in_queue = None + self.approved_for_id = None + __all__.append('DBChange') @session_wrapper