diff options
author | Jannis Pohlmann <jannis.pohlmann@codethink.co.uk> | 2012-05-08 16:11:49 +0000 |
---|---|---|
committer | Jannis Pohlmann <jannis.pohlmann@codethink.co.uk> | 2012-05-08 16:11:49 +0000 |
commit | 0f5f472d7648677f32446080ec079784250c172e (patch) | |
tree | 5e53c4fd3bb88f100c8acaf00d62e9951c09c8f9 | |
parent | 17702f32e4af3046f54133867ef291ff5e925aea (diff) | |
download | morph-0f5f472d7648677f32446080ec079784250c172e.tar.gz |
Defer installing chunk artifacts until we need them.
We want to avoid installing anything into the staging area unless
we actually need it. When building we now simply defer all install
operations until we come across something we do not have cached
and that we actually have to build. We then install everything we
have encountered so far (either cached or built) and clear the list
of what needs to be installed.
The list of things to be installed in the future is populated at
the end of processing a build group so that nothing built in the
current group is installed until all other artifacts in the group
have been built as well.
-rwxr-xr-x | morph | 22 |
1 files changed, 13 insertions, 9 deletions
@@ -281,26 +281,30 @@ class Morph(cliapp.Application): if setup_proc: builder.setup_proc = True + to_be_installed = set() + for group in order.groups: for artifact in group: if artifact in needed: logging.debug('Need to build %s' % artifact.name) self.msg('Building %s' % artifact.name) + + for chunk_artifact in to_be_installed: + logging.debug('Installing %s' % chunk_artifact.name) + self.msg(' Installing %s' % chunk_artifact.name) + handle = lac.get(chunk_artifact) + staging_area.install_artifact(handle) + to_be_installed.clear() + builder.build_and_cache(artifact) else: logging.debug('No need to build %s' % artifact.name) self.msg('Using cached %s' % artifact.name) if install_chunks: - logging.debug('installing chunks from just-built group') - # install chunks only - chunk_artifacts = [x - for x in group - if x.source.morphology['kind'] == - 'chunk'] - for artifact in chunk_artifacts: - handle = lac.get(artifact) - staging_area.install_artifact(handle) + to_be_installed.update( + [x for x in group + if x.source.morphology['kind'] == 'chunk']) if staging_root != '/': staging_area.remove() |