From 8d8382c59fe139e9be16a8d9fb177bc6f792b4fe Mon Sep 17 00:00:00 2001 From: Maxim Uvarov Date: Fri, 13 Jan 2012 14:57:06 -0800 Subject: [PATCH] git-changelog: add Orabug and CVE Add parsing Orabug and CVE. Signed-off-by: Maxim Uvarov --- scripts/git-changelog | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/scripts/git-changelog b/scripts/git-changelog index 3e3c6c3b7641..b1ff75c67f93 100755 --- a/scripts/git-changelog +++ b/scripts/git-changelog @@ -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 -- 2.50.1