Author: fw Date: 2005-09-20 17:59:09 +0000 (Tue, 20 Sep 2005) New Revision: 2058 Modified: lib/python/bugs.py Log: lib/python/bugs.py (FileBase.finishBug): New method to apply last-minute checks to bug objects. (FileBase.__iter__): Use it. (DSAFile.finishBug): Override, to enforce the "etch" tag. Modified: lib/python/bugs.py ==================================================================--- lib/python/bugs.py 2005-09-20 16:36:15 UTC (rev 2057) +++ lib/python/bugs.py 2005-09-20 17:59:09 UTC (rev 2058) @@ -625,9 +625,10 @@ # The bug has extra data even though it is marked # reserved by CVE, we have to issue the full # version because the official CVE lags a bit. - yield Bug(self.file.name, first_lineno, date, - record_name, description, comments, - notes=pkg_notes, xref=xref) + yield self.finishBug(Bug(self.file.name, first_lineno, + date, record_name, description, + comments, + notes=pkg_notes, xref=xref)) else: yield BugReservedCVE(self.file.name, first_lineno, record_name, comments) @@ -651,16 +652,21 @@ self.raiseSyntaxError\ (''package information not allowed in not-for-us bugs'', first_lineno) - yield Bug(self.file.name, first_lineno, date, - record_name, description, comments, notes=[], - xref=xref, not_for_us=True) + yield self.finishBug(Bug(self.file.name, first_lineno, date, + record_name, description, comments, + notes=[], xref=xref, not_for_us=True)) else: if not self.isUniqueName(record_name): record_name = ''FAKE-%07d-%06d'' % (first_bug, first_lineno) - yield Bug(self.file.name, first_lineno, date, - record_name, description, - comments, notes=pkg_notes, xref=xref) + yield self.finishBug(Bug(self.file.name, first_lineno, date, + record_name, description, + comments, notes=pkg_notes, xref=xref)) + def finishBug(self, bug): + """Applies a transformation to the bug after it has been + parsed, or adds some additional checking.""" + return bug + class CANFile(FileBase): """A CAN file, as used by the Debian testing security team.""" @@ -791,6 +797,17 @@ self.raiseSyntaxError("invalid month name %s" % `month`) return ("%s-%02d-%02d" % (year, month, int(day)), name, desc) + def finishBug(self, bug): + # Convert all package notes to notes for etch (testing). + testing = debian_support.internRelease("etch") + for n in bug.notes: + if n.release is not None: + self.raiseSyntaxError( + "no release annotations allowed in DTSA files", + lineno=bug.source_line) + n.release = testing + return bug + def test(): assert internUrgency("high") > internUrgency("medium")