summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmorphlib/app.py8
-rw-r--r--morphlib/buildcommand.py9
2 files changed, 14 insertions, 3 deletions
diff --git a/morphlib/app.py b/morphlib/app.py
index 47288a6a..eaba5dd9 100755
--- a/morphlib/app.py
+++ b/morphlib/app.py
@@ -173,6 +173,9 @@ class Morph(cliapp.Application):
raise morphlib.Error(
'System time is far in the past, please set your system clock')
+ def setup(self):
+ self.status_prefix = ''
+
def process_args(self, args):
self.check_time()
@@ -342,11 +345,14 @@ class Morph(cliapp.Application):
* ``error`` should be true when it is an error message
All other keywords are ignored unless embedded in ``msg``.
+
+ The ``self.status_prefix`` string is prepended to the output.
+ It is set to the empty string by default.
'''
assert 'msg' in kwargs
- text = kwargs['msg'] % kwargs
+ text = self.status_prefix + (kwargs['msg'] % kwargs)
error = kwargs.get('error', False)
chatty = kwargs.get('chatty', False)
diff --git a/morphlib/buildcommand.py b/morphlib/buildcommand.py
index b9ded140..e27581d2 100644
--- a/morphlib/buildcommand.py
+++ b/morphlib/buildcommand.py
@@ -51,7 +51,7 @@ class BuildCommand(object):
artifact = self.get_artifact_object(repo_name, ref, filename)
self.build_in_order(artifact)
- self.app.status(msg='Build ends successfully', chatty=True)
+ self.app.status(msg='Build ends successfully')
def new_build_env(self):
'''Create a new BuildEnvironment instance.'''
@@ -186,8 +186,13 @@ class BuildCommand(object):
self.app.status(msg='Building according to build ordering',
chatty=True)
- for a in artifact.walk():
+ artifacts = artifact.walk()
+ old_prefix = self.app.status_prefix
+ for i, a in enumerate(artifacts):
+ self.app.status_prefix = (
+ old_prefix + '[Build %d/%d] ' % ((i+1), len(artifacts)))
self.build_artifact(a)
+ self.app.status_prefix = old_prefix
def build_artifact(self, artifact):
'''Build one artifact.