]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
git-changelog: add Orabug and CVE
authorMaxim Uvarov <maxim.uvarov@oracle.com>
Fri, 13 Jan 2012 22:57:06 +0000 (14:57 -0800)
committerGuru Anbalagane <guru.anbalagane@oracle.com>
Fri, 27 Jan 2012 01:34:00 +0000 (17:34 -0800)
Add parsing Orabug and CVE.
Signed-off-by: Maxim Uvarov <maxim.uvarov@oracle.com>
scripts/git-changelog

index 3e3c6c3b764152d5f45edf3c9c4cd4d1023a4b4c..b1ff75c67f93ce15b115a69a3ab3f131ebeef823 100755 (executable)
@@ -51,6 +51,34 @@ class ChangeLog:
 
         return ret
 
+    def _get_orabug(self, commit):
+       proc = subprocess.Popen(['git', 'log', '-1',
+                           "--pretty=format:%b", commit],
+                           stdout=subprocess.PIPE,
+                           stderr=subprocess.PIPE).communicate()
+
+       ret = proc[0].strip('\n').split('\n')
+       if len(ret[0]) > 0 and len(ret[0]) > 7 and ret[0].find("Orabug") != -1:
+               return "[%s]" % ret[0]
+       else: 
+               return "" 
+
+    def _get_cve(self, commit):
+       proc = subprocess.Popen(['git', 'log', '-1',
+                           "--pretty=format:%b", commit],
+                           stdout=subprocess.PIPE,
+                           stderr=subprocess.PIPE).communicate()
+
+       cves = [] 
+       m = re.search("CVE-[0-9]+-[0-9]+", proc[0], re.MULTILINE)
+       if m:
+               cves.append(m.group())
+       ret = ""
+       if len(cves) > 0:
+               for cve in cves:
+                       ret += "%s " % cve      
+       return ret
+
     def getLog(self):
         range = "%s.." % (self.tag)
         proc = subprocess.Popen(['git', 'log', '--pretty=oneline', range],
@@ -73,8 +101,10 @@ class ChangeLog:
             summary = self._getCommitDetail(commit, "%s")
             long = self._getCommitDetail(commit, "%b")
             author = self._getCommitDetail(commit, "%aN")
+            orabug = self._get_orabug(commit)
+            cve = self._get_cve(commit)
 
-            log.append(("%s (%s)" % (summary.strip(), author)))
+            log.append(("%s (%s) %s %s" % (summary.strip(), author, orabug, cve)))
 
         return log