summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--morphlib/morphloader.py41
-rw-r--r--morphlib/morphloader_tests.py25
2 files changed, 40 insertions, 26 deletions
diff --git a/morphlib/morphloader.py b/morphlib/morphloader.py
index 05dcb62..bc7ab6e 100644
--- a/morphlib/morphloader.py
+++ b/morphlib/morphloader.py
@@ -255,6 +255,7 @@ class MorphologyDumper(yaml.SafeDumper):
'artifact',
'include',
'systems',
+ 'deploy-defaults',
'deploy',
'type',
'location',
@@ -338,24 +339,25 @@ class MorphologyLoader(object):
_static_defaults = {
'chunk': {
'description': '',
- 'pre-configure-commands': [],
- 'configure-commands': [],
- 'post-configure-commands': [],
- 'pre-build-commands': [],
- 'build-commands': [],
- 'post-build-commands': [],
- 'pre-test-commands': [],
- 'test-commands': [],
- 'post-test-commands': [],
- 'pre-install-commands': [],
- 'install-commands': [],
- 'post-install-commands': [],
+ 'pre-configure-commands': None,
+ 'configure-commands': None,
+ 'post-configure-commands': None,
+ 'pre-build-commands': None,
+ 'build-commands': None,
+ 'post-build-commands': None,
+ 'pre-test-commands': None,
+ 'test-commands': None,
+ 'post-test-commands': None,
+ 'pre-install-commands': None,
+ 'install-commands': None,
+ 'post-install-commands': None,
'devices': [],
'products': [],
'max-jobs': None,
'build-system': 'manual',
'build-mode': 'staging',
'prefix': '/usr',
+ 'system-integration': [],
},
'stratum': {
'chunks': [],
@@ -690,8 +692,7 @@ class MorphologyLoader(object):
if key in morphology and morphology[key] == defaults[key]:
del morphology[key]
- if kind in ('system', 'stratum', 'cluster'):
- getattr(self, '_unset_%s_defaults' % kind)(morphology)
+ getattr(self, '_unset_%s_defaults' % kind)(morphology)
@classmethod
def _set_stratum_specs_defaults(cls, morphology, specs_field):
@@ -755,6 +756,18 @@ class MorphologyLoader(object):
if morph['max-jobs'] is not None:
morph['max-jobs'] = int(morph['max-jobs'])
+ def _unset_chunk_defaults(self, morph): # pragma: no cover
+ for key in self._static_defaults['chunk']:
+ if key not in morph: continue
+ if 'commands' not in key: continue
+ attr = key.replace('-', '_')
+ default_bs = self._static_defaults['chunk']['build-system']
+ bs = morphlib.buildsystem.lookup_build_system(
+ morph.get('build-system', default_bs))
+ default_value = getattr(bs, attr)
+ if morph[key] == default_value:
+ del morph[key]
+
def set_commands(self, morph):
if morph['kind'] == 'chunk':
for key in self._static_defaults['chunk']:
diff --git a/morphlib/morphloader_tests.py b/morphlib/morphloader_tests.py
index d47ec75..e783bfd 100644
--- a/morphlib/morphloader_tests.py
+++ b/morphlib/morphloader_tests.py
@@ -571,23 +571,24 @@ build-system: dummy
'build-system': 'manual',
'build-mode': 'staging',
- 'configure-commands': [],
- 'pre-configure-commands': [],
- 'post-configure-commands': [],
+ 'configure-commands': None,
+ 'pre-configure-commands': None,
+ 'post-configure-commands': None,
- 'build-commands': [],
- 'pre-build-commands': [],
- 'post-build-commands': [],
+ 'build-commands': None,
+ 'pre-build-commands': None,
+ 'post-build-commands': None,
- 'test-commands': [],
- 'pre-test-commands': [],
- 'post-test-commands': [],
+ 'test-commands': None,
+ 'pre-test-commands': None,
+ 'post-test-commands': None,
- 'install-commands': [],
- 'pre-install-commands': [],
- 'post-install-commands': [],
+ 'install-commands': None,
+ 'pre-install-commands': None,
+ 'post-install-commands': None,
'products': [],
+ 'system-integration': [],
'devices': [],
'max-jobs': None,
'prefix': '/usr',