diff options
author | Jannis Pohlmann <jannis.pohlmann@codethink.co.uk> | 2012-01-18 18:40:43 +0000 |
---|---|---|
committer | Jannis Pohlmann <jannis.pohlmann@codethink.co.uk> | 2012-01-19 12:07:46 +0000 |
commit | 749948736178b7df4e8c52a3dddf16f83359dcfc (patch) | |
tree | abe1b191ca0a18d4976ec59896ca60bddb65febd /morphlib/builder.py | |
parent | 85069b20d623b93154fb3858eaae0e978fd6a2e6 (diff) | |
download | morph-749948736178b7df4e8c52a3dddf16f83359dcfc.tar.gz |
Apply code review changes and fix a bug when clearing dependencies.
Diffstat (limited to 'morphlib/builder.py')
-rw-r--r-- | morphlib/builder.py | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/morphlib/builder.py b/morphlib/builder.py index 222e884c..ff5fc3f6 100644 --- a/morphlib/builder.py +++ b/morphlib/builder.py @@ -90,7 +90,7 @@ class BlobBuilder(object): # if not all build items are in the cache, rebuild the blob if not all(os.path.isfile(builds[name]) for name in builds): with self.build_watch('overall-build'): - built_items += self.do_build() + self.do_build() # check again, fail if not all build items were actually built if not all(os.path.isfile(builds[name]) for name in builds): @@ -99,11 +99,13 @@ class BlobBuilder(object): # install all build items to the staging area for name, filename in builds.items(): - self.msg('Using cached %s %s at %s' % (self.blob.morph.kind, - name, filename)) + self.msg('Fetching cached %s %s from %s' % + (self.blob.morph.kind, name, filename)) self.install_chunk(name, filename) self.dump_memory_profile('after installing chunk') + built_items.append((name, filename)) + return built_items def filename(self, name): @@ -217,7 +219,7 @@ class ChunkBuilder(BlobBuilder): 'FAKEROOTKEY', 'FAKED_MODE', 'FAKEROOT_FD_BASE', - ], None) + ]) for name in copied_vars: copied_vars[name] = self.ex.env.get(name, None) @@ -523,11 +525,8 @@ class Builder(object): # second pass: build group by group, item after item ret = [] - while len(build_order) > 0: - group = build_order.popleft() - while len(group) > 0: - blob = group.pop() - + for group in build_order: + for blob in group: self.msg('Building %s' % blob) self.indent_more() @@ -546,12 +545,12 @@ class Builder(object): built_items = builders[blob].build() - if blob.parent: + for parent in blob.parents: for item, filename in built_items: - self.msg('Marking %s to be staged for %s' % - (item, blob.parent)) + self.msg('Marking %s to be staged for %s' + % (item, parent)) - parent_builder = builders[blob.parent] + parent_builder = builders[parent] parent_builder.stage_items += built_items self.indent_less() |