summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorEmilio Pozuelo Monfort <pochu@debian.org>2020-11-05 13:45:37 +0100
committerEmilio Pozuelo Monfort <pochu@debian.org>2020-11-05 13:52:06 +0100
commitf354d19660ce40506eac504b91b153a631b505c2 (patch)
tree1ea19abb7938390f9774d509e7ce921a60cd855c /lib
parentd596daa6ad9e5220b1028002564bfa3573c4b21c (diff)
bugs.py: add some checks for package notes
Diffstat (limited to 'lib')
-rw-r--r--lib/python/bugs.py58
1 files changed, 48 insertions, 10 deletions
diff --git a/lib/python/bugs.py b/lib/python/bugs.py
index 7b995c2423..e09a2db55b 100644
--- a/lib/python/bugs.py
+++ b/lib/python/bugs.py
@@ -557,20 +557,23 @@ class FileBase(debian_support.PackageFile):
if handle_xref(self.re_xref_required, self.re_xref,
self.re_xref_entry, xref):
continue
-
+
+ def addPackageNote(note):
+ self.checkPackageNote(pkg_notes, note, lineno)
+ pkg_notes.append(note)
+
if self.re_package_required.match(r):
match = self.re_package_version.match(r)
if match:
(release, p, v, d) = match.groups()
- pkg_notes.append(
- PackageNoteParsed(p, v, d, release=release))
+ addPackageNote(PackageNoteParsed(p, v, d, release=release))
continue
match = self.re_package_no_version.match(r)
if match:
(release, p, v, d) = match.groups()
if v == 'not-affected':
- pkg_notes.append(PackageNoteParsed
+ addPackageNote(PackageNoteParsed
(p, '0', 'unimportant',
release=release))
if d:
@@ -581,7 +584,7 @@ class FileBase(debian_support.PackageFile):
r = r[:-1]
comments.append(('NOTE', r))
elif v == 'end-of-life':
- pkg_notes.append(PackageNoteParsed
+ addPackageNote(PackageNoteParsed
(p, None, 'end-of-life',
release=release))
if d:
@@ -604,7 +607,7 @@ class FileBase(debian_support.PackageFile):
reason = v
else:
reason = None
- pkg_notes.append(PackageNoteNoDSA(
+ addPackageNote(PackageNoteNoDSA(
release=release,
package=p,
comment=d,
@@ -623,16 +626,16 @@ class FileBase(debian_support.PackageFile):
self.raiseSyntaxError(
"ITP note needs Debian bug reference",
lineno)
- pkg_notes.append(x)
+ addPackageNote(x)
elif v == 'unfixed':
- pkg_notes.append(PackageNoteParsed
+ addPackageNote(PackageNoteParsed
(p, None, d, release=release))
elif v == 'removed':
- pkg_notes.append(PackageNoteParsed
+ addPackageNote(PackageNoteParsed
(p, None, d, release=release))
self.removed_packages[p] = True
elif v == 'undetermined':
- pkg_notes.append(PackageNoteParsed
+ addPackageNote(PackageNoteParsed
(p, 'undetermined', d, release=release))
else:
self.raiseSyntaxError(
@@ -741,6 +744,22 @@ class FileBase(debian_support.PackageFile):
parsed, or adds some additional checking."""
return bug
+ def checkPackageNote(self, notes, note, lineno):
+ if not notes:
+ return
+
+ prev_note = notes[-1]
+ if prev_note.package != note.package:
+ if prev_note.release and prev_note.release == debian_support.internRelease('experimental'):
+ #self.raiseSyntaxError("experimental release note must come before the package note")
+ pass
+ elif note.release and note.release != debian_support.internRelease('experimental'):
+ self.raiseSyntaxError("release note must follow its package note", lineno)
+ else:
+ if prev_note.release and note.release and prev_note.release < note.release:
+ self.raiseSyntaxError("release notes not ordered properly", lineno)
+
+
class CVEFile(FileBase):
"""A CVE file, as used by the Debian testing security team."""
@@ -777,6 +796,14 @@ class CVEFile(FileBase):
bug.mergeNotes()
return bug
+ def checkPackageNote(self, notes, note, lineno):
+ # dont check old entries for now
+ if self.lineno >= 100000:
+ return
+
+ super().checkPackageNote(notes, note, lineno)
+
+
class CVEExtendFile(CVEFile):
# This is an extend file. The main CVEFile can have a 'CVE-2018-XXXX' (sic)
# identifier, which will get converted to TEMP-* automatically. However to
@@ -795,6 +822,10 @@ class CVEExtendFile(CVEFile):
return CVEFile.isUniqueName(self, name)
+ def checkPackageNote(self, notes, note, lineno):
+ pass
+
+
class DSAFile(FileBase):
"""A DSA file.
@@ -840,6 +871,9 @@ class DSAFile(FileBase):
bug.mergeNotes()
return bug
+ def checkPackageNote(self, notes, note, lineno):
+ pass
+
class DTSAFile(FileBase):
"""A DTSA file.
@@ -884,6 +918,10 @@ class DTSAFile(FileBase):
lineno=bug.source_line)
return bug
+ def checkPackageNote(self, notes, note, lineno):
+ pass
+
+
def test():
assert internUrgency("high") > internUrgency("medium")

© 2014-2024 Faster IT GmbH | imprint | privacy policy