summaryrefslogtreecommitdiff
path: root/morph
diff options
context:
space:
mode:
authorJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-01-26 15:44:12 +0000
committerJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-01-26 16:56:41 +0000
commit862dbd4d73714e5f654401ce072d8d9bc0d03a7b (patch)
treec87961ee656b766ca1599b91c56f15bf15fe46dd /morph
parentba7f8f8421998f52233d5a2eab0214f40638ef7a (diff)
downloadmorph-862dbd4d73714e5f654401ce072d8d9bc0d03a7b.tar.gz
Add a "build-single" command to build a blob without its dependencies.
...while at the same time making sure that all dependencies are marked for staging prior to building the blob itself.
Diffstat (limited to 'morph')
-rwxr-xr-xmorph36
1 files changed, 36 insertions, 0 deletions
diff --git a/morph b/morph
index cbebc46d..3e78fb18 100755
--- a/morph
+++ b/morph
@@ -222,6 +222,42 @@ class Morph(cliapp.Application):
source_manager)
builder.get_cache_id(blob)
+ def cmd_build_single(self, args):
+ tempdir = morphlib.tempdir.Tempdir()
+ morph_loader = MorphologyLoader(self.settings)
+ source_manager = morphlib.sourcemanager.SourceManager(self,
+ update=False)
+ builder = morphlib.builder.Builder(tempdir, self, morph_loader,
+ source_manager)
+
+ if not os.path.exists(self.settings['cachedir']):
+ os.mkdir(self.settings['cachedir'])
+
+ ret = []
+ while len(args) >= 3:
+ repo, ref, filename = args[:3]
+ args = args[3:]
+
+ # derive a build order from the dependency graph
+ graph = BuildDependencyGraph(source_manager, morph_loader,
+ repo, ref, filename)
+ blob = graph.resolve()
+ blobs, order = graph.build_order()
+
+ self.msg('Building %s' % blob)
+
+ # build things in this order
+ ret.append(builder.build_single(blob, blobs, order))
+
+ # we may not have permission to tempdir.remove()
+ ex = morphlib.execute.Execute('.', lambda msg: None)
+ ex.runv(["rm", "-rf", tempdir.dirname])
+
+ if args:
+ raise cliapp.AppException('Extra args on command line: %s' % args)
+
+ return ret
+
def cmd_build_distributed(self, args):
tempdir = morphlib.tempdir.Tempdir()
morph_loader = MorphologyLoader(self.settings)