summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Macken <lmacken@redhat.com>2011-12-09 17:24:09 (GMT)
committerLuke Macken <lmacken@redhat.com>2011-12-09 17:24:09 (GMT)
commit3eead37baa7b1eddf179bdccf2e5f9ff8a1536b4 (patch)
treeaae86064edf8975d6e4d3e3235387c2a40719da8
parent4ba6cdd8b672272cbdcafc0292f36043c0950bd0 (diff)
downloadfedoracommunity-3eead37baa7b1eddf179bdccf2e5f9ff8a1536b4.zip
fedoracommunity-3eead37baa7b1eddf179bdccf2e5f9ff8a1536b4.tar.gz
fedoracommunity-3eead37baa7b1eddf179bdccf2e5f9ff8a1536b4.tar.xz
Automatically link up bugs and CVEs in patch ChangeLogs.
-rw-r--r--fedoracommunity/connectors/gitconnector.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/fedoracommunity/connectors/gitconnector.py b/fedoracommunity/connectors/gitconnector.py
index 607ad98..6c5a6e7 100644
--- a/fedoracommunity/connectors/gitconnector.py
+++ b/fedoracommunity/connectors/gitconnector.py
@@ -14,6 +14,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+import re
import os
import git
import logging
@@ -103,6 +104,21 @@ class FedoraGitRepo(object):
else:
current['msg'] += to_unicode('%s\n' %' '.join(chunks))
commits.append(current)
+
+ # Iterate over all of the commits and link up bug numbers and CVEs.
+ bug_url = '<a href="https://bugzilla.redhat.com/show_bug.cgi?id=%s" target="_blank">%s</a>'
+ cve_url = '<a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=%s" target="_blank">%s</a>'
+ regexs = (r'#(\d+)', r'rhbz (\d+)', r'bz (\d+)')
+ for commit in commits:
+ for regex in regexs:
+ for bug in re.findall(regex, commit['msg']):
+ commit['msg'] = commit['msg'].replace(bug,
+ bug_url % (bug, bug))
+ # Link up CVE IDs
+ for cve in re.findall(r'(CVE-\d\d\d\d-\d\d\d\d)', commit['msg']):
+ commit['msg'] = commit['msg'].replace(cve,
+ cve_url % (cve, cve))
+
return commits
def get_diffstat(self, patch='*.patch'):