[Secure-testing-commits] r1997 - lib/python

Florian Weimer fw at costa.debian.org
Thu Sep 15 11:51:27 UTC 2005


Author: fw
Date: 2005-09-15 11:51:26 +0000 (Thu, 15 Sep 2005)
New Revision: 1997

Modified:
   lib/python/bugs.py
   lib/python/security_db.py
Log:
Keep track of advisory release dates so that we can generate links to
Debian advisories.

lib/python/security_db.py (DB):
  Change database schema: Add release_date column to bugs table.

lib/python/security_db.py (BugBase, BugFromDB):
  Add date attribute.


Modified: lib/python/bugs.py
===================================================================
--- lib/python/bugs.py	2005-09-15 10:41:24 UTC (rev 1996)
+++ lib/python/bugs.py	2005-09-15 11:51:26 UTC (rev 1997)
@@ -276,11 +276,11 @@
         import apsw
         try:
             cursor.execute("""INSERT INTO bugs
-            (name, cve_status, not_for_us, description,
+            (name, cve_status, not_for_us, description, release_date,
              source_file, source_line)
-            VALUES (?, ?, ?, ?, ?, ?)""",
+            VALUES (?, ?, ?, ?, ?, ?, ?)""",
                            (self.name, self.cveStatus(), not_for_us,
-                            self.description,
+                            self.description, self.date or '',
                             self.source_file, self.source_line))
         except apsw.ConstraintError:
             raise ValueError, "bug name %s is not unique" % self.name
@@ -326,7 +326,8 @@
                 data[rdesc[j][0]] = r[j]
             # FIXME: load date
             Bug.__init__(self, data['source_file'], data['source_line'],
-                         None, name, data['description'], comments=[],
+                         data['release_date'], name,
+                         data['description'], comments=[],
                          notes=[], xref=[],
                          not_for_us=not not data['not_for_us'])
             for (x,) in cursor.execute\

Modified: lib/python/security_db.py
===================================================================
--- lib/python/security_db.py	2005-09-15 10:41:24 UTC (rev 1996)
+++ lib/python/security_db.py	2005-09-15 11:51:26 UTC (rev 1997)
@@ -96,13 +96,17 @@
                           'sarge' : 'stable',
                           'woody': 'oldstable'}
 
-        self.schema_version = 2
+        self.schema_version = 4
 
         c = self.cursor()
         for (v,) in c.execute("PRAGMA user_version"):
             if v == 0:
                 self.initSchema()
             elif v <> self.schema_version:
+                if self.verbose:
+                    print "DB: schema version mismatch: expected %d, got %d" \
+                          % (self.schema_version, v)
+                self.db.close()
                 raise SchemaMismatch, `v`
             return
         assert False
@@ -204,6 +208,7 @@
                     ('', 'CANDIDATE', 'ASSIGNED', 'RESERVED', 'REJECTED')),
          not_for_us INTEGER NOT NULL CHECK (not_for_us IN (0, 1)),
          description TEXT NOT NULL,
+         release_date TEXT NOT NULL,
          source_file TEXT NOT NULL,
          source_line INTEGER NOT NULL)""")
 




More information about the Secure-testing-commits mailing list