From 862dbd4d73714e5f654401ce072d8d9bc0d03a7b Mon Sep 17 00:00:00 2001 From: Jannis Pohlmann Date: Thu, 26 Jan 2012 15:44:12 +0000 Subject: 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. --- morph | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'morph') 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) -- cgit v1.2.1