diff options
author | Richard Ipsum <richard.ipsum@codethink.co.uk> | 2014-03-27 11:13:30 +0000 |
---|---|---|
committer | Richard Ipsum <richard.ipsum@codethink.co.uk> | 2014-03-27 11:13:30 +0000 |
commit | f56259c2ce62c301f0e0f9dd7c85001b45fc8f5c (patch) | |
tree | bdf2e7ad0985212e306d5b970c0999087b81f91b /morphlib/buildcommand.py | |
parent | 170d81eba0568856401f57ce655ad9881b802d21 (diff) | |
parent | 9cbf777d614b8f240ccaa0203e7e3ba40b487f11 (diff) | |
download | morph-f56259c2ce62c301f0e0f9dd7c85001b45fc8f5c.tar.gz |
Merge branch 'baserock/richardipsum/merge_distbuild'
Conflicts:
morphlib/plugins/deploy_plugin.py
without-test-modules
Reviewed by:
Richard Maw
Lars Wirzenius
Diffstat (limited to 'morphlib/buildcommand.py')
-rw-r--r-- | morphlib/buildcommand.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/morphlib/buildcommand.py b/morphlib/buildcommand.py index 862ae715..7ad7909d 100644 --- a/morphlib/buildcommand.py +++ b/morphlib/buildcommand.py @@ -20,6 +20,7 @@ import logging import tempfile import morphlib +import distbuild class MultipleRootArtifactsError(morphlib.Error): @@ -475,3 +476,32 @@ class BuildCommand(object): self.app, staging_area, self.lac, self.rac, self.lrc, self.app.settings['max-jobs'], setup_mounts) return builder.build_and_cache(artifact) + +class InitiatorBuildCommand(BuildCommand): + + def __init__(self, app, addr, port): + self.app = app + self.addr = addr + self.port = port + self.app.settings['push-build-branches'] = True + super(InitiatorBuildCommand, self).__init__(app) + + def build(self, args): + '''Initiate a distributed build on a controller''' + + distbuild.add_crash_conditions(self.app.settings['crash-condition']) + + if len(args) != 3: + raise morphlib.Error( + 'Need repo, ref, morphology triplet to build') + + if self.addr == '': + raise morphlib.Error( + 'Need address of controller to run a distbuild') + + self.app.status(msg='Starting distributed build') + loop = distbuild.MainLoop() + cm = distbuild.ConnectionMachine( + self.addr, self.port, distbuild.Initiator, [self.app] + args) + loop.add_state_machine(cm) + loop.run() |