diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2012-05-02 17:48:33 +0100 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2012-05-02 17:48:33 +0100 |
commit | b09c148764c77e7d878976961fd3549356d24c42 (patch) | |
tree | 6e9592fe9feddd324f7b6f4f887424fa9ee1def6 /morph | |
parent | 341a8cc6b0ed0488bb4d6a1e50f16800a14f0a8a (diff) | |
download | morph-b09c148764c77e7d878976961fd3549356d24c42.tar.gz |
Remove distributed building subcommands
We need to re-implement this for the new internal APIs.
Diffstat (limited to 'morph')
-rwxr-xr-x | morph | 143 |
1 files changed, 0 insertions, 143 deletions
@@ -434,149 +434,6 @@ class Morph(cliapp.Application): if (submod.url, submod.commit) not in done: subs_to_process.add((submod.url, submod.commit)) - def cmd_build_single(self, args): - '''Build a binary from a morphology but do not build its dependencies. - - To build a system or stratum morphology, simply specify the repository, - a git tree-ish reference and the morphology filename on the command - line. To build a chunk morphology, first provide the repository, - reference and morphology filename of its surrounding stratum and then - provide the same information for the chunk morphology itself. This is - needed to resolve the dependencies of the chunk using the stratum as - the build context and to unpack these dependencies in the staging area - prior to building the chunk. - - This command differs from 'build' in that it only builds the morphology - specified on the command line. Dependencies are assumed to have been - built prior to running this command and are only unpacked into the - staging area. - - ''' - tempdir = morphlib.tempdir.Tempdir(self.settings['tempdir']) - morph_loader = MorphologyLoader(self.settings) - source_manager = morphlib.sourcemanager.SourceManager(self, - update=False) - factory = morphlib.builder.Factory(tempdir) - builder = morphlib.builder.Builder(tempdir, self, morph_loader, - source_manager, factory) - - if not os.path.exists(self.settings['cachedir']): - os.mkdir(self.settings['cachedir']) - - factory.create_staging() - - if 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) - first_blob = graph.resolve() - blobs, order = graph.build_order() - - # parse the second blob, if there is one - second_blob = None - if len(args) >= 3: - repo, ref, filename = args[:3] - args = args[3:] - - # load the blob manually - treeish = source_manager.get_treeish(repo, ref) - morphology = morph_loader.load(treeish, filename) - second_blob = morphlib.blobs.Blob.create_blob(morphology) - - try: - # find the corresponding blob object in the blobs - # returned from the dependency graph - second_blob = [x for x in blobs if x == second_blob][0] - except IndexError: - raise cliapp.AppException('%s and %s are unrelated' % - (first_blob, second_blob)) - - # build the single blob - if second_blob: - # verify that the two input blobs are valid - if first_blob.morph.kind != 'stratum': - raise cliapp.AppException('The first tuple %s needs to ' - 'refer to a stratum' % - first_blob) - if second_blob.morph.kind != 'chunk': - raise cliapp.AppException('The first tuple %s needs to ' - 'refer to a chunk' % second_blob) - - # build now - self.msg('Building %s' % second_blob) - builder.build_single(second_blob, order) - else: - # build the blob now - self.msg('Building %s' % first_blob) - builder.build_single(first_blob, order) - - tempdir.remove() - - if args: - raise cliapp.AppException('Extra args on command line: %s' % args) - - def cmd_build_distributed(self, args): - '''Build a binary from a morphology, distributing work where possible. - - Command line arguments are the repository, git tree-ish reference, - and morphology filename. Morph takes care of building all dependencies - before building the morphology. All generated binaries are put into the - cache. - - This command differs from 'build' in that it distributes work to - other machines where possible. This may include preparing the source - tree, preparing the staging area, building individual chunks and - caching the built items. - - Distributing currently works by running 'morph build-single' on other - machines via SSH. The machines to be used for this are specified using - the '-w/--worker' command line options. - - (The triplet of command line arguments may be repeated as many - times as necessary.) - - ''' - - tempdir = morphlib.tempdir.Tempdir(self.settings['tempdir']) - morph_loader = MorphologyLoader(self.settings) - source_manager = morphlib.sourcemanager.SourceManager(self, - update=not self.settings['no-git-update']) - - # create a build controller - controller = buildcontroller.BuildController(self, tempdir) - - # create and add the build workers - if len(self.settings['worker']) == 0: - num_workers = morphlib.util.make_concurrency() - for i in range(num_workers): - name = controller.generate_worker_name('local') - worker = buildworker.LocalBuildWorker(name, 'local', self) - controller.add_worker(worker) - else: - for worker in self.settings['worker']: - name = controller.generate_worker_name(worker) - worker = buildworker.RemoteBuildWorker(name, worker, self) - controller.add_worker(worker) - - result = [] - - for repo, ref, filename in self._itertriplets(args): - # derive a build order from the dependency graph - graph = BuildDependencyGraph(source_manager, morph_loader, - repo, ref, filename) - graph.resolve() - blobs, order = graph.build_order() - - self.msg('Building %s|%s|%s' % (repo, ref, filename)) - - # build the tuple and all its dependencies - result.append(controller.build(blobs, order)) - - tempdir.remove() - def cmd_make_patch(self, args): '''Create a Trebuchet patch between two system images.''' |