diff --git a/daklib/checks.py b/daklib/checks.py index 673886abf2c75c342f4991dde46e32a90154eb26..86c463cb9b9c40b305a51c49c2dc393a2145e633 100644 --- a/daklib/checks.py +++ b/daklib/checks.py @@ -334,9 +334,17 @@ class BinaryCheck(Check): debug_deb_name_postfix = "-dbgsym" # XXX: Handle dynamic debug section name here + self._architectures = set() + for binary in upload.changes.binaries: self.check_binary(upload, binary) + for arch in upload.changes.architectures: + if arch == 'source': + continue + if arch not in self._architectures: + raise Reject('{}: Architecture field includes {}, but no binary packages for {} are included in the upload'.format(upload.changes.filename, arch, arch)) + binaries = {binary.control['Package']: binary for binary in upload.changes.binaries} @@ -396,6 +404,7 @@ class BinaryCheck(Check): raise Reject('{0}: Architecture not in Architecture field in changes file'.format(fn)) if architecture == 'source': raise Reject('{0}: Architecture "source" invalid for binary packages'.format(fn)) + self._architectures.add(architecture) source = control.get('Source') if source is not None and not re_field_source.match(source): @@ -506,8 +515,13 @@ class SourceCheck(Check): def check(self, upload): if upload.changes.source is None: + if "source" in upload.changes.architectures: + raise Reject("{}: Architecture field includes source, but no source package is included in the upload".format(upload.changes.filename)) return True + if "source" not in upload.changes.architectures: + raise Reject("{}: Architecture field does not include source, but a source package is included in the upload".format(upload.changes.filename)) + changes = upload.changes.changes source = upload.changes.source control = source.dsc