diff options
author | Daniel Firth <dan.firth@codethink.co.uk> | 2013-10-28 17:56:23 +0000 |
---|---|---|
committer | Daniel Firth <dan.firth@codethink.co.uk> | 2013-10-30 12:20:00 +0000 |
commit | 6a315135ac6273c90f7dc35b7d4c49da158be487 (patch) | |
tree | c014c050030311112f32e97fe58197a7c7c062d1 /morphlib/buildcommand.py | |
parent | 9f22da771ebfec1901d0fe90f87b1960aa578748 (diff) | |
download | morph-6a315135ac6273c90f7dc35b7d4c49da158be487.tar.gz |
Added scenario test for preventing cross-building
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 cbcc39fd..7b7612a4 100644 --- a/morphlib/buildcommand.py +++ b/morphlib/buildcommand.py @@ -50,6 +50,7 @@ class BuildCommand(object): self.app.status(msg='Deciding on task order') srcpool = self.create_source_pool(repo_name, ref, filename) root_artifact = self.resolve_artifacts(srcpool) + self._validate_architecture(root_artifact) self.build_in_order(root_artifact) self.app.status(msg='Build ends successfully') @@ -88,6 +89,17 @@ class BuildCommand(object): return srcpool + def _validate_architecture(self, root_artifact): + '''Perform the validation between root and target architectures.''' + + root_arch = root_artifact.source.morphology['arch'] + host_arch = morphlib.util.get_host_architecture() + if root_arch != host_arch: + raise morphlib.Error( + 'Are you trying to cross-build? ' + 'Host architecture is %s but target is %s' + % (host_arch, root_arch)) + def resolve_artifacts(self, srcpool): '''Resolve the artifacts that will be built for a set of sources''' |