pld-builder.new: PLD_Builder/request_handler.py Unlock after finishing.

arekm arekm at pld-linux.org
Sun Feb 8 16:20:14 CET 2009


Author: arekm                        Date: Sun Feb  8 15:20:14 2009 GMT
Module: pld-builder.new               Tag: HEAD
---- Log message:
Unlock after finishing.

---- Files affected:
pld-builder.new/PLD_Builder:
   request_handler.py (1.41 -> 1.42) 

---- Diffs:

================================================================
Index: pld-builder.new/PLD_Builder/request_handler.py
diff -u pld-builder.new/PLD_Builder/request_handler.py:1.41 pld-builder.new/PLD_Builder/request_handler.py:1.42
--- pld-builder.new/PLD_Builder/request_handler.py:1.41	Fri Feb  6 14:57:03 2009
+++ pld-builder.new/PLD_Builder/request_handler.py	Sun Feb  8 16:20:09 2009
@@ -38,6 +38,7 @@
     return 0
 
 def handle_group(r, user):
+    lockf = None
     def fail_mail(msg):
         if len(r.batches) >= 1:
             spec = r.batches[0].spec
@@ -49,8 +50,9 @@
         m.write_line(msg)
         m.send()
     
-    lock("request")
+    lockf = lock("request")
     if check_double_id(r.id):
+        lockf.close()
         return
         
 
@@ -58,15 +60,18 @@
         if not user.can_do("src", config.builder, batch.branch):
             fail_mail("user %s is not allowed to src:%s:%s" \
                         % (user.get_login(), config.builder, batch.branch))
+            lockf.close()
             return
 
         if 'test-build' in r.flags and 'upgrade' in r.flags:
             fail_mail("it's forbidden to upgrade from a test build")
+            lockf.close()
             return
 
         if "upgrade" in r.flags and not user.can_do("upgrade", config.builder, batch.branch):
             fail_mail("user %s is not allowed to upgrade:%s:%s" \
                         % (user.get_login(), config.builder, batch.branch))
+            lockf.close()
             return
 
         batch.expand_builders(config.binary_builders)
@@ -77,11 +82,13 @@
             if bld not in config.binary_builders and bld != config.builder:
                 fail_mail("I (src rpm builder '%s') do not handle binary builder '%s', only '%s'" % \
                         (config.builder, bld, string.join(config.binary_builders)))
+                lockf.close()
                 return
             if batch.is_command():
                 if not user.can_do("command", bld):
                     fail_mail("user %s is not allowed to command:%s" \
                                 % (user.get_login(), bld))
+                    lockf.close()
                     return
             elif not user.can_do("binary", bld, batch.branch):
                 pkg = batch.spec
@@ -90,6 +97,7 @@
                 if not user.can_do("binary-" + pkg, bld, batch.branch):
                     fail_mail("user %s is not allowed to binary-%s:%s:%s" \
                                 % (user.get_login(), pkg, bld, batch.branch))
+                    lockf.close()
                     return
     
     r.priority = user.check_priority(r.priority,config.builder)
@@ -103,6 +111,7 @@
     q.add(r)
     q.write()
     q.unlock()
+    lockf.close()
 
 def handle_notification(r, user):
     if not user.can_do("notify", r.builder):
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/pld-builder.new/PLD_Builder/request_handler.py?r1=1.41&r2=1.42&f=u



More information about the pld-cvs-commit mailing list