#!/usr/bin/env python import os, re releases = ['2.6.15-dapper-security', '2.6.17-edgy-security', '2.6.20-feisty-security'] table = dict() cves = [elem for elem in os.listdir('.') if re.match('^CVE-\d+-\d+$',elem)] for cve in cves: table.setdefault(cve, dict()) text = file(cve).read() for rel in releases: table[cve].setdefault(rel,"-unlisted-") status = re.search('^%s:[ \t]*([^ \n]*)' % rel, text, re.MULTILINE) if status: state = status.group(1) if state == '': state = 'needs triage' table[cve][rel] = state format = '%15s' print ' ', for rel in releases: print format % rel.split('-')[1], print for cve in cves: ignore = 1 needed = 0 released = 0 for rel in releases: if table[cve][rel] != 'N/A' and table[cve][rel] != 'released' and table[cve][rel] != '-unlisted-': ignore = 0 if table[cve][rel] == 'needed': needed = 1 if table[cve][rel] == 'released': released = 1 if not ignore: print '%s: ' % cve, for rel in releases: print format % table[cve][rel], if needed and released: print ' [out of sync]', print