Commit 4c22c773 authored by Guillem Jover's avatar Guillem Jover

Only require the .changes Binary and Description fields on binary uploads

For source-only uploads the fields should have been empty all along,
because there are no binary packages to include, but dpkg-genchanges
has incorrectly included all binary names that can be produced from
the debian/control template file (see #818618). Although DAK allows
an empty Binary field, the correct behavior should be for the field
to not be present if there are not binary packages to upload.
parent 269dd15d
......@@ -230,10 +230,15 @@ class ChangesCheck(Check):
control = changes.changes
fn = changes.filename
for field in ('Distribution', 'Source', 'Binary', 'Architecture', 'Version', 'Maintainer', 'Files', 'Changes', 'Description'):
for field in ('Distribution', 'Source', 'Architecture', 'Version', 'Maintainer', 'Files', 'Changes'):
if field not in control:
raise Reject('{0}: misses mandatory field {1}'.format(fn, field))
if len(changes.binaries) > 0:
for field in ('Binary', 'Description'):
if field not in control:
raise Reject('{0}: binary upload requires {1} field'.format(fn, 'Binary'))
check_fields_for_valid_utf8(fn, control)
source_match = re_field_source.match(control['Source'])
......@@ -426,7 +426,7 @@ class Changes(object):
"""names of included binary packages
@type: list of str
return self.changes['Binary'].split()
return self.changes.get('Binary', '').split()
def closed_bugs(self):
......@@ -273,8 +273,8 @@ def parse_changes(filename, signing_rules=0, dsc_file=0, keyrings=None):
if not dsc_file:
# Finally ensure that everything needed for .changes is there
must_keywords = ('Format', 'Date', 'Source', 'Binary', 'Architecture', 'Version',
'Distribution', 'Maintainer', 'Description', 'Changes', 'Files')
must_keywords = ('Format', 'Date', 'Source', 'Architecture', 'Version',
'Distribution', 'Maintainer', 'Changes', 'Files')
missingfields = []
for keyword in must_keywords:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment