diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2012-12-17 13:39:26 +0000 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2012-12-17 18:58:08 +0000 |
commit | a515abc125826416e9ced2a71882d66ac36759b1 (patch) | |
tree | 31064668dd7a973fefc973f0bcd7996342b893d6 /morphlib/buildcommand.py | |
parent | c853e4aa39c978054c037d1e7061e939427d495c (diff) | |
download | morph-a515abc125826416e9ced2a71882d66ac36759b1.tar.gz |
Validate stratum build-depends against system contents
This ensures that we don't try to build the same stratum from two different
refs.
Diffstat (limited to 'morphlib/buildcommand.py')
-rw-r--r-- | morphlib/buildcommand.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/morphlib/buildcommand.py b/morphlib/buildcommand.py index 95f3812e..cd7cbc26 100644 --- a/morphlib/buildcommand.py +++ b/morphlib/buildcommand.py @@ -102,8 +102,14 @@ class BuildCommand(object): return order def _validate_cross_morphology_references(self, srcpool): + '''Perform validation across all morphologies involved in the build''' + + stratum_names = [] + for src in srcpool: kind = src.morphology['kind'] + + # Verify that chunks pointed to by strata really are chunks, etc. method_name = '_validate_cross_refs_for_%s' % kind if hasattr(self, method_name): logging.debug('Calling %s' % method_name) @@ -111,6 +117,19 @@ class BuildCommand(object): else: logging.warning('No %s' % method_name) + # Verify stratum build-depends agree with the system's contents. + # It's not an error to build-depend on a stratum that isn't + # included in the target system, but if it is included, the repo + # and ref fields must match. + if src.morphology['kind'] == 'stratum': + name = src.morphology['name'] + if name in stratum_names: + raise morphlib.Error( + "Conflicting versions of stratum '%s' appear in the " + "build. Check the contents of the system against the " + "build-depends of the strata." % name) + stratum_names.append(name) + def _validate_cross_refs_for_system(self, src, srcpool): self._validate_cross_refs_for_xxx( src, srcpool, src.morphology['strata'], 'stratum') |