2 # (c) 2010 Luca Falavigna <dktrkranz@debian.org>
3 # Free software licensed under the GPL version 2 or later
9 print 'Usage:\t./%s removal-file' % argv[0]
11 fd = open(argv[1], 'r')
14 removals = re.split('=\n=', data)
15 for removal in removals:
16 removal = re.sub('\n\n', '\n', removal)
17 date = re.search('\[Date: (.*)\]\s\[', removal).group(1)
18 ftpmaster = re.search('\[ftpmaster: (.*)]', removal).group(1)
19 suite = re.search('from ([^:]+):', removal).group(1)
20 packages = re.split('from [\S\s]+:\n', removal)[1].split('\n---')[0]
21 reason = re.split('---\n', removal)[1].split('\n---')[0]
22 bug = re.search('Closed bugs: (\d+)', removal)
23 print 'Date: %s' % date
24 print 'Ftpmaster: %s' % ftpmaster
25 print 'Suite: %s' % suite
28 for package in packages.split('\n'):
29 if package and not package.startswith('Closed bugs'):
30 for row in package.split('\n'):
31 element = row.split('|')
32 if element[2].find('source') > 0:
33 sources.append(' %s_%s' % tuple(elem.strip(' ') for elem in element[:2]))
34 element[2] = re.sub('source\s?,?', '', element[2]).strip(' ')
36 binaries.append(' %s_%s [%s]' % tuple(elem.strip(' ') for elem in element))
39 for source in sources:
43 for binary in binaries:
45 print 'Reason: %s' % reason.replace('\n', '\n ')
47 print 'Bug: %s' % bug.group(1)