diff options
Diffstat (limited to 'morphlib')
-rw-r--r-- | morphlib/buildcommand.py | 7 | ||||
-rw-r--r-- | morphlib/plugins/distbuild_plugin.py | 21 |
2 files changed, 17 insertions, 11 deletions
diff --git a/morphlib/buildcommand.py b/morphlib/buildcommand.py index 544d88d8..438badb3 100644 --- a/morphlib/buildcommand.py +++ b/morphlib/buildcommand.py @@ -542,21 +542,18 @@ class InitiatorBuildCommand(BuildCommand): self.app.settings['push-build-branches'] = True super(InitiatorBuildCommand, self).__init__(app) - def build(self, args): + def build(self, repo_name, ref, filename, original_ref=None): '''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() + args = [repo_name, ref, filename, original_ref or ref] cm = distbuild.InitiatorConnectionMachine(self.app, self.addr, self.port, diff --git a/morphlib/plugins/distbuild_plugin.py b/morphlib/plugins/distbuild_plugin.py index 653eeae8..970205c0 100644 --- a/morphlib/plugins/distbuild_plugin.py +++ b/morphlib/plugins/distbuild_plugin.py @@ -45,7 +45,7 @@ class SerialiseArtifactPlugin(cliapp.Plugin): def enable(self): self.app.add_subcommand('serialise-artifact', self.serialise_artifact, - arg_synopsis='REPO REF MORPHOLOGY') + arg_synopsis='REPO REF MORPHOLOGY [ORIGINAL_REF]') def disable(self): pass @@ -55,13 +55,22 @@ class SerialiseArtifactPlugin(cliapp.Plugin): distbuild.add_crash_conditions(self.app.settings['crash-condition']) - if len(args) != 3: - raise cliapp.AppException('Must get triplet') - - repo_name, ref, morph_name = args + if len(args) not in [3, 4]: + raise cliapp.AppException( + 'This command takes a repo/ref/morph triplet, and optionally ' + 'a ref name.') + + repo_name, ref, morph_name = args[0:3] + + if len(args) == 4: + original_ref = args[3] + else: + original_ref = ref + filename = morphlib.util.sanitise_morphology_path(morph_name) build_command = morphlib.buildcommand.BuildCommand(self.app) - srcpool = build_command.create_source_pool(repo_name, ref, filename) + srcpool = build_command.create_source_pool( + repo_name, ref, filename, original_ref=original_ref) artifact = build_command.resolve_artifacts(srcpool) self.app.output.write(distbuild.serialise_artifact(artifact)) self.app.output.write('\n') |