]> git.decadent.org.uk Git - dak.git/commitdiff
process-upload: try to use the same session all over the code
authorFrank Lichtenheld <djpig@debian.org>
Fri, 30 Oct 2009 22:11:21 +0000 (22:11 +0000)
committerFrank Lichtenheld <djpig@debian.org>
Fri, 30 Oct 2009 22:11:21 +0000 (22:11 +0000)
Signed-off-by: Frank Lichtenheld <djpig@debian.org>
dak/process_upload.py
daklib/queue.py
daklib/queue_install.py

index 9bb04a33e8b76c6c70bc89909b035f96b5bbd4c8..cf1594a3098ba0d164e10b10b7cad49290fbeb23 100755 (executable)
@@ -217,21 +217,25 @@ def action(u):
             answer = m.group(1)
         answer = answer[:1].upper()
 
+    session = DBConn().session()
+
     if answer == 'R':
         os.chdir(u.pkg.directory)
         u.do_reject(0, pi)
     elif answer == 'A':
-        u.pkg.add_known_changes(holding.holding_dir)
-        u.accept(summary, short_summary)
+        u.pkg.add_known_changes(holding.holding_dir, session)
+        u.accept(summary, short_summary, session)
         u.check_override()
         u.remove()
     elif answer == queuekey:
-        u.pkg.add_known_changes(holding.holding_dir)
-        QueueInfo[qu]["process"](u, summary, short_summary)
+        u.pkg.add_known_changes(holding.holding_dir, session)
+        QueueInfo[qu]["process"](u, summary, short_summary, session)
         u.remove()
     elif answer == 'Q':
         sys.exit(0)
 
+    session.commit()
+
 ###############################################################################
 
 def cleanup():
index bfacbfaf197b5b89d115150fa3eb0d6396e24f50..be9451bcba4b27b9ce090d913b883bba143ae82e 100755 (executable)
@@ -1821,8 +1821,8 @@ distribution."""
         return summary
 
     ###########################################################################
-
-    def accept (self, summary, short_summary, session):
+    @session_wrapper
+    def accept (self, summary, short_summary, session=None):
         """
         Accept an upload.
 
index 5599661bc1fe77530c48b2759962da746865b0ff..9b78b264cdb14d4c3de0b04e971d890605dc53df 100644 (file)
@@ -127,7 +127,7 @@ def is_unembargo(u):
 
     return ret
 
-def queue_unembargo(u, summary, short_summary):
+def queue_unembargo(u, summary, short_summary, session=None):
     return package_to_queue(u, summary, short_summary, "Unembargoed",
                             perms=0660, build=True, announce='process-unchecked.accepted')
 
@@ -137,7 +137,7 @@ def is_embargo(u):
     # if embargoed queues are enabled always embargo
     return True
 
-def queue_embargo(u, summary, short_summary):
+def queue_embargo(u, summary, short_summary, session=None):
     return package_to_queue(u, summary, short_summary, "Unembargoed",
                             perms=0660, build=True, announce='process-unchecked.accepted')
 
@@ -146,7 +146,7 @@ def queue_embargo(u, summary, short_summary):
 def is_stableupdate(u):
     return package_to_suite(u, 'proposed-updates')
 
-def do_stableupdate(u, summary, short_summary):
+def do_stableupdate(u, summary, short_summary, session=None):
     return package_to_queue(u, summary, short_summary, "ProposedUpdates",
                             perms=0664, build=False, announce=None)
 
@@ -155,7 +155,7 @@ def do_stableupdate(u, summary, short_summary):
 def is_oldstableupdate(u):
     return package_to_suite(u, 'oldstable-proposed-updates')
 
-def do_oldstableupdate(u, summary, short_summary):
+def do_oldstableupdate(u, summary, short_summary, session=None):
     return package_to_queue(u, summary, short_summary, "OldProposedUpdates",
                             perms=0664, build=False, announce=None)
 
@@ -200,7 +200,7 @@ def is_autobyhand(u):
 
     return any_auto and all_auto
 
-def do_autobyhand(u, summary, short_summary):
+def do_autobyhand(u, summary, short_summary, session=None):
     print "Attempting AUTOBYHAND."
     byhandleft = True
     for f, entry in u.pkg.files.items():
@@ -230,12 +230,10 @@ def do_autobyhand(u, summary, short_summary):
             byhandleft = True
 
     if byhandleft:
-        do_byhand(u, summary, short_summary)
+        do_byhand(u, summary, short_summary, session)
     else:
-        u.accept(summary, short_summary)
+        u.accept(summary, short_summary, session)
         u.check_override()
-        # XXX: We seem to be missing a u.remove() here
-        #      This might explain why we get byhand leftovers in unchecked - mhy
 
 ################################################################################
 
@@ -245,7 +243,7 @@ def is_byhand(u):
             return True
     return False
 
-def do_byhand(u, summary, short_summary):
+def do_byhand(u, summary, short_summary, session=None):
     return package_to_queue(u, summary, short_summary, "Byhand",
                             perms=0660, build=False, announce=None)
 
@@ -257,7 +255,7 @@ def is_new(u):
             return True
     return False
 
-def acknowledge_new(u, summary, short_summary):
+def acknowledge_new(u, summary, short_summary, session=None):
     cnf = Config()
 
     print "Moving to NEW queue."