diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2013-01-17 10:41:18 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2018-01-29 10:40:20 +0100 |
commit | 393edba385ba101ff6c8cba222a9da5fb7fe5c65 (patch) | |
tree | fa7289f0092a5af7fd64004acd32cafe55edd310 /gbp/scripts/buildpackage_rpm.py | |
parent | a0f6f11c87cb164b245a89332eece5d0af92f7ed (diff) |
buildpackage-rpm: support setting the 'VCS:' tag in spec
Now gbp buildpackage-rpm is able to update the 'VCS:' tag in the exported
spec file. A new config option 'spec-vcs-tag' controls the format:
- if empty, no 'VCS' tag is inserted and possible old 'VCS' tag is
removed
- otherwise, a 'VCS' tag is inserted or the old 'VCS' tag is updated
The spec-vcs-tag is a format string which supports the following
keywords:
- '%(commit)' expands to the full commit sha1
- '%(commitish)' expands to the sha1 of the exported object (commit or
tag)
- '%(tagname)s' expands to the long tag name (from git-describe)
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'gbp/scripts/buildpackage_rpm.py')
-rw-r--r-- | gbp/scripts/buildpackage_rpm.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gbp/scripts/buildpackage_rpm.py b/gbp/scripts/buildpackage_rpm.py index 85024973..16b5eb56 100644 --- a/gbp/scripts/buildpackage_rpm.py +++ b/gbp/scripts/buildpackage_rpm.py @@ -430,6 +430,7 @@ def build_parser(name, prefix=None, git_treeish=None): dest="packaging_dir") export_group.add_config_file_option(option_name="spec-file", dest="spec_file") + export_group.add_config_file_option("spec-vcs-tag", dest="spec_vcs_tag") return parser @@ -615,6 +616,10 @@ def main(argv): 'GBP_SHA1': sha})() else: vcs_info = get_vcs_info(repo, tree) + + # Put 'VCS:' tag to .spec + spec.set_tag('VCS', None, format_str(options.spec_vcs_tag, vcs_info)) + spec.write_spec_file() except KeyboardInterrupt: retval = 1 gbp.log.err("Interrupted. Aborting.") |