summaryrefslogtreecommitdiff
path: root/morphlib/builder.py
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2012-01-27 16:12:34 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2012-01-27 16:12:34 +0000
commit17d2adcd9311cadb7cabd7c22af7b07c5956aa6a (patch)
treed3c067470cbea4b663bcc7c5bd4384c49ee9e183 /morphlib/builder.py
parent63bfe59411133c9c5f18f26c0fc1e782fd01a72b (diff)
parent02f25c13c7b2fd253c6022e9b22f91d98f20e68b (diff)
downloadmorph-17d2adcd9311cadb7cabd7c22af7b07c5956aa6a.tar.gz
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'morphlib/builder.py')
-rw-r--r--morphlib/builder.py37
1 files changed, 35 insertions, 2 deletions
diff --git a/morphlib/builder.py b/morphlib/builder.py
index 038ec564..53127223 100644
--- a/morphlib/builder.py
+++ b/morphlib/builder.py
@@ -546,8 +546,8 @@ class Builder(object):
for parent in blob.parents:
for item, filename in built_items:
- self.msg('Marking %s to be staged for %s'
- % (item, parent))
+ self.msg('Marking %s to be staged for %s' %
+ (item, parent))
parent_builder = builders[parent]
parent_builder.stage_items += built_items
@@ -558,6 +558,39 @@ class Builder(object):
return ret
+ def build_single(self, blob, blobs, build_order):
+ self.indent_more()
+
+ # first pass: create builders for all blobs
+ builders = {}
+ for group in build_order:
+ for blob in group:
+ builder = self.create_blob_builder(blob)
+ builders[blob] = builder
+
+ # second pass: walk the build order blob by blob, mark blobs
+ # to be staged for their parents, but do not build them
+ ret = []
+ for group in build_order:
+ for blob in group:
+ built_items = builders[blob].builds()
+ for parent in blob.parents:
+ stage_items = []
+ for name, filename in built_items.items():
+ self.msg('Marking %s to be staged for %s' %
+ (name, parent))
+ stage_items.append((name, filename))
+
+ parent_builder = builders[parent]
+ parent_builder.stage_items.extend(stage_items)
+
+ # build the single blob now
+ ret.append(builders[blob].build())
+
+ self.indent_less()
+
+ return ret
+
def create_blob_builder(self, blob):
if isinstance(blob, morphlib.blobs.Stratum):
builder = StratumBuilder(blob)