make sure the .changes Architecture field is correct

Some other checks use it to see which architectures are included, for
example the previous commit.
上级 7d234eaa
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册