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>
Fri, 14 Nov 2014 12:47:21 +0000 (14:47 +0200)
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.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
gbp/config.py
gbp/scripts/buildpackage_rpm.py

index 983c5ef..dd0c631 100644 (file)
@@ -604,6 +604,7 @@ class GbpOptionParserRpm(GbpOptionParser):
             'builder'                   : 'rpmbuild',
             'cleaner'                   : '/bin/true',
             'export-dir'                : '../rpmbuild',
+            'native'                    : 'auto',
             'ignore-untracked'          : 'False',
             'rpmbuild-builddir'         : 'BUILD',
             'rpmbuild-rpmdir'           : 'RPMS',
@@ -655,6 +656,8 @@ class GbpOptionParserRpm(GbpOptionParser):
                 "Spec file to use, 'auto' makes gbp to guess, other values "
                 "make the packaging-dir option to be ignored, default is "
                 "'%(spec-file)s'",
+            'native':
+                "Treat this package as native, default is '%(native)s'",
             'ignore-untracked':
                 "build with untracked files in the source tree, default is "
                 "'%(ignore-untracked)s'",
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,