diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2014-06-06 12:40:32 +0300 |
---|---|---|
committer | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2014-11-14 14:47:20 +0200 |
commit | f551fab4b20e1d8cd9a069928f54756f2f963d83 (patch) | |
tree | 0fe57f417c656e0b1aaff2735e60f03003537f52 /gbp | |
parent | 72fdb2c35c188ad2d14da68befc54241f592467e (diff) | |
download | git-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')
-rw-r--r-- | gbp/config.py | 3 | ||||
-rw-r--r-- | gbp/rpm/policy.py | 15 | ||||
-rwxr-xr-x | gbp/scripts/rpm_ch.py | 4 |
3 files changed, 14 insertions, 8 deletions
diff --git a/gbp/config.py b/gbp/config.py index 6f251a46..983c5ef9 100644 --- a/gbp/config.py +++ b/gbp/config.py @@ -624,6 +624,7 @@ class GbpOptionParserRpm(GbpOptionParser): 'changelog-revision' : '', 'spawn-editor' : 'always', 'editor-cmd' : 'vim', + 'meta-bts' : '(Close|Closes|Fixes|Fix)', }) help = dict(GbpOptionParser.help) @@ -694,6 +695,8 @@ class GbpOptionParserRpm(GbpOptionParser): 'git-author': "Use name and email from git-config for the changelog header, " "default is '%(git-author)s'", + 'meta-bts': + "Meta tags for the bts commands, default is '%(meta-bts)s'", }) # vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·: 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']) diff --git a/gbp/scripts/rpm_ch.py b/gbp/scripts/rpm_ch.py index 3caaac2e..33058372 100755 --- a/gbp/scripts/rpm_ch.py +++ b/gbp/scripts/rpm_ch.py @@ -279,7 +279,8 @@ def entries_from_commits(changelog, repo, commits, options): for commit in commits: info = repo.get_commit_info(commit) entry_text = ChangelogEntryFormatter.compose(info, full=options.full, - ignore_re=options.ignore_regex, id_len=options.idlen) + ignore_re=options.ignore_regex, id_len=options.idlen, + meta_bts=options.meta_bts) if entry_text: entries.append(changelog.create_entry(author=info['author'].name, text=entry_text)) @@ -431,6 +432,7 @@ def parse_args(argv): help="use all commits from the Git history, overrides " "--since") # Formatting group options + format_grp.add_config_file_option(option_name="meta-bts", dest="meta_bts") format_grp.add_option("--no-release", action="store_false", default=True, dest="release", help="no release, just update the last changelog section") |