Merge "Execute prebuild_hook in the plugin directory"

This commit is contained in:
Jenkins 2016-08-09 10:02:49 +00:00 committed by Gerrit Code Review
commit 99e32daaa6
2 changed files with 8 additions and 6 deletions

View File

@ -53,8 +53,7 @@ class BaseBuildPlugin(BaseAction):
def __init__(self, plugin_path):
self.plugin_path = plugin_path
self.pre_build_hook_path = join_path(self.plugin_path,
'pre_build_hook')
self.pre_build_hook_cmd = './pre_build_hook'
self.meta = utils.parse_yaml(
join_path(self.plugin_path, 'metadata.yaml')
)
@ -78,8 +77,8 @@ class BaseBuildPlugin(BaseAction):
utils.remove_by_mask(self.result_package_mask)
def run_pre_build_hook(self):
if utils.which(self.pre_build_hook_path):
utils.exec_cmd(self.pre_build_hook_path)
if utils.which(join_path(self.plugin_path, self.pre_build_hook_cmd)):
utils.exec_cmd(self.pre_build_hook_cmd, self.plugin_path)
def add_checksums_file(self):
utils.create_checksums_file(self.build_src_dir, self.checksums_path)

View File

@ -76,8 +76,11 @@ class BaseBuild(BaseTestCase):
return_value=True)
def test_run_pre_build_hook(self, exec_cmd_mock, which_mock):
self.builder.run_pre_build_hook()
exec_cmd_mock.assert_called_once_with(self.builder.pre_build_hook_path)
which_mock.assert_called_once_with(self.builder.pre_build_hook_path)
exec_cmd_mock.assert_called_once_with(self.builder.pre_build_hook_cmd,
self.builder.plugin_path)
which_mock.assert_called_once_with(
join_path(self.builder.plugin_path,
self.builder.pre_build_hook_cmd))
@mock.patch('fuel_plugin_builder.actions.build.utils')
def test_build_repos(self, utils_mock):