diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2015-10-05 14:51:24 +0300 |
---|---|---|
committer | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2015-12-09 08:54:20 +0200 |
commit | 89648de6fe0084e65a5d8c9a01a04ffc84a0740f (patch) | |
tree | 0c73b8f94b5cd97fdfd43ca0d015981d45b1560a /gbp/scripts/buildpackage_rpm.py | |
parent | 1bbb8ada1bb5a61b32d11fe9d186903935c475d1 (diff) |
buildpackage_rpm: implement --native option
Implement a new command line/config file option for forcing a package to
be [non-]native. This makes it possible to set the 'nativity' of a
package in gbp.conf and avoid the pitfalls caused by guessing based on
git branch names.
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 | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/gbp/scripts/buildpackage_rpm.py b/gbp/scripts/buildpackage_rpm.py index 2841f82..00582df 100644 --- a/gbp/scripts/buildpackage_rpm.py +++ b/gbp/scripts/buildpackage_rpm.py @@ -238,16 +238,19 @@ def git_archive_build_orig(repo, spec, output_dir, options): def is_native(repo, options): """Determine whether a package is native or non-native""" - if repo.has_branch(options.upstream_branch): - return False - # Check remotes, too - for remote_branch in repo.get_remote_branches(): - remote, branch = remote_branch.split('/', 1) - if branch == options.upstream_branch: - gbp.log.debug("Found upstream branch '%s' from remote '%s'" % - (remote, branch)) + if options.native.is_auto(): + if repo.has_branch(options.upstream_branch): return False - return True + # Check remotes, too + for remote_branch in repo.get_remote_branches(): + remote, branch = remote_branch.split('/', 1) + if branch == options.upstream_branch: + gbp.log.debug("Found upstream branch '%s' from remote '%s'" % + (remote, branch)) + return False + return True + + return options.native.is_on() def setup_builder(options, builder_args): @@ -347,6 +350,8 @@ def build_parser(name, prefix=None, git_treeish=None): 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") |