From fae23a5162e40a559f931279ae72b940aba8064d Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Wed, 11 Feb 2015 11:40:17 +0000 Subject: distbuild: Rearrange code that sends exec-request message --- distbuild/build_controller.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/distbuild/build_controller.py b/distbuild/build_controller.py index 387b410f..1794586d 100644 --- a/distbuild/build_controller.py +++ b/distbuild/build_controller.py @@ -244,6 +244,15 @@ class BuildController(distbuild.StateMachine): self.mainloop.queue_event(self, _Start()) + def _request_command_execution(self, argv, request_id): + '''Tell the controller's distbuild-helper to run a command.''' + msg = distbuild.message('exec-request', + id=request_id, + argv=argv, + stdin_contents='') + req = distbuild.HelperRequest(msg) + self.mainloop.queue_event(distbuild.HelperRouter, req) + def _start_graphing(self, event_source, event): distbuild.crash_point() @@ -260,14 +269,10 @@ class BuildController(distbuild.StateMachine): ] if 'original_ref' in self._request: argv.append(self._request['original_ref']) - msg = distbuild.message('exec-request', - id=self._idgen.next(), - argv=argv, - stdin_contents='') - self._helper_id = msg['id'] - req = distbuild.HelperRequest(msg) - self.mainloop.queue_event(distbuild.HelperRouter, req) - + + self._helper_id = self._idgen.next() + self._request_command_execution(argv, self._helper_id) + progress = BuildProgress(self._request['id'], 'Computing build graph') self.mainloop.queue_event(BuildController, progress) -- cgit v1.2.1