From 1370bc3c58d07c23eed842ce122a668b1fcfe480 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Tue, 15 Jul 2014 14:54:44 +0300 Subject: [PATCH] buildpackage-rpm: add '--git-native' option Can be used to explicitly configure a package as native or non-native. Default behavior is still to guess based on the existence of upstream branch. Change-Id: I09c3797fd3d88285ee1e920f4c40e3b22c06916a Signed-off-by: Markus Lehtonen --- gbp/config.py | 3 +++ gbp/scripts/buildpackage_rpm.py | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/gbp/config.py b/gbp/config.py index a2c28de..90c5068 100644 --- a/gbp/config.py +++ b/gbp/config.py @@ -578,6 +578,7 @@ class GbpOptionParserRpm(GbpOptionParser): defaults = dict(GbpOptionParser.defaults) defaults.update( { 'vendor' : 'vendor', + 'native' : 'auto', 'builder' : 'rpmbuild', 'cleaner' : '/bin/true', 'merge' : 'False', @@ -615,6 +616,8 @@ class GbpOptionParserRpm(GbpOptionParser): help.update( { 'vendor': "Distribution vendor name", + 'native': + "Treat this package as native, default is '%(native)s'", 'packaging-dir': "subdir where packaging files are stored, default is '%(packaging-dir)s'", 'packaging-tag': diff --git a/gbp/scripts/buildpackage_rpm.py b/gbp/scripts/buildpackage_rpm.py index d9abb80..fdde2db 100755 --- a/gbp/scripts/buildpackage_rpm.py +++ b/gbp/scripts/buildpackage_rpm.py @@ -298,9 +298,9 @@ def export_patches(repo, spec, export_treeish, options): def is_native(repo, options): """Determine whether a package is native or non-native""" - if repo.has_branch(options.upstream_branch): - return False - return True + if options.native.is_auto(): + return not repo.has_branch(options.upstream_branch) + return options.native.is_on() def setup_builder(options, builder_args): @@ -416,6 +416,8 @@ def parse_args(argv, prefix, git_treeish=None): dest="color_scheme") parser.add_config_file_option(option_name="notify", dest="notify", type='tristate') parser.add_config_file_option(option_name="vendor", action="store", dest="vendor") + parser.add_config_file_option(option_name="native", dest="native", + type='tristate') tag_group.add_option("--git-tag", action="store_true", dest="tag", default=False, help="create a tag after a successful build") tag_group.add_option("--git-tag-only", action="store_true", dest="tag_only", default=False, -- 2.7.4