]> git.decadent.org.uk Git - dak.git/commitdiff
daklib/archive.py, daklib/checks.py: implement upload blocks
authorAnsgar Burchardt <ansgar@debian.org>
Fri, 3 Aug 2012 14:11:47 +0000 (16:11 +0200)
committerAnsgar Burchardt <ansgar@debian.org>
Thu, 9 Aug 2012 14:42:57 +0000 (16:42 +0200)
daklib/archive.py
daklib/checks.py

index b96b98924b837035e83b7f1e107157bbc174fcb2..6024e3e8d930f68ffac7d7d76d044409c8f8ea2e 100644 (file)
@@ -795,6 +795,7 @@ class ArchiveUpload(object):
             for chk in (
                     checks.SignatureCheck,
                     checks.ChangesCheck,
+                    checks.UploadBlockCheck,
                     checks.HashesCheck,
                     checks.SourceCheck,
                     checks.BinaryCheck,
index 3895bb29fef044e90c3758c6fcd8c9119fd3fc53..d05c71fdaf66a51ac2fded6123702d7786a57724 100644 (file)
@@ -438,6 +438,25 @@ class ACLCheck(Check):
 
         return True
 
+class UploadBlockCheck(Check):
+    """check for upload blocks"""
+    def check(self, upload):
+        session = upload.session
+        control = upload.changes.changes
+
+        source = re_field_source.match(control['Source']).group('package')
+        version = control['Version']
+        blocks = session.query(UploadBlock).filter_by(source=source) \
+                        .filter((UploadBlock.version == version) | (UploadBlock.version == None))
+
+        for block in blocks:
+            if block.fingerprint == upload.fingerprint:
+                raise Reject('Manual upload block in place for package {0} and fingerprint {1}:\n{2}'.format(source, upload.fingerprint.fingerprint, block.reason))
+            if block.uid == upload.fingerprint.uid:
+                raise Reject('Manual upload block in place for package {0} and uid {1}:\n{2}'.format(source, block.uid.uid, block.reason))
+
+        return True
+
 class NoSourceOnlyCheck(Check):
     """Check for source-only upload