summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-03-01 14:39:27 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-03-02 17:13:29 +0000
commit8c9369d86d0168e9509ec06d7bb5f4f9b5e82311 (patch)
tree23858d7aafdc1aa332bc040bd306bc987ff76745
parent3cb0e37549a360135030ed96357b9c01b93a9184 (diff)
downloadmorph-8c9369d86d0168e9509ec06d7bb5f4f9b5e82311.tar.gz
Simplify how BlobBuilder.builds gets implemented/inherited
It needs to be different for each subclass, yet SystemBuilder was sharing the implementation with ChunkBuilder, which worked, but only by happenstance. Now each class has their own implementation and the base class has a NotImplemented implementation.
-rw-r--r--morphlib/builder.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/morphlib/builder.py b/morphlib/builder.py
index a158a3ea..ed7b4378 100644
--- a/morphlib/builder.py
+++ b/morphlib/builder.py
@@ -171,10 +171,7 @@ class BlobBuilder(object): # pragma: no cover
self.logfile.write('%s\n' % text)
def builds(self):
- ret = {}
- for chunk_name in self.blob.chunks:
- ret[chunk_name] = self.filename(chunk_name)
- return ret
+ raise NotImplemented()
def build(self):
self.prepare_logfile()
@@ -275,6 +272,12 @@ class ChunkBuilder(BlobBuilder): # pragma: no cover
},
}
+ def builds(self):
+ ret = {}
+ for chunk_name in self.blob.chunks:
+ ret[chunk_name] = self.filename(chunk_name)
+ return ret
+
def do_build(self):
self.msg('Creating build tree at %s' % self.builddir)
@@ -495,6 +498,9 @@ class StratumBuilder(BlobBuilder): # pragma: no cover
class SystemBuilder(BlobBuilder): # pragma: no cover
+ def builds(self):
+ return {}
+
def do_build(self):
self.ex = morphlib.execute.Execute(self.tempdir.dirname, self.msg)