diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2013-04-23 15:45:38 +0300 |
---|---|---|
committer | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2014-11-14 14:46:24 +0200 |
commit | 14aef925c9eeb46c909d49b2271ef4c64eb747c8 (patch) | |
tree | 4e85af65568b66987478db8da2e8ea15fa6701a2 /gbp | |
parent | 54b2577c2063b8aac1b92e77eb4ced264764b25c (diff) | |
download | git-buildpackage-14aef925c9eeb46c909d49b2271ef4c64eb747c8.tar.gz git-buildpackage-14aef925c9eeb46c909d49b2271ef4c64eb747c8.tar.bz2 git-buildpackage-14aef925c9eeb46c909d49b2271ef4c64eb747c8.zip |
buildpackage-rpm: implement --[no-]hooks option
For enabling/disabling all hooks, similar to git-buildpackage (the
Debian tool). Does not affedt the builder.
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'gbp')
-rwxr-xr-x | gbp/scripts/buildpackage_rpm.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gbp/scripts/buildpackage_rpm.py b/gbp/scripts/buildpackage_rpm.py index ae4e494c..56c6b893 100755 --- a/gbp/scripts/buildpackage_rpm.py +++ b/gbp/scripts/buildpackage_rpm.py @@ -319,6 +319,14 @@ def create_packaging_tag(repo, tag, commit, version, options): keyid=options.keyid, commit=commit) +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, git_treeish=None): args = [ arg for arg in argv[1:] if arg.find('--%s' % prefix) == 0 ] builder_args = [ arg for arg in argv[1:] if arg.find('--%s' % prefix) == -1 ] @@ -395,6 +403,7 @@ def parse_args(argv, prefix, git_treeish=None): help="hook run after a successful build, default is '%(postbuild)s'") 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_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", @@ -428,6 +437,8 @@ def parse_args(argv, prefix, git_treeish=None): options.patch_export_compress = rpm.string_to_int(options.patch_export_compress) 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)) |