summaryrefslogtreecommitdiff
path: root/morphlib/morphologyfactory.py
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2013-08-07 12:14:41 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2013-08-07 13:41:40 +0100
commitedc50cf457a92575a22e202e648d64b0ef1a3527 (patch)
treeab32524630bf0b3480761ef2c3a338b054ce29f8 /morphlib/morphologyfactory.py
parent131d8744eb68c75deb491fb3ce39c83851c64ae3 (diff)
downloadmorph-edc50cf457a92575a22e202e648d64b0ef1a3527.tar.gz
morphologyfactory: validate stratum build-depends
A stratum morphology must either have stratum build-depends, or have some bootstrap chunks, otherwise there's no way to have the required set of commands to be able to build chunks. A concession has been made to also allow strata that contain chunks built in test mode, but this opens a reproducibility hole. Unit tests for these failures have been added, and the stratum used by other unit tests has been fixed.
Diffstat (limited to 'morphlib/morphologyfactory.py')
-rw-r--r--morphlib/morphologyfactory.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/morphlib/morphologyfactory.py b/morphlib/morphologyfactory.py
index fa71e820..ae5a4332 100644
--- a/morphlib/morphologyfactory.py
+++ b/morphlib/morphologyfactory.py
@@ -54,6 +54,13 @@ class EmptyStratumError(StratumError):
"Stratum %s is empty (has no dependencies)" % stratum)
+class NoStratumBuildDependsError(StratumError):
+ def __init__(self, stratum):
+ StratumError.__init__(
+ self, 'Stratum %s has no build-dependencies listed '
+ 'and has no bootstrap chunks.' % stratum)
+
+
class MorphologyFactory(object):
'''An way of creating morphologies which will provide a default'''
@@ -162,6 +169,11 @@ class MorphologyFactory(object):
name = source.get('name', source.get('repo', 'unknown'))
raise NoChunkBuildDependsError(filename, name)
+ if (len(morphology['build-depends'] or []) == 0 and
+ not any(c.get('build-mode') in ('bootstrap', 'test')
+ for c in morphology['chunks'])):
+ raise NoStratumBuildDependsError(filename)
+
morphology.builds_artifacts = [morphology['name']]
morphology.needs_artifact_metadata_cached = True