summaryrefslogtreecommitdiff
path: root/morphlib
diff options
context:
space:
mode:
authorAdam Coldrick <adam.coldrick@codethink.co.uk>2014-08-08 07:59:02 +0000
committerAdam Coldrick <adam.coldrick@codethink.co.uk>2014-08-14 13:28:50 +0000
commit9e35ea90a1f2c41c3808633e76930f86da6336e5 (patch)
tree4089e408578baabc6f7e3d167107fa7db659e42a /morphlib
parent95c5f93d554883fdedaeb3e111e1be9f88e0045c (diff)
downloadmorph-9e35ea90a1f2c41c3808633e76930f86da6336e5.tar.gz
morphloader: Get commands when loading morphology
Rather than having a `get_commands` method to obtain missing commands from the build system when they are needed, get the commands when loading a morphology.
Diffstat (limited to 'morphlib')
-rw-r--r--morphlib/builder2.py2
-rw-r--r--morphlib/cachekeycomputer.py2
-rw-r--r--morphlib/morphloader.py11
-rw-r--r--morphlib/plugins/cross-bootstrap_plugin.py2
4 files changed, 14 insertions, 3 deletions
diff --git a/morphlib/builder2.py b/morphlib/builder2.py
index d739dc13..c1a49221 100644
--- a/morphlib/builder2.py
+++ b/morphlib/builder2.py
@@ -405,7 +405,7 @@ class ChunkBuilder(BuilderBase):
for step, in_parallel in steps:
with self.build_watch(step):
key = '%s-commands' % step
- cmds = m.get_commands(key)
+ cmds = m[key]
if cmds:
with open(logfilepath, 'a') as log:
self.app.status(msg='Running %(key)s', key=key)
diff --git a/morphlib/cachekeycomputer.py b/morphlib/cachekeycomputer.py
index b124b789..7cbce730 100644
--- a/morphlib/cachekeycomputer.py
+++ b/morphlib/cachekeycomputer.py
@@ -114,7 +114,7 @@ class CacheKeyComputer(object):
for prefix in ('pre-', '', 'post-'):
for cmdtype in ('configure', 'build', 'test', 'install'):
cmd_field = prefix + cmdtype + '-commands'
- keys[cmd_field] = morphology.get_commands(cmd_field)
+ keys[cmd_field] = morphology[cmd_field]
keys['devices'] = morphology.get('devices')
keys['max-jobs'] = morphology.get('max-jobs')
keys['system-integration'] = morphology.get('system-integration',
diff --git a/morphlib/morphloader.py b/morphlib/morphloader.py
index 0249bbae..d06c06dc 100644
--- a/morphlib/morphloader.py
+++ b/morphlib/morphloader.py
@@ -406,6 +406,7 @@ class MorphologyLoader(object):
m = self.parse_morphology_text(string, filename)
m.filename = filename
self.validate(m)
+ self.set_commands(m)
self.set_defaults(m)
return m
@@ -754,3 +755,13 @@ class MorphologyLoader(object):
if morph['max-jobs'] is not None:
morph['max-jobs'] = int(morph['max-jobs'])
+ def set_commands(self, morph):
+ if morph['kind'] == 'chunk':
+ for key in self._static_defaults['chunk']:
+ if 'commands' not in key: continue
+ if key not in morph:
+ attr = '_'.join(key.split('-'))
+ default = self._static_defaults['chunk']['build-system']
+ bs = morphlib.buildsystem.lookup_build_system(
+ morph.get('build-system', default))
+ morph[key] = getattr(bs, attr)
diff --git a/morphlib/plugins/cross-bootstrap_plugin.py b/morphlib/plugins/cross-bootstrap_plugin.py
index cd8e355e..0c3e3a4a 100644
--- a/morphlib/plugins/cross-bootstrap_plugin.py
+++ b/morphlib/plugins/cross-bootstrap_plugin.py
@@ -182,7 +182,7 @@ class BootstrapSystemBuilder(morphlib.builder2.BuilderBase):
for step, in_parallel in steps:
key = '%s-commands' % step
- cmds = m.get_commands(key)
+ cmds = m[key]
for cmd in cmds:
f.write('(')
if in_parallel: