buildpackage: implement --[no-]build cmdline option
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Fri, 26 Apr 2013 08:20:11 +0000 (11:20 +0300)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Tue, 3 Mar 2015 08:07:46 +0000 (10:07 +0200)
For enabling/disabling the builder script. The option is a bit
asymmetric: --git-no-build automatically disables the 'postbuild' hook
whereas --git-build does not enable it (e.g. if --git-no-hooks is
given).

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

index 46c2b20115a68a129b29b9f8dbc356daed1788bf..05d141b28fe767c36ae5318ce0cb1743b0be5838 100644 (file)
@@ -44,6 +44,7 @@
       <arg><option>--git-postbuild=</option><replaceable>COMMAND</replaceable></arg>
       <arg><option>--git-postexport=</option><replaceable>COMMAND</replaceable></arg>
       <arg><option>--git-prebuild=</option><replaceable>COMMAND</replaceable></arg>
+      <arg><option>--git-[no-]build</option></arg>
       <arg><option>--git-[no-]hooks</option></arg>
       <arg><option>--git-debian-tag=</option><replaceable>tag-format</replaceable></arg>
       <arg><option>--git-upstream-tag=</option><replaceable>tag-format</replaceable></arg>
           </para>
         </listitem>
       </varlistentry>
+      <varlistentry>
+        <term><option>--git-[no-]build</option>
+        </term>
+        <listitem>
+          <para>
+          Enable builder. Note: <option>--git-no-build</option> causes the
+          postbuild hook to be disabled, too.
+          </para>
+        </listitem>
+      </varlistentry>
       <varlistentry>
         <term><option>--git-[no-]hooks</option>
         </term>
index 7a26e54b4ea95c0476749097ec29d5a8fd351286..e9382e7128bcfcdaa7cb4e497a8ca1b73d924ceb 100644 (file)
@@ -115,6 +115,7 @@ class GbpOptionParser(OptionParser):
                  'prebuild'        : '',
                  'postexport'      : '',
                  'postimport'      : '',
+                 'build'           : 'True',
                  'hooks'           : 'True',
                  'debian-tag'      : 'debian/%(version)s',
                  'debian-tag-msg'  : '%(pkg)s Debian release %(version)s',
@@ -286,6 +287,8 @@ class GbpOptionParser(OptionParser):
              'postimport':
                   ("hook run after a successful import, "
                    "default is '%(postimport)s'"),
+             'build':
+                  ("Enable running builder, default is %(build)s"),
              'hooks':
                   ("Enable running all hooks, default is %(hooks)s"),
              'time-machine':
index b936ab11faa442770cd126a9b24e337c672fdd4d..699f79fdca090b92e0ef1945560a259e648e6a34 100755 (executable)
@@ -345,6 +345,15 @@ def setup_pbuilder(options):
             os.environ['GIT_PBUILDER_OPTIONS'] = options.pbuilder_options
 
 
+def disable_builder(options):
+    """Disable builder (and postbuild hook)"""
+    gbp.log.info("Disabling builder and postbuild hook")
+    options.builder = ''
+    options.postbuild = ''
+    options.pbuilder = None
+    options.qemubuilder = None
+
+
 def disable_hooks(options):
     """Disable all hooks (except for builder)"""
     for hook in ['cleaner', 'postexport', 'prebuild', 'postbuild', 'posttag']:
@@ -445,6 +454,7 @@ def build_parser(name, prefix=None, git_treeish=None):
     cmd_group.add_config_file_option(option_name="arch", dest="pbuilder_arch")
     cmd_group.add_boolean_config_file_option(option_name = "pbuilder-autoconf", dest="pbuilder_autoconf")
     cmd_group.add_config_file_option(option_name="pbuilder-options", dest="pbuilder_options")
+    cmd_group.add_boolean_config_file_option(option_name="build", dest="build")
     cmd_group.add_boolean_config_file_option(option_name="hooks", dest="hooks")
     export_group.add_config_file_option(option_name="export-dir", dest="export_dir", type="path",
                       help="before building the package export the source into EXPORT_DIR, default is '%(export-dir)s'")
@@ -473,6 +483,9 @@ def parse_args(argv, prefix, git_treeish=None):
     options, args = parser.parse_args(args)
 
     gbp.log.setup(options.color, options.verbose, options.color_scheme)
+    if not options.build:
+        disable_builder(options)
+        dpkg_args = []
     if not options.hooks:
         disable_hooks(options)
     if options.retag: