Fix parsing of WHENCE file listing multiple binary files in a group

svn path=/dists/sid/linux-2.6/; revision=18934
This commit is contained in:
Ben Hutchings 2012-04-16 05:00:41 +00:00
parent 694fb17c47
commit da95316282
1 changed files with 11 additions and 7 deletions

View File

@ -25,7 +25,7 @@ class FirmwareWhence(list):
driver = None driver = None
files = {} files = {}
licence = None licence = None
binary = None binary = []
desc = None desc = None
source = [] source = []
version = None version = None
@ -48,9 +48,13 @@ class FirmwareWhence(list):
if line == '\n': if line == '\n':
# End of field; end of file fields # End of field; end of file fields
if binary: for b in binary:
files[binary] = FirmwareFile(binary, desc, source, version) # XXX The WHENCE file isn't yet consistent in its
binary = None # association of binaries and their sources and
# metadata. This associates all sources and
# metadata in a group with each binary.
files[b] = FirmwareFile(b, desc, source, version)
binary = []
desc = None desc = None
source = [] source = []
version = None version = None
@ -66,7 +70,7 @@ class FirmwareWhence(list):
driver = value.split(' ')[0].lower() driver = value.split(' ')[0].lower()
elif keyword == 'File': elif keyword == 'File':
match = re.match(r'(\S+)(?:\s+--\s+(.*))?', value) match = re.match(r'(\S+)(?:\s+--\s+(.*))?', value)
binary = match.group(1) binary.append(match.group(1))
desc = match.group(2) desc = match.group(2)
elif keyword in ['Info', 'Version']: elif keyword in ['Info', 'Version']:
version = value version = value
@ -79,7 +83,7 @@ class FirmwareWhence(list):
re.sub(r'^(?:[/ ]\*| \*/)?\s*(.*?)\s*$', r'\1', line)) re.sub(r'^(?:[/ ]\*| \*/)?\s*(.*?)\s*$', r'\1', line))
# Finish last section if non-empty # Finish last section if non-empty
if binary: for b in binary:
files[binary] = FirmwareFile(binary, desc, source, version) files[b] = FirmwareFile(b, desc, source, version)
if driver: if driver:
self.append(FirmwareSection(driver, files, licence)) self.append(FirmwareSection(driver, files, licence))