summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBastian Blank <bastian.blank@credativ.de>2016-03-23 10:51:02 +0100
committerEmilio Pozuelo Monfort <pochu@debian.org>2018-06-08 10:04:21 +0200
commitecbbab3e6af9d16c94d559db65ad326568b3ad12 (patch)
treee802194cfa01213d1bb35c9c58607ff295b02fba /lib
parent77190d32d7f00156830d7fbefe2df1e483b194e9 (diff)
Add support for CUSTOMER bugs and CVE extends
Diffstat (limited to 'lib')
-rw-r--r--lib/python/bugs.py37
1 files changed, 36 insertions, 1 deletions
diff --git a/lib/python/bugs.py b/lib/python/bugs.py
index 278e2ab79e..5ec843b621 100644
--- a/lib/python/bugs.py
+++ b/lib/python/bugs.py
@@ -300,6 +300,28 @@ class Bug(BugBase):
nts.append(notes[key])
self.notes = nts
+class BugExtend(Bug):
+ def writeDB(self, cursor):
+ """Writes the record to an SQLite3 database."""
+
+ for (typ, c) in self.comments:
+ cursor.execute("""INSERT INTO bugs_notes
+ (bug_name, typ, comment) VALUES (?, ?, ?)""",
+ (self.name, typ, c))
+
+ for n in self.notes:
+ n.writeDB(cursor, self.name)
+
+ import apsw
+ for x in self.xref:
+ try:
+ cursor.execute("""INSERT INTO bugs_xref
+ (source, target) VALUES (?, ?)""",
+ (self.name, x))
+ except apsw.ConstraintError:
+ raise ValueError, \
+ "cross reference to %s appears multiple times" % x
+
class BugFromDB(Bug):
def __init__(self, cursor, name):
assert type(name) in types.StringTypes
@@ -441,6 +463,9 @@ class FileBase(debian_support.PackageFile):
debian_support.PackageFile.__init__(self, name, fileObj)
self.removed_packages = {}
+ def isExtend(self, name):
+ return False
+
def isUniqueName(self, name):
"""Returns True if the name is a real, unique name."""
return True
@@ -729,7 +754,11 @@ class FileBase(debian_support.PackageFile):
if first_bug:
break
record_name = temp_bug_name(first_bug, description)
- yield self.finishBug(Bug(self.file.name, first_lineno, date,
+ if self.isExtend(record_name):
+ cls = BugExtend
+ else:
+ cls = Bug
+ yield self.finishBug(cls(self.file.name, first_lineno, date,
record_name, description,
comments, notes=pkg_notes, xref=xref))
@@ -774,6 +803,12 @@ class CVEFile(FileBase):
bug.mergeNotes()
return bug
+class CVECUSTOMERFile(CVEFile):
+ re_cve = re.compile(r'^(CVE-\d{4}-(?:\d{4,}|XXXX)|TEMP-\d+-\S+)\s+(.*?)\s*$')
+
+ def isExtend(self, name):
+ return True
+
class DSAFile(FileBase):
"""A DSA file.

© 2014-2024 Faster IT GmbH | imprint | privacy policy