summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-06-11 17:43:54 +0100
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-06-11 17:43:54 +0100
commit6119627405306ed855557964c42f2a322610c23d (patch)
treef02d34c4a2093c5e4f41b42e56dd54daea6f4583
parentf0c0115fd6882b4a161ed0e37fbbc67c3fe809f1 (diff)
downloadmorph-6119627405306ed855557964c42f2a322610c23d.tar.gz
More refactoring: add method to install artifacts
-rwxr-xr-xmorphlib/app.py25
1 files changed, 11 insertions, 14 deletions
diff --git a/morphlib/app.py b/morphlib/app.py
index 71b1e42b..b04d85fd 100755
--- a/morphlib/app.py
+++ b/morphlib/app.py
@@ -262,6 +262,12 @@ class Morph(cliapp.Application):
os.path.exists(staging_area.tempdir)):
shutil.rmtree(staging_area.tempdir)
+ def install_artifacts(self, staging_area, lac, chunk_artifacts):
+ for chunk_artifact in chunk_artifacts:
+ self.msg(' Installing %s' % chunk_artifact.name)
+ handle = lac.get(chunk_artifact)
+ staging_area.install_artifact(handle)
+
def cmd_build(self, args):
'''Build a binary from a morphology.
@@ -319,7 +325,7 @@ class Morph(cliapp.Application):
if setup_proc:
builder.setup_proc = True
- to_be_installed = []
+ to_install = []
for group in order.groups:
for artifact in group:
@@ -327,13 +333,8 @@ class Morph(cliapp.Application):
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 = []
+ self.install_artifacts(staging_area, lac, to_install)
+ to_install = []
builder.build_and_cache(artifact)
else:
@@ -341,18 +342,14 @@ class Morph(cliapp.Application):
self.msg('Using cached %s' % artifact.name)
if install_chunks:
- to_be_installed.extend(
+ to_install.extend(
[x for x in group
if x.source.morphology['kind'] == 'chunk'])
# If we are running bootstrap we probably also want the last
# build group to be installed as well
if self.settings['bootstrap']:
- 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)
+ self.install_artifacts(staging_area, lac, to_install)
self.remove_staging_area(staging_area)