summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/manpages/git-buildpackage.sgml9
-rw-r--r--gbp/config.py3
-rwxr-xr-xgbp/scripts/buildpackage.py11
3 files changed, 23 insertions, 0 deletions
diff --git a/docs/manpages/git-buildpackage.sgml b/docs/manpages/git-buildpackage.sgml
index d528f3d4..be3676ff 100644
--- a/docs/manpages/git-buildpackage.sgml
+++ b/docs/manpages/git-buildpackage.sgml
@@ -41,6 +41,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-]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>
<arg><option>--git-force-create</option></arg>
@@ -291,6 +292,14 @@
</listitem>
</varlistentry>
<varlistentry>
+ <term><option>--git-[no-]hooks</option></term>
+ <listitem>
+ <para>Enable running all (cleaner, postexport, prebuild, postbuild,
+ and posttag) hooks. Note: the <option>--git-builder</option> command is
+ not affected by this option.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term><option>--git-debian-tag=</option><replaceable>tag-format</replaceable>
</term>
<listitem>
diff --git a/gbp/config.py b/gbp/config.py
index ec75765a..c27cf5a6 100644
--- a/gbp/config.py
+++ b/gbp/config.py
@@ -83,6 +83,7 @@ class GbpOptionParser(OptionParser):
'prebuild' : '',
'postexport' : '',
'postimport' : '',
+ 'hooks' : 'True',
'debian-tag' : 'debian/%(version)s',
'upstream-tag' : 'upstream/%(version)s',
'import-msg' : 'Imported Upstream version %(version)s',
@@ -241,6 +242,8 @@ class GbpOptionParser(OptionParser):
'postimport':
("hook run after a successful import, "
"default is '%(postimport)s'"),
+ 'hooks':
+ ("Enable running all hooks, default is %(hooks)s"),
'time-machine':
("don't try head commit only to apply the patch queue "
"but look TIME_MACHINE commits back, "
diff --git a/gbp/scripts/buildpackage.py b/gbp/scripts/buildpackage.py
index 9c02e3e3..989801f2 100755
--- a/gbp/scripts/buildpackage.py
+++ b/gbp/scripts/buildpackage.py
@@ -342,6 +342,14 @@ def setup_pbuilder(options):
os.environ['GIT_PBUILDER_OPTIONS'] = options.pbuilder_options
+def disable_hooks(options):
+ """Disable all hooks (except for builder)"""
+ for hook in ['cleaner', 'postexport', 'prebuild', 'postbuild', 'posttag']:
+ if getattr(options, hook):
+ gbp.log.info("Disabling '%s' hook" % hook)
+ setattr(options, hook, '')
+
+
def parse_args(argv, prefix):
args = [ arg for arg in argv[1:] if arg.find('--%s' % prefix) == 0 ]
dpkg_args = [ arg for arg in argv[1:] if arg.find('--%s' % prefix) == -1 ]
@@ -421,6 +429,7 @@ def parse_args(argv, prefix):
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="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'")
export_group.add_config_file_option("export", dest="export",
@@ -432,6 +441,8 @@ def parse_args(argv, prefix):
options, args = parser.parse_args(args)
gbp.log.setup(options.color, options.verbose, options.color_scheme)
+ if not options.hooks:
+ disable_hooks(options)
if options.retag:
if not options.tag and not options.tag_only:
gbp.log.err("'--%sretag' needs either '--%stag' or '--%stag-only'" % (prefix, prefix, prefix))