buildpackage-rpm: add '--git-native' option
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Tue, 15 Jul 2014 11:54:44 +0000 (14:54 +0300)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Mon, 21 Jul 2014 13:02:48 +0000 (13:02 +0000)
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 <markus.lehtonen@linux.intel.com>
gbp/config.py
gbp/scripts/buildpackage_rpm.py

index a2c28de..90c5068 100644 (file)
@@ -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':
index d9abb80..fdde2db 100755 (executable)
@@ -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,