[Secure-testing-commits] r2478 - bin lib/python

Florian Weimer fw at costa.debian.org
Thu Oct 20 09:01:16 UTC 2005


Author: fw
Date: 2005-10-20 09:01:15 +0000 (Thu, 20 Oct 2005)
New Revision: 2478

Modified:
   bin/tracker.cgi
   lib/python/security_db.py
Log:
 r304 at deneb:  fw | 2005-10-01 11:19:27 +0200
 Add overview page for the stable suite.
 
 bin/tracker.cgi (print_stable_status):
   New function.
 lib/python/security_db.py (DB.initSchema):
   Add stable_status view.

Modified: bin/tracker.cgi
===================================================================
--- bin/tracker.cgi	2005-10-20 09:00:51 UTC (rev 2477)
+++ bin/tracker.cgi	2005-10-20 09:01:15 UTC (rev 2478)
@@ -648,7 +648,9 @@
 <h2>Starting points</h2>
 """
 
-    print_menu([('status/release/testing',
+    print_menu([('status/release/stable',
+                 'Vulnerable packages in the stable suite'),
+                ('status/release/testing',
                  'Vulnerable packages in the testing suite'),
                 ('status/release/unstable',
                  'Vulnerable packages in the unstable suite'),
@@ -843,6 +845,34 @@
 
         print_footer()
 
+    def print_stable_status():
+        db = security_db.DB('../data/security.db')
+
+        print_title("Vulnerable source packages in stable")
+
+        def gen():
+            old_pkg_name = ''
+            for (pkg_name, bug_name, archive, urgency) in db.cursor().execute(
+                """SELECT package, bug, section, urgency
+                FROM stable_status"""):
+                if pkg_name == old_pkg_name:
+                    pkg_name = ''
+                else:
+                    old_pkg_name = pkg_name
+                    if archive <> 'main':
+                        pkg_name = "%s (%s)" % (pkg_name, archive)
+
+                if urgency == 'unknown':
+                    urgency = ''
+                elif urgency == 'high':
+                    urgency = make_red(urgency)
+
+                yield pkg_name, make_xref(bug_name), urgency
+
+        print_table(gen(), caption=("Package", "Bug", "Urgency"))
+        
+        print_footer()
+    
     def print_testing_status():
         db = security_db.DB('../data/security.db')
 
@@ -1009,6 +1039,7 @@
                 '/data/funny-versions' : print_funny_versions,
                 '/data/missing-epochs' : print_missing_epochs,
                 '/data/unknown-packages' : print_unknown_packages,
+                '/status/release/stable' : print_stable_status,
                 '/status/release/testing' : print_testing_status,
                 '/status/release/unstable' : print_unstable_status,
                 '/status/todo' : print_todo,

Modified: lib/python/security_db.py
===================================================================
--- lib/python/security_db.py	2005-10-20 09:00:51 UTC (rev 2477)
+++ lib/python/security_db.py	2005-10-20 09:01:15 UTC (rev 2478)
@@ -93,7 +93,7 @@
         self.db = apsw.Connection(name)
         self.verbose = verbose
 
-        self.schema_version = 12
+        self.schema_version = 13
         self._initFunctions()
 
         c = self.cursor()
@@ -288,6 +288,24 @@
             AND sp.subrelease = ''
             ORDER BY sp.name, urgency_to_number(st.urgency), st.bug_name""")
 
+        cursor.execute(
+            """CREATE VIEW stable_status AS
+            SELECT DISTINCT sp.name AS package, st.bug_name AS bug,
+            sp.archive AS section, st.urgency AS urgency
+            FROM source_package_status AS st, source_packages AS sp
+            WHERE st.vulnerable AND st.urgency <> 'unimportant'
+            AND sp.rowid = st.package AND sp.release = 'sarge'
+            AND sp.subrelease = ''
+            AND NOT COALESCE((SELECT NOT vulnerable
+            FROM source_packages AS secp, source_package_status AS secst
+            WHERE secp.name = sp.name
+            AND secp.release = 'sarge' AND secp.subrelease = 'security'
+            AND secp.archive = sp.archive
+            AND secst.bug_name = st.bug_name
+            AND secst.package = secp.rowid), 0)
+            ORDER BY sp.name, urgency_to_number(urgency), st.bug_name""")
+
+
         cursor.execute("PRAGMA user_version = %d" % self.schema_version)
 
     def _initFunctions(self):
@@ -1285,14 +1303,21 @@
         """Returns a generator for a list of (BUG, DESCRIPTION) pairs
         which have the requested status."""
         return cursor.execute(
-            """SELECT name, description
+            """SELECT DISTINCT name, description
             FROM (SELECT bugs.name AS name, bugs.description AS description,
-            MAX(st.vulnerable) AS vulnerable
+            MAX(st.vulnerable
+            AND COALESCE((SELECT st2.vulnerable FROM source_packages AS sp2,
+            source_package_status AS st2
+            WHERE sp2.name = sp.name AND sp2.release = sp.release
+            AND sp2.subrelease = 'security' AND sp2.archive = sp.archive
+            AND st2.package = sp2.rowid AND st2.bug_name = st.bug_name
+            ORDER BY st2.vulnerable DESC), 1)) AS vulnerable
             FROM source_packages AS sp, source_package_status AS st, bugs
-            WHERE sp.name = ? AND st.package = sp.rowid
+            WHERE sp.name = ? AND sp.subrelease <> 'security'
+            AND st.package = sp.rowid
             AND bugs.name = st.bug_name
             AND st.urgency <> 'unimportant'
-            GROUP BY bugs.name, bugs.description)
+            GROUP BY bugs.name, bugs.description, sp.name)
             WHERE vulnerable = ?
             ORDER BY name""", (pkg, vulnerable))
 




More information about the Secure-testing-commits mailing list