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

Florian Weimer fw at costa.debian.org
Tue Sep 13 14:43:16 UTC 2005


Author: fw
Date: 2005-09-13 14:43:16 +0000 (Tue, 13 Sep 2005)
New Revision: 1952

Modified:
   lib/python/bugs.py
Log:
Add support for release annotations of the form "[woody] - PACKAGE
VERSION".  (Currently not used in any input file.)

lib/python/bugs.py (PackageNote.writeDB):
  Convert release objects to strings.
(PackageNoteParsed):
  Pass in release information.  Do not extract it from the
  package-specific notes.
(FileBase.re_package_required, FileBase.re_package):
  Detect release annotations.
(FileBase.__iter__):
  Extract them.
(DSAFile):
  Moved "!" hack to base class.


Modified: lib/python/bugs.py
===================================================================
--- lib/python/bugs.py	2005-09-13 14:08:22 UTC (rev 1951)
+++ lib/python/bugs.py	2005-09-13 14:43:16 UTC (rev 1952)
@@ -112,10 +112,14 @@
             v = str(self.fixed_version)
         else:
             v = None
+        if self.release:
+            r = str(self.release)
+        else:
+            r = ''
         cursor.execute("""INSERT INTO package_notes
         (bug_name, package, fixed_version, release, urgency)
         VALUES (?, ?, ?, ?, ?)""",
-                       (bug_name, self.package, v, self.release or '',
+                       (bug_name, self.package, v, r,
                         str(self.urgency)))
         for (rowid,) in cursor.execute('SELECT last_insert_rowid()'):
             self.id = rowid
@@ -151,8 +155,7 @@
     re_bug = re.compile(r'^bug #(\d+)$')
     re_notes_split = re.compile(r'\s*;\s+') 
 
-    def __init__(self, package, version, notes):
-        rel = None
+    def __init__(self, package, version, notes, release=None):
         bugs = []
         urgency = "unknown"
         if notes is not None:
@@ -162,11 +165,6 @@
                     urgency = u
                     continue
                 
-                r = debian_support.internRelease(n)
-                if r:
-                    rel = r
-                    continue
-
                 match = self.re_bug.match(n)
                 if match:
                     (bug,) = match.groups()
@@ -178,7 +176,7 @@
                     continue
 
                 raise SyntaxError , 'unknown package note %s\n' % `n`
-        PackageNote.__init__(self, package, version, rel, urgency)
+        PackageNote.__init__(self, package, version, release, urgency)
         self.bugs = bugs
 
 class BugBase:
@@ -345,8 +343,9 @@
                                + r'|VU#\d{6}'
                                + r'|DSA-\d+(?:-\d+)?|DTSA-\d+-\d+)$')
     
-    re_package_required = re.compile(r'^-')
-    re_package = re.compile(r'^- ([A-Za-z0-9:.+-]+)'
+    # temporary hack, until we know what "!" actually means.
+    re_package_required = re.compile(r'^(?:\[.*\]\s*)?[-!]')
+    re_package = re.compile(r'^(?:\[([a-z]+)\] )?[-!] ([A-Za-z0-9:.+-]+)'
                             + r'(?:\s+([A-Za-z0-9:.+-]+))?\s*(?:\((.*)\))?$')
     re_not_for_us_required = re.compile(r'^NOTE:\s+not?e?-fo?r-u')
     re_not_for_us = re.compile(r'^NOTE:\s+not-for-us(?:\s+\((.*)\))?\s*$')
@@ -465,7 +464,7 @@
                 if self.re_package_required.match(r):
                     match = self.re_package.match(r)
                     if match:
-                        (p, v, d) = match.groups()
+                        (release, p, v, d) = match.groups()
                         if v is None and d is None and \
                                self.no_version_needs_note:
                                 raise SyntaxError, \
@@ -473,11 +472,12 @@
 
                         if v == 'not-affected':
                             # '0' is the minimum version number possible.
-                            pkg_notes.append(PackageNoteParsed(p, '0', None))
+                            pkg_notes.append(PackageNoteParsed
+                                             (p, '0', None, release=release))
                             # 'd' is a free-form field in this case.
                             comments.append(('NOTE', d))
                         else:
-                            x = PackageNoteParsed(p, v, d)
+                            x = PackageNoteParsed(p, v, d, release=release)
                             pkg_notes.append(x)
                             if first_bug == 0 and len(x.bugs) > 0:
                                 first_bug = x.bugs[0]
@@ -623,10 +623,6 @@
                    'Nov': 11,
                    'Dec': 12}
 
-    # temporary hack, until we know what "!" actually means.
-    re_package_required = re.compile(r'^[-!]')
-    re_package = re.compile(r'^[-!] ([A-Za-z0-9:.+-]+)'
-                            + r'(?:\s+([A-Za-z0-9:.+-]+))?\s*(?:\((.*)\))?$')
     def matchHeader(self, line):
         match = self.re_dsa.match(line)
         if not match:




More information about the Secure-testing-commits mailing list