diff options
author | Emilio Pozuelo Monfort <pochu@debian.org> | 2018-05-11 15:35:39 +0200 |
---|---|---|
committer | Emilio Pozuelo Monfort <pochu@debian.org> | 2018-06-08 08:38:46 +0200 |
commit | 62c2e2901f0ee5d5c1504c3358f30e31334a15fa (patch) | |
tree | 616cf1e2a943f6e2424deee85e3f721513db47c5 /lib | |
parent | 563330a621d23c8f032b548d32cb907286eafa43 (diff) |
Simplify DLAFile
Subclass DSAFile rather than copying it.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/python/bugs.py | 37 |
1 files changed, 1 insertions, 36 deletions
diff --git a/lib/python/bugs.py b/lib/python/bugs.py index b876647da9..6a042033b5 100644 --- a/lib/python/bugs.py +++ b/lib/python/bugs.py @@ -814,47 +814,12 @@ class DSAFile(FileBase): bug.mergeNotes() return bug -class DLAFile(FileBase): - """A DLA file. - - Similar to a CVE file, only that it contains DLAs as its main - reference point, and release dates. - """ - +class DLAFile(DSAFile): re_dsa = re.compile(r'^\[(\d\d) ([A-Z][a-z][a-z]) (\d{4})\] ' + r'(DLA-\d+(?:-\d+)?)\s+' + r'(.*?)\s*$') - month_names = {'Jan': 1, - 'Feb': 2, - 'Mar': 3, - 'Apr': 4, - 'May': 5, - 'Jun': 6, - 'Jul': 7, - 'Aug': 8, - 'Sep': 9, - 'Oct': 10, - 'Nov': 11, - 'Dec': 12} - def matchHeader(self, line): - match = self.re_dsa.match(line) - if not match: - self.raiseSyntaxError("expected DLA record, got: %s" % `line`) - (record_name, description) = match.groups() - (day, month, year, name, desc) = match.groups() - try: - month = self.month_names[month] - except KeyError: - self.raiseSyntaxError("invalid month name %s" % `month`) - return ("%s-%02d-%s" % (year, month, day), name, desc) - - def finishBug(self, bug): - # Merge identical package notes, for historical reasons. - bug.mergeNotes() - return bug - class DTSAFile(FileBase): """A DTSA file. |