summaryrefslogtreecommitdiff
path: root/gbp/rpm
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-06-06 12:40:32 +0300
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-11-14 14:47:20 +0200
commitf551fab4b20e1d8cd9a069928f54756f2f963d83 (patch)
tree0fe57f417c656e0b1aaff2735e60f03003537f52 /gbp/rpm
parent72fdb2c35c188ad2d14da68befc54241f592467e (diff)
downloadgit-buildpackage-f551fab4b20e1d8cd9a069928f54756f2f963d83.tar.gz
git-buildpackage-f551fab4b20e1d8cd9a069928f54756f2f963d83.tar.bz2
git-buildpackage-f551fab4b20e1d8cd9a069928f54756f2f963d83.zip
rpm-ch: implement --meta-bts option
This gives the user the possibility to define what meta tags (in git commit message) git-rpm-ch recognizes as bug tracking system references. Or, makes it possible to disable bts meta tag tracking altogether. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'gbp/rpm')
-rw-r--r--gbp/rpm/policy.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/gbp/rpm/policy.py b/gbp/rpm/policy.py
index 82d6abee..9fae0457 100644
--- a/gbp/rpm/policy.py
+++ b/gbp/rpm/policy.py
@@ -167,8 +167,6 @@ class RpmPkgPolicy(PkgPolicy):
# Maximum length for a changelog entry line
max_entry_line_length = 76
- # Bug tracking system related meta tags recognized from git commit msg
- bts_meta_tags = ("Close", "Closes", "Fixes", "Fix")
# Regexp for matching bug tracking system ids (e.g. "bgo#123")
bug_id_re = r'[A-Za-z0-9#_\-]+'
@@ -180,15 +178,18 @@ class RpmPkgPolicy(PkgPolicy):
@param lines: commit message
@type lines: C{list} of C{str}
- @param meta_tags: meta tags to look for
- @type meta_tags: C{tuple} of C{str}
+ @param meta_tags: meta tags (regexp) to look for
+ @type meta_tags: C{str}
@return: bts-ids per meta tag and the non-mathced lines
@rtype: (C{dict}, C{list} of C{str})
"""
+ if not meta_tags:
+ return ({}, lines[:])
+
tags = {}
other_lines = []
- bts_re = re.compile(r'^(?P<tag>%s):\s*(?P<ids>.*)' %
- ('|'.join(meta_tags)), re.I)
+ bts_re = re.compile(r'^(?P<tag>%s):\s*(?P<ids>.*)' % meta_tags,
+ re.I)
bug_id_re = re.compile(cls.bug_id_re)
for line in lines:
match = bts_re.match(line)
@@ -244,7 +245,7 @@ class RpmPkgPolicy(PkgPolicy):
return None
# Parse and filter out bts-related meta-tags
- bts_tags, body = cls._parse_bts_tags(body, cls.bts_meta_tags)
+ bts_tags, body = cls._parse_bts_tags(body, kwargs['meta_bts'])
# Additional filtering
body = cls._extra_filter(body, kwargs['ignore_re'])