From 375ba023951257874416fd6fc291945210354d66 Mon Sep 17 00:00:00 2001 From: Emilio Pozuelo Monfort Date: Fri, 1 Jun 2018 15:38:19 +0200 Subject: Merge DLAFile into DSAFile The only difference is that the regular expressions look for DSA or DLA, but we can just guess that based on the path. --- lib/python/bugs.py | 18 +++++++++--------- lib/python/security_db.py | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/python/bugs.py b/lib/python/bugs.py index 6a042033b5..278e2ab79e 100644 --- a/lib/python/bugs.py +++ b/lib/python/bugs.py @@ -16,6 +16,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA import debian_support +import os import re import types import hashlib @@ -780,9 +781,13 @@ class DSAFile(FileBase): reference point, and release dates. """ - re_dsa = re.compile(r'^\[(\d\d) ([A-Z][a-z][a-z]) (\d{4})\] ' - + r'(DSA-\d+(?:-\d+)?)\s+' - + r'(.*?)\s*$') + def __init__(self, name, fileObj=None): + FileBase.__init__(self, name, fileObj) + + self.base = os.path.basename(os.path.dirname(self.name)) + self.re_dsa = re.compile(r'^\[(\d\d) ([A-Z][a-z][a-z]) (\d{4})\] ' + + r'(' + self.base + '-\d+(?:-\d+)?)\s+' + + r'(.*?)\s*$') month_names = {'Jan': 1, 'Feb': 2, @@ -800,7 +805,7 @@ class DSAFile(FileBase): def matchHeader(self, line): match = self.re_dsa.match(line) if not match: - self.raiseSyntaxError("expected DSA record, got: %s" % `line`) + self.raiseSyntaxError("expected %s record, got: %s" % (self.base, `line`)) (record_name, description) = match.groups() (day, month, year, name, desc) = match.groups() try: @@ -814,11 +819,6 @@ class DSAFile(FileBase): bug.mergeNotes() return bug -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*$') - class DTSAFile(FileBase): """A DTSA file. diff --git a/lib/python/security_db.py b/lib/python/security_db.py index 9208532fba..dbb7cd8048 100644 --- a/lib/python/security_db.py +++ b/lib/python/security_db.py @@ -916,7 +916,7 @@ class DB: sources = ((bugs.CVEFile, '/CVE/list'), (bugs.DSAFile, '/DSA/list'), (bugs.DTSAFile, '/DTSA/list'), - (bugs.DLAFile, '/DLA/list'), + (bugs.DSAFile, '/DLA/list'), (None, source_removed_packages)) unchanged = True -- cgit v1.2.3