From 8df5d7df210f9c712c2377cecc6f3f3a7efce01a Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Fri, 24 Oct 2014 16:09:45 +0000 Subject: build: Restructure how BuildCommand.build() is called Rather than take a list of triplets to build, the BuildCommand.build() function now takes a single repo/ref/morph triplet. Iterating through multiple sets of triplets is now done in the build plugin. There are a couple of cosmetic changes to the status output at the start and end of a build as a result. --- morphlib/buildcommand.py | 26 ++++++++++++++------------ morphlib/plugins/build_plugin.py | 8 +++++--- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/morphlib/buildcommand.py b/morphlib/buildcommand.py index 7eb6c0ab..650ee13a 100644 --- a/morphlib/buildcommand.py +++ b/morphlib/buildcommand.py @@ -50,21 +50,23 @@ class BuildCommand(object): self.lac, self.rac = self.new_artifact_caches() self.lrc, self.rrc = self.new_repo_caches() - def build(self, args): - '''Build triplets specified on command line.''' + def build(self, repo_name, ref, filename): + '''Build a given system morphology.''' - self.app.status(msg='Build starts', chatty=True) + self.app.status( + msg='Building %(repo_name)s %(ref)s %(filename)s', + repo_name=repo_name, ref=ref, filename=filename) - for repo_name, ref, filename in self.app.itertriplets(args): - self.app.status(msg='Building %(repo_name)s %(ref)s %(filename)s', - repo_name=repo_name, ref=ref, filename=filename) - self.app.status(msg='Deciding on task order') - srcpool = self.create_source_pool(repo_name, ref, filename) - self.validate_sources(srcpool) - root_artifact = self.resolve_artifacts(srcpool) - self.build_in_order(root_artifact) + self.app.status(msg='Deciding on task order') + srcpool = self.create_source_pool(repo_name, ref, filename) + self.validate_sources(srcpool) + root_artifact = self.resolve_artifacts(srcpool) + self.build_in_order(root_artifact) - self.app.status(msg='Build ends successfully') + self.app.status( + msg='Build of %(repo_name)s %(ref)s %(filename)s ended ' + 'successfully', + repo_name=repo_name, ref=ref, filename=filename) def new_artifact_caches(self): '''Create interfaces for the build artifact caches. diff --git a/morphlib/plugins/build_plugin.py b/morphlib/plugins/build_plugin.py index 64630c2b..d4f53e2b 100644 --- a/morphlib/plugins/build_plugin.py +++ b/morphlib/plugins/build_plugin.py @@ -56,7 +56,8 @@ class BuildPlugin(cliapp.Plugin): build_command = morphlib.buildcommand.InitiatorBuildCommand( self.app, addr, port) - build_command.build(args) + for repo_name, ref, filename in self.app.itertriplets(args): + build_command.build(repo_name, ref, filename) def distbuild(self, args): '''Distbuild a system image in the current system branch @@ -116,7 +117,8 @@ class BuildPlugin(cliapp.Plugin): self.app.settings['cachedir-min-space']) build_command = morphlib.buildcommand.BuildCommand(self.app) - build_command.build(args) + for repo_name, ref, filename in self.app.itertriplets(args): + build_command.build(repo_name, ref, filename) def build(self, args): '''Build a system image in the current system branch @@ -190,4 +192,4 @@ class BuildPlugin(cliapp.Plugin): name=name, email=email, build_uuid=build_uuid, status=self.app.status) with pbb as (repo, ref): - build_command.build([repo, ref, system_filename]) + build_command.build(repo, ref, system_filename) -- cgit v1.2.1