diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2013-02-22 11:45:16 +0000 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2013-03-13 15:20:03 +0000 |
commit | a20a6bdf6ed75c6bd5c06a25961e0c6bec93bdd6 (patch) | |
tree | 4602606c5659ed54a79fc2f1e9e858fbf7b2516f /morphlib/buildcommand.py | |
parent | 18b162cd4556eb8c63767916cd376d87630db1b7 (diff) | |
download | morph-a20a6bdf6ed75c6bd5c06a25961e0c6bec93bdd6.tar.gz |
Don't install bootstrapped chunks when building artifacts in other strata
When building a stratum artifact it's easy to only include chunks that
were built in 'staging' mode. Constructing the staging area doesn't use
that code path, though, so we need an extra hack to filter out those
artifacts while building.
It may be neater to express stratum build-depends as actual
dependencies on the stratum artifact, rather than each of its
constituent chunks as we do now.
Diffstat (limited to 'morphlib/buildcommand.py')
-rw-r--r-- | morphlib/buildcommand.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/morphlib/buildcommand.py b/morphlib/buildcommand.py index d602b5ea..9f6a0470 100644 --- a/morphlib/buildcommand.py +++ b/morphlib/buildcommand.py @@ -346,6 +346,15 @@ class BuildCommand(object): filename=filename) staging_area.install_artifact(f) + # Nasty hack to avoid installing chunks built in 'bootstrap' mode in a + # different stratum when constructing staging areas. + def is_stratum(self, a): + return a.source.morphology['kind'] == 'stratum' + + def in_same_stratum(self, a, b): + return len(filter(self.is_stratum, a.dependencies)) == \ + len(filter(self.is_stratum, b.dependencies)) + def install_dependencies(self, staging_area, artifacts, target_artifact): '''Install chunk artifacts into staging area. @@ -360,6 +369,9 @@ class BuildCommand(object): for artifact in artifacts: if artifact.source.morphology['kind'] != 'chunk': continue + if artifact.source.build_mode == 'bootstrap': + if not self.in_same_stratum(artifact, target_artifact): + continue self.app.status(msg='[%(name)s] Installing chunk %(chunk_name)s', name=target_artifact.name, chunk_name=artifact.name) |