From 17dd327b1adea02a2db7031ca82413406ad30402 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Tue, 27 Aug 2013 18:14:59 +0300 Subject: [PATCH] bootstrap: Support hooks Initial support for per-branch hooks. Currently only post-build hook is supported. Signed-off-by: Markus Lehtonen --- bootstrap.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bootstrap.py b/bootstrap.py index a35ddf6..1061f59 100755 --- a/bootstrap.py +++ b/bootstrap.py @@ -82,6 +82,11 @@ def build_test_pkg(pkg_name, branch, outdir): tag_pattern = 'srcdata/%s/%s/release/*' % (pkg_name, branch) git_cmd('checkout', ['srcdata/%s/%s' % (pkg_name, branch)]) + # Check for hooks + hooks = {} + if os.path.exists('.bootstrap_hooks.py'): + LOG.info('Loading bootstrap hooks') + execfile('.bootstrap_hooks.py', hooks, hooks) tags = git_cmd('tag', ['-l', tag_pattern], True) for ind, tag in enumerate(tags): builddir = tempfile.mkdtemp(dir='.', @@ -95,6 +100,12 @@ def build_test_pkg(pkg_name, branch, outdir): raise Exception('Building %s / %s failed! Builddata can be found ' 'in %s' % (pkg_name, tag, builddir)) + # Run postbuild_all hook + if 'postbuild' in hooks: + LOG.info('Running postbuild_all() hook for %s / %s' % + (pkg_name, tag)) + hooks['postbuild'](builddir, tag, LOG) + # Create subdirs orig_dir = '%s/%s' % (outdir, 'orig') if not os.path.isdir(orig_dir): -- 2.34.1