From: Ansgar Burchardt Date: Fri, 3 Aug 2012 14:11:47 +0000 (+0200) Subject: daklib/archive.py, daklib/checks.py: implement upload blocks X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d066a0848f6c48e0e49d826b5edcf025e5f88957;p=dak daklib/archive.py, daklib/checks.py: implement upload blocks --- diff --git a/daklib/archive.py b/daklib/archive.py index b96b9892..6024e3e8 100644 --- a/daklib/archive.py +++ b/daklib/archive.py @@ -795,6 +795,7 @@ class ArchiveUpload(object): for chk in ( checks.SignatureCheck, checks.ChangesCheck, + checks.UploadBlockCheck, checks.HashesCheck, checks.SourceCheck, checks.BinaryCheck, diff --git a/daklib/checks.py b/daklib/checks.py index 3895bb29..d05c71fd 100644 --- a/daklib/checks.py +++ b/daklib/checks.py @@ -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