[vivid/master-next,1/1] UBUNTU: avoid duplicate CVE numbers in changelog
diff mbox

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

Commit Message

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

Patch
diff mbox

diff --git a/debian/scripts/misc/git-ubuntu-log b/debian/scripts/misc/git-ubuntu-log
index 8948768..eee983f 100755
--- a/debian/scripts/misc/git-ubuntu-log
+++ b/debian/scripts/misc/git-ubuntu-log
@@ -12,17 +12,22 @@  import textwrap
 sys.stdin = codecs.getreader("utf-8")(sys.stdin.detach())
 sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())
 
+entries = []
+def add_entry(entry):
+    if entry and 'ignore' not in entry:
+        if 'bugs' not in entry and 'cves' in entry:
+            for cve in entry['cves']:
+                if cve not in bugs:
+                    bugs.append(cve)
+        entries.append(entry)
+
 # Suck up the git log output and extract the information we need.
 bugs = []
-entries = []
 entry = None
 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)
+        add_entry(entry)
         entry = {}
         subject_wait = True
 
@@ -49,11 +54,7 @@  for line in sys.stdin:
     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)
+add_entry(entry)
 
 entries.reverse()