Florian Weimer
2010-May-08 18:27 UTC
[Secure-testing-commits] r14649 - in lib/python: sectracker sectracker_test
Author: fw Date: 2010-05-08 18:27:11 +0000 (Sat, 08 May 2010) New Revision: 14649 Modified: lib/python/sectracker/parsers.py lib/python/sectracker_test/test_parsers.py Log: sectracker.parsers.dtsalist(): DTSA file parser Modified: lib/python/sectracker/parsers.py ==================================================================--- lib/python/sectracker/parsers.py 2010-05-08 18:23:58 UTC (rev 14648) +++ lib/python/sectracker/parsers.py 2010-05-08 18:27:11 UTC (rev 14649) @@ -274,3 +274,20 @@ _checkrelease(anns, diag, "DSA") return Bug(path, Header(headerlineno, name, None), tuple(anns)) return _parselist(path, f, parseheader, finish) + + at _xpickle.loader("DTSA" + FORMAT) +def dtsalist(path, f): + re_header = re.compile( + r''^\[([A-Z][a-z]{2,}) (\d\d?)(?:st|nd|rd|th), (\d{4})\] '' + + r''(DTSA-\d+-\d+)\s+'' + + r''(.*?)\s*$'') + def parseheader(line): + match = re_header.match(line) + if match is None: + return None + return match.groups() + def finish(header, headerlineno, anns, diag): + d, m, y, name, desc = header + _checkrelease(anns, diag, "DTSA") + return Bug(path, Header(headerlineno, name, None), tuple(anns)) + return _parselist(path, f, parseheader, finish) Modified: lib/python/sectracker_test/test_parsers.py ==================================================================--- lib/python/sectracker_test/test_parsers.py 2010-05-08 18:23:58 UTC (rev 14648) +++ lib/python/sectracker_test/test_parsers.py 2010-05-08 18:27:11 UTC (rev 14649) @@ -35,6 +35,11 @@ for err in o.messages: print "%s:%d: %s: %s" % (err.file, err.line, err.level, err.message) +safeunlink("../../data/DTSA/list" + EXTENSION) +o = dtsalist("../../data/DTSA/list") +for err in o.messages: + print "%s:%d: %s: %s" % (err.file, err.line, err.level, err.message) + Message = sectracker.diagnostics.Message for (line, res, xmsgs) in [ ('' - foo <unfixed>'',