diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2013-02-25 15:17:49 +0000 |
---|---|---|
committer | Jonathan Maw <jonathan.maw@codethink.co.uk> | 2013-07-30 11:22:06 +0000 |
commit | 3ec0ff49ee8a015dd472ede2ed0996009b015c33 (patch) | |
tree | 0eca9022d2ea3f271a93ce31801df9068c43b264 /morphlib/morph2_tests.py | |
parent | c3ec8559f4fe5f1a43002a197ad6316f752910d8 (diff) | |
download | morph-3ec0ff49ee8a015dd472ede2ed0996009b015c33.tar.gz |
Add morph cross-bootstrap
Cross-bootstrap is a way to build baserock on an architecture that
does not currently have Baserock. It can be used by `morph
cross-bootstrap <ARCH> <REPO> <REF> <MORPH>`, and will build an artifact
that can be used as a root filesystem with a basic build environment
with a script named `native-bootstrap` which will build and install
every chunk in the system.
If done with a devel system, this will give you a suitable environment
for building a proper Baserock system.
This does not currently provide a kernel for the target architecture.
Apart from adding the cross-bootstrap plugin, it also makes the
following changes:
* Moves the lit of valid_archs into morphlib (instead of locally-scoped
in MorphologyFactory)
* BuildCommand takes an extra argument, build_env
* split BuildCommand's get_artifact_object into create_source_pool and
resolve_artifacts (plus changes things that use get_artifact_object to
use the new way)
* setup_mounts finds out whether to do so by whether build_mode is
'staging', instead of by whether the setting 'staging-chroot' is true.
* Makes ChunkBuilder's get_sources use the
morphlib.builder2.extract_sources() method, and moved
set_mtime_recursively into morphlib.builder2, since it's not currently
used anywhere else.
* moved ChunkBuilder's get_commands into the Morphology class (plus
changes to anything that used get_commands)
Diffstat (limited to 'morphlib/morph2_tests.py')
-rw-r--r-- | morphlib/morph2_tests.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/morphlib/morph2_tests.py b/morphlib/morph2_tests.py index 1a0b4822..9de23e56 100644 --- a/morphlib/morph2_tests.py +++ b/morphlib/morph2_tests.py @@ -344,3 +344,38 @@ class MorphologyTests(unittest.TestCase): dummy = Morphology(self.stratum_text) output_dict = dummy._apply_changes(live_dict, original_dict) self.assertEqual(original_dict, output_dict) + + def test_uses_morphology_commands_when_given(self): + m = Morphology(''' + { + 'name': 'foo', + 'kind': 'chunk', + 'build-system': 'dummy', + 'build-commands': ['build-it'] + } + ''') + cmds = m.get_commands('build-commands') + self.assertEqual(cmds, ['build-it']) + + def test_uses_build_system_commands_when_morphology_doesnt(self): + m = Morphology(''' + { + 'name': 'foo', + 'kind': 'chunk', + 'build-system': 'dummy', + } + ''') + cmds = m.get_commands('build-commands') + self.assertEqual(cmds, ['echo dummy build']) + + def test_uses_morphology_commands_when_morphology_has_empty_list(self): + m = Morphology(''' + { + 'name': 'foo', + 'kind': 'chunk', + 'build-system': 'dummy', + 'build-commands': [] + } + ''') + cmds = m.get_commands('build-commands') + self.assertEqual(cmds, []) |