diff mbox

[1/1] UBUNTU: use CVE numbers in changelog

Message ID 1468924546-8412-2-git-send-email-apw@canonical.com
State New
Headers show

Commit Message

Andy Whitcroft July 19, 2016, 10:35 a.m. UTC
BugLink: http://bugs.launchpad.net/bugs/1604344
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 debian/scripts/misc/git-ubuntu-log | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/debian/scripts/misc/git-ubuntu-log b/debian/scripts/misc/git-ubuntu-log
index 465fd60..8948768 100755
--- a/debian/scripts/misc/git-ubuntu-log
+++ b/debian/scripts/misc/git-ubuntu-log
@@ -20,6 +20,8 @@  subject_wait = False
 for line in sys.stdin:
     if line.startswith('commit '):
         if entry and 'ignore' not in entry:
+            if 'bugs' not in entry and 'cves' in entry:
+                bugs += entry['cves']
             entries.append(entry)
         entry = {}
         subject_wait = True
@@ -41,11 +43,16 @@  for line in sys.stdin:
         if bits[-1] not in bugs:
             bugs.append(bits[-1])
 
+    elif line.startswith('    CVE-'):
+        entry.setdefault('cves', []).append(line.strip())
+
     elif line.startswith('    Ignore:'):
         entry['ignore'] = True
 
 
 if entry and 'ignore' not in entry:
+    if 'bugs' not in entry and 'cves' in entry:
+        bugs += entry['cves']
     entries.append(entry)
 
 entries.reverse()
@@ -67,6 +74,8 @@  for bug in bugs:
         title = 'Miscellaneous Ubuntu changes'
     elif bug == '__mainline__':
         title = 'Miscellaneous upstream changes'
+    elif bug.startswith('CVE-'):
+        title = bug
     else:
         bug_info = None
 
@@ -91,9 +100,10 @@  for bug in bugs:
 
     emit_title = True
     for entry in entries:
-        if (bug == '__packaging__' and 'bugs' not in entry and 'author' in entry) or \
-           (bug == '__mainline__' and 'bugs' not in entry and 'author' not in entry) or \
-           ('bugs' in entry and bug in entry['bugs']):
+        if (bug == '__packaging__' and 'bugs' not in entry and 'cves' not in entry and 'author' in entry) or \
+           (bug == '__mainline__' and 'bugs' not in entry and 'cves' not in entry and 'author' not in entry) or \
+           ('bugs' in entry and bug in entry['bugs']) or \
+           ('cves' in entry and bug in entry['cves']):
             if emit_title:
                 if emit_nl:
                     print('')