aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2015-10-05 14:51:24 +0300
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2015-12-09 08:54:20 +0200
commit89648de6fe0084e65a5d8c9a01a04ffc84a0740f (patch)
tree0c73b8f94b5cd97fdfd43ca0d015981d45b1560a
parent1bbb8ada1bb5a61b32d11fe9d186903935c475d1 (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>
-rw-r--r--docs/manpages/gbp-buildpackage-rpm.sgml12
-rw-r--r--gbp/config.py3
-rw-r--r--gbp/scripts/buildpackage_rpm.py23
3 files changed, 29 insertions, 9 deletions
diff --git a/docs/manpages/gbp-buildpackage-rpm.sgml b/docs/manpages/gbp-buildpackage-rpm.sgml
index 9e14dd9..b7138c8 100644
--- a/docs/manpages/gbp-buildpackage-rpm.sgml
+++ b/docs/manpages/gbp-buildpackage-rpm.sgml
@@ -26,6 +26,7 @@
<arg><option>--git-notify=</option><replaceable>[auto|on|off]</replaceable></arg>
<arg><option>--git-tmp-dir</option>=<replaceable>DIRECTORY</replaceable></arg>
<arg><option>--git-vendor</option>=<replaceable>VENDOR</replaceable></arg>
+ <arg><option>--git-native</option>=<replaceable>[auto|on|off]</replaceable></arg>
<arg><option>--git-upstream-branch=</option><replaceable>TREEISH</replaceable></arg>
<arg><option>--git-packaging-branch=</option><replaceable>BRANCH_NAME</replaceable></arg>
<arg><option>--git-ignore-branch</option></arg>
@@ -230,6 +231,17 @@
</listitem>
</varlistentry>
<varlistentry>
+ <term><option>--git-native=</option><replaceable>[auto|on|off]</replaceable>
+ </term>
+ <listitem>
+ <para>
+ Define the 'nativity' of a package. The default value
+ <replaceable>auto</replaceable> makes &gbp-buildpackage-rpm; to
+ guess. Guessing is based on the existence of upstream branch.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term><option>--git-upstream-branch</option>=<replaceable>BRANCH_NAME</replaceable>
</term>
<listitem>
diff --git a/gbp/config.py b/gbp/config.py
index fc6fbaa..934dbe9 100644
--- a/gbp/config.py
+++ b/gbp/config.py
@@ -647,6 +647,7 @@ class GbpOptionParserRpm(GbpOptionParser):
'arch' : '',
'mock-root' : '',
'mock-options' : '',
+ 'native' : 'auto',
})
help = dict(GbpOptionParser.help)
@@ -694,6 +695,8 @@ class GbpOptionParserRpm(GbpOptionParser):
'mock-options':
("Options to pass to mock, "
"default is '%(mock-options)s'"),
+ 'native':
+ "Treat this package as native, default is '%(native)s'",
})
# vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·:
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")