[Secure-testing-commits] r14657 - lib/python/sectracker

Florian Weimer fw at alioth.debian.org
Sun May 9 14:19:19 UTC 2010


Author: fw
Date: 2010-05-09 14:19:12 +0000 (Sun, 09 May 2010)
New Revision: 14657

Modified:
   lib/python/sectracker/parsers.py
Log:
sectracker.parsers._parselist: detect conflict annotations


Modified: lib/python/sectracker/parsers.py
===================================================================
--- lib/python/sectracker/parsers.py	2010-05-09 14:13:55 UTC (rev 14656)
+++ lib/python/sectracker/parsers.py	2010-05-09 14:19:12 UTC (rev 14657)
@@ -191,6 +191,8 @@
     diag = sectracker.diagnostics.Diagnostics()
     header = None
     anns = []
+    anns_types = set()
+    relpkg = set()
 
     for line in f.readlines():
         lineno += 1
@@ -202,11 +204,30 @@
                 continue
             ann = _annotationdispatcher(line, diag)
             if ann is not None:
+                # Per-annotation checks (spanning multiple annotaitons)
+                anns_types.add(ann.type)
+                if ann.type == "package":
+                    rp = (ann.release, ann.package)
+                    if rp in relpkg:
+                        diag.error("duplicate package annation")
+                        ann = None
+                    else:
+                        relpkg.add(rp)
+            if ann is not None:
                 anns.append(ann)
         else:
             if header is not None:
+                # Per-bug global checks
+                if "NOT-FOR-US" in anns_types and "package" in anns_types:
+                    diag.error("NOT-FOR-US conflicts with package annotations",
+                               line=headerlineno)
+                if "REJECTED" in anns_types and "package" in anns_types:
+                    diag.warning("REJECTED bug has package annotations",
+                                 line=headerlineno)
                 bugs.append(finish(header, headerlineno, anns, diag))
                 del anns[:]
+                anns_types = set()
+                relpkg = set()
             headerlineno = lineno
         
             header = parseheader(line)




More information about the Secure-testing-commits mailing list