buildpackage-rpm: add --git-no-build option
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Fri, 11 Jul 2014 12:23:19 +0000 (15:23 +0300)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Fri, 14 Nov 2014 12:47:20 +0000 (14:47 +0200)
Replaces and deprecates --git-export-only. The new option name is way
better in line with the other option names.

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

index 5e24416e055ea47f775a6a408dca221252b842f7..74a8aeb398247c6bea83c64d33e8fd2da28be025 100755 (executable)
@@ -461,6 +461,9 @@ def parse_args(argv, prefix, git_treeish=None):
     cmd_group.add_config_file_option(option_name="posttag", dest="posttag",
                       help="hook run after a successful tag operation, default is '%(posttag)s'")
     cmd_group.add_boolean_config_file_option(option_name="hooks", dest="hooks")
+    export_group.add_option("--git-no-build", action="store_true",
+                      dest="no_build",
+                      help="Don't run builder or the associated hooks")
     export_group.add_config_file_option(option_name="export-dir", dest="export_dir", type="path",
                       help="Build topdir, also export the sources under EXPORT_DIR, default is '%(export-dir)s'")
     export_group.add_config_file_option(option_name="rpmbuild-builddir", dest="build_dir", type="path",
@@ -504,6 +507,12 @@ def parse_args(argv, prefix, git_treeish=None):
         if not options.tag and not options.tag_only:
             gbp.log.err("'--%sretag' needs either '--%stag' or '--%stag-only'" % (prefix, prefix, prefix))
             return None, None, None
+    # Use git_treeish as a way to print the warning only on the second parsing
+    # round
+    if options.export_only and git_treeish:
+        gbp.log.warn("Deprecated option '--git-export-only', please use "
+                     "'--no-build' instead!")
+        options.no_build = True
 
     return options, args, builder_args
 
@@ -636,7 +645,7 @@ def main(argv):
                              extra_env={'GBP_GIT_DIR': repo.git_dir,
                                         'GBP_TMP_DIR': export_dir})(dir=export_dir)
             # Do actual build
-            if not options.export_only and not options.tag_only:
+            if not options.no_build and not options.tag_only:
                 if options.prebuild:
                     RunAtCommand(options.prebuild, shell=True,
                                  extra_env={'GBP_GIT_DIR': repo.git_dir,